81 vertices.emplace_back(v1);
82 vertices.emplace_back(v2);
83 vertices.emplace_back(v3);
84 vertices.emplace_back(v4);
86 return AddPolygon(name, texture, vertices, tw, th, autosize);
95 std::vector<Extents> index_extents;
96 std::vector<std::vector<Polygon::Geometry> > geometry;
97 std::vector<Triangle> triangles;
99 if (!
meshwrapper->
GetPolyMesh()->
CreateMesh(name, texture, vertices, tw, th, autosize, tm, tv, geometry, triangles, converted_vertices))
105 if (triangles.size() == 0)
123 std::vector<std::vector<Polygon::Geometry> > geometry;
124 std::vector<Triangle> triangles;
132 if (triangles.size() == 0)
158 if (recreate_collider ==
true)
175 if (index > -1 && index < (
int)
polygons.size())
182 if (recreate_colliders ==
true)
198 if (index > -1 && index < (
int)
polygons.size())
212 for (
size_t i = 0; i <
polygons.size(); i++)
228 Real pr, best_pr = 2000000000.;
238 for (
size_t i = 0; i <
polygons.size(); i++)
243 if (
polygons[i]->IntersectSegment(start, end, cur_isect, &pr, normal))
271 for (
size_t i = 0; i <
polygons.size(); i++)
299 Real distance = 2000000000.;
300 Vector3 normal = Vector3::ZERO;
322 for (
size_t j = 0; j <
polygons[i]->geometry[0].size(); j++)
329 Real tmpaltitude = altitude;
330 if (tmpaltitude < yextents.x || tmpaltitude > yextents.y)
334 utility->
SplitWithPlane(1, poly, tmp1, tmp2, tmpaltitude - 0.001);
337 utility->
SplitWithPlane(1, tmp2, poly, tmp1, tmpaltitude + 0.001);
340 if (get_max ==
false)
366 for (
size_t i = 0; i <
polygons.size(); i++)
369 polygons[i]->ChangeHeight(newheight);
381 unsigned int total = 0;
382 for (
size_t i = 0; i <
polygons.size(); i++)
392 unsigned int total = 0;
393 for (
size_t i = 0; i <
polygons.size(); i++)
396 total +=
polygons[i]->triangles.size();
std::vector< Wall * > Walls
void Prepare(bool force=false)
bool UsingDynamicBuffers()
const std::string & GetName()
virtual bool ReportError(const std::string &message)
void SetValues(const std::string &type, const std::string &name, bool is_permanent, bool is_movable=true)
virtual void Move(const Vector3 &vector, Real speed=1.0, bool force=false)
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)
bool ChangeTexture(const std::string &texture, bool matcheck=true)
Vector3 GetWallExtents(Real altitude, bool get_max)
void DeletePolygons(bool recreate_collider=true)
Wall(MeshObject *wrapper, const std::string &name)
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)