TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Welder.h
Go to the documentation of this file.
1 #ifndef G3D_Welder_h
2 #define G3D_Welder_h
3 
4 #include "G3D/platform.h"
5 #include "G3D/Array.h"
6 #include "G3D/Vector3.h"
7 #include "G3D/Vector2.h"
8 
9 namespace G3D {
10 
11 class Any;
12 
13 class Welder {
14 private:
15 
16  Welder() {}
17 
18 public:
19 
20  class Settings {
21  public:
25 
28 
30 
32 
33  inline Settings(float normalSmoothAngle = toRadians(70.0f)) :
34  normalSmoothingAngle(normalSmoothAngle),
35  vertexWeldRadius(0.001f),
36  textureWeldRadius(0.0001f),
37  normalWeldRadius(0.01f) {}
38 
39 
40  Settings(const Any& any);
41 
42  Any toAny() const;
43 
44  void serialize(class BinaryOutput& b) const;
45 
46  void deserialize(class BinaryInput& b);
47  };
48 
58  static void weld(
59  Array<Vector3>& vertices,
60  Array<Vector2>& textureCoords,
61  Array<Vector3>& normals,
62  Array<Array<int>*>& indices,
63  const Settings& settings);
64 
73  inline static void weld(
74  Array<Vector3>& vertices,
75  Array<Vector2>& textureCoords,
76  Array<Vector3>& normals,
77  Array<int>& indices,
78  const Settings& settings) {
79 
80  Array<Array<int>*> meta;
81  meta.append(&indices);
82  weld(vertices, textureCoords, normals, meta, settings);
83  }
84 };
85 
86 }
87 
88 #endif
static void weld(Array< Vector3 > &vertices, Array< Vector2 > &textureCoords, Array< Vector3 > &normals, Array< int > &indices, const Settings &settings)
Definition: Welder.h:73
Definition: BinaryInput.h:69
float vertexWeldRadius
Definition: Welder.h:27
Definition: AABox.h:25
Dynamic 1D array tuned for performance.
Definition: Array.h:95
bool any(float x)
Definition: g3dmath.h:424
float textureWeldRadius
Definition: Welder.h:29
float normalWeldRadius
Definition: Welder.h:31
Definition: Welder.h:20
Easy loading and saving of human-readable configuration files.
Definition: Any.h:184
Any toAny() const
Definition: Welder.cpp:518
double toRadians(double deg)
Definition: g3dmath.h:798
Welder()
Definition: Welder.h:16
Definition: Welder.h:13
static void weld(Array< Vector3 > &vertices, Array< Vector2 > &textureCoords, Array< Vector3 > &normals, Array< Array< int > * > &indices, const Settings &settings)
Definition: Welder.cpp:485
void deserialize(class BinaryInput &b)
Definition: Welder.cpp:476
void serialize(class BinaryOutput &b) const
Definition: Welder.cpp:468
float normalSmoothingAngle
Definition: Welder.h:24
Definition: BinaryOutput.h:52
Settings(float normalSmoothAngle=toRadians(70.0f))
Definition: Welder.h:33
void append(const T &value)
Definition: Array.h:583