TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MeshBuilder.h
Go to the documentation of this file.
1 
9 #ifndef G3D_MESHBUILDER_H
10 #define G3D_MESHBUILDER_H
11 
12 #include "G3D/platform.h"
13 #include "G3D/Array.h"
14 #include "G3D/Vector3.h"
15 #include "G3D/Triangle.h"
16 
17 namespace G3D {
18 
23 class MeshBuilder {
24 public:
25 
30  enum {AUTO_WELD = -100};
31 
32 private:
34  typedef Array<int> List;
35 
36  std::string name;
37 
39 
44 
45  void centerTriList();
47 
48  bool _twoSided;
49 
51  double close;
52 
53 public:
54 
55  inline MeshBuilder(bool twoSided = false, bool scaleAndCenter = true) : scaleAndCenter(scaleAndCenter), _twoSided(twoSided), close(AUTO_WELD) {}
56 
59  void commit(std::string& name, Array<int>& indexArray, Array<Vector3>& vertexArray);
60 
64  void addTriangle(const Vector3& a, const Vector3& b, const Vector3& c);
65 
69  void addQuad(const Vector3& a, const Vector3& b, const Vector3& c, const Vector3& d);
70 
71  void addTriangle(const Triangle& t);
72 
73  void setName(const std::string& n);
74 
77  void setWeldRadius(double r) {
78  close = r;
79  }
80 };
81 
82 } // namespace
83 
84 #endif
Array< Vector3 > triList
Definition: MeshBuilder.h:43
void computeBounds(Vector3 &min, Vector3 &max)
Definition: MeshBuilder.cpp:84
void setName(const std::string &n)
Definition: MeshBuilder.cpp:15
void centerTriList()
Definition: MeshBuilder.cpp:59
MeshBuilder(bool twoSided=false, bool scaleAndCenter=true)
Definition: MeshBuilder.h:55
Definition: AABox.h:25
bool _twoSided
Definition: MeshBuilder.h:48
void commit(std::string &name, Array< int > &indexArray, Array< Vector3 > &vertexArray)
Definition: MeshBuilder.cpp:20
Definition: MeshBuilder.h:23
void addTriangle(const Vector3 &a, const Vector3 &b, const Vector3 &c)
Definition: MeshBuilder.cpp:96
Definition: MeshBuilder.h:30
std::string name
Definition: MeshBuilder.h:36
T max(const T &x, const T &y)
Definition: g3dmath.h:320
Definition: Vector3.h:58
bool scaleAndCenter
Definition: MeshBuilder.h:38
void setWeldRadius(double r)
Definition: MeshBuilder.h:77
T min(const T &x, const T &y)
Definition: g3dmath.h:305
void addQuad(const Vector3 &a, const Vector3 &b, const Vector3 &c, const Vector3 &d)
Definition: MeshBuilder.cpp:105
Array< int > List
Definition: MeshBuilder.h:34
double close
Definition: MeshBuilder.h:51
Definition: Triangle.h:34