74 vertices.emplace_back(v1);
75 vertices.emplace_back(v2);
76 vertices.emplace_back(v3);
77 vertices.emplace_back(v4);
79 return AddPolygon(name, texture, vertices, tw, th, autosize);
88 std::vector<Extents> index_extents;
89 std::vector<std::vector<Polygon::Geometry> > geometry;
90 std::vector<Triangle> triangles;
92 if (!
meshwrapper->
GetPolyMesh()->
CreateMesh(name, texture, vertices, tw, th, autosize, tm, tv, geometry, triangles, converted_vertices))
98 if (triangles.size() == 0)
116 std::vector<std::vector<Polygon::Geometry> > geometry;
117 std::vector<Triangle> triangles;
125 if (triangles.size() == 0)
148 if (recreate_collider ==
true)
162 if (index > -1 && index < (
int)
polygons.size())
169 if (recreate_colliders ==
true)
185 if (index > -1 && index < (
int)
polygons.size())
196 for (
size_t i = 0; i <
polygons.size(); i++)
209 Real pr, best_pr = 2000000000.;
219 for (
size_t i = 0; i <
polygons.size(); i++)
221 if (
polygons[i]->IntersectSegment(start, end, cur_isect, &pr, normal))
246 for (
size_t i = 0; i <
polygons.size(); i++)
273 Real distance = 2000000000.;
274 Vector3 normal = Vector3::ZERO;
291 for (
size_t j = 0; j <
polygons[i]->geometry[0].size(); j++)
298 Real tmpaltitude = altitude;
299 if (tmpaltitude < yextents.x || tmpaltitude > yextents.y)
309 if (get_max ==
false)
332 for (
size_t i = 0; i <
polygons.size(); i++)
334 polygons[i]->ChangeHeight(newheight);
346 unsigned int total = 0;
347 for (
size_t i = 0; i <
polygons.size(); i++)
356 unsigned int total = 0;
357 for (
size_t i = 0; i <
polygons.size(); i++)
359 total +=
polygons[i]->triangles.size();
void Prepare(bool force=false)
bool UsingDynamicBuffers()
const std::string & GetName()
virtual bool ReportError(const std::string &message)
virtual void Move(const Vector3 &vector, Real speed=1.0)
Wall * FindWallIntersect(const Vector3 &start, const Vector3 &end, Vector3 &isect, Real &distance, Vector3 &normal, Wall *wall=0)
bool CreateMesh(const std::string &name, const std::string &texture, PolyArray &vertices, Real tw, Real th, bool autosize, Matrix3 &tex_matrix, Vector3 &tex_vector, std::vector< std::vector< Polygon::Geometry > > &geometry, std::vector< Triangle > &triangles, PolygonSet &converted_vertices)
bool ChangeTexture(const std::string &texture, bool matcheck=true)
bool ReplaceTexture(const std::string &oldtexture, const std::string &newtexture)
TextureManager * GetTextureManager()
Real ToLocal(Real remote_value)
Real ToRemote(Real local_value)
std::string GetTextureMaterial(const std::string &name, bool &result, bool report=true, const std::string &polygon_name="")
Vector2 GetExtents(PolyArray &varray, int coord, bool flip_z=false)
void SplitWithPlane(int axis, PolyArray &orig, PolyArray &poly1, PolyArray &poly2, Real value)
Plane ComputePlane(PolyArray &vertices, bool flip_normal=true)
std::vector< Wall * > * parent_array
void DeletePolygon(int index, bool recreate_colliders)
int FindPolygon(const std::string &name)
Wall(MeshObject *wrapper)
bool ChangeTexture(const std::string &texture, bool matcheck=true)
Vector3 GetWallExtents(Real altitude, bool get_max)
void DeletePolygons(bool recreate_collider=true)
void SetParentArray(std::vector< Wall * > &array)
std::vector< Polygon * > polygons
bool IntersectsWall(Vector3 start, Vector3 end, Vector3 &isect, bool convert=true)
unsigned int GetTriangleCount()
void Move(const Vector3 &vector, Real speed=1.0)
void ChangeHeight(Real newheight)
bool ReplaceTexture(const std::string &oldtexture, const std::string &newtexture)
Polygon * GetPolygon(int index)
unsigned int GetVertexCount()
Polygon * AddPolygonSet(const std::string &name, const std::string &material, PolygonSet &vertices, Matrix3 &tex_matrix, Vector3 &tex_vector)
Vector3 GetPoint(const Vector3 &start, const Vector3 &end)
Polygon * AddQuad(const std::string &name, const std::string &texture, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector3 &v4, Real tw, Real th, bool autosize)
Polygon * AddPolygon(const std::string &name, const std::string &texture, PolyArray &vertices, Real tw, Real th, bool autosize)
std::vector< Vector3 > PolyArray
std::vector< PolyArray > PolygonSet
#define SBS_PROFILE(name)