My Project: dynamics.mod/NewtonDynamics/source/meshUtil/dgMeshEffect.h Source File

My Project

dgMeshEffect.h
Go to the documentation of this file.
1 /* Copyright (c) <2003-2011> <Julio Jerez, Newton Game Dynamics>
2 *
3 * This software is provided 'as-is', without any express or implied
4 * warranty. In no event will the authors be held liable for any damages
5 * arising from the use of this software.
6 *
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely, subject to the following restrictions:
10 *
11 * 1. The origin of this software must not be misrepresented; you must not
12 * claim that you wrote the original software. If you use this software
13 * in a product, an acknowledgment in the product documentation would be
14 * appreciated but is not required.
15 *
16 * 2. Altered source versions must be plainly marked as such, and must not be
17 * misrepresented as being the original software.
18 *
19 * 3. This notice may not be removed or altered from any source distribution.
20 */
21
22 #ifndef __dgMeshEffect_H__
23 #define __dgMeshEffect_H__
24
25 #include <dgRefCounter.h>
26
27 class dgWorld;
28 class dgMeshEffect;
29 class dgCollisionInstance;
30
31 #define DG_MESH_EFFECT_PRECISION_BITS 48
32 #define DG_MESH_EFFECT_PRECISION_SCALE dgFloat64(dgInt64(1)<<DG_MESH_EFFECT_PRECISION_BITS)
33 #define DG_MESH_EFFECT_PRECISION_SCALE_INV (dgFloat64 (1.0f) / DG_MESH_EFFECT_PRECISION_SCALE)
34
35
36 #define DG_MESH_EFFECT_INITIAL_VERTEX_SIZE 8
37 #define DG_VERTEXLIST_INDEXLIST_TOL (dgFloat64 (0.0f))
38 #define DG_MESH_EFFECT_POINT_SPLITED 512
39
40
41
42 #define DG_MESH_EFFECT_BVH_STACK_DEPTH 256
43
44
45 class dgMeshEffect: public dgPolyhedra, public dgRefCounter
46 {
47 public:
48
49 class dgVertexAtribute
50 {
51 public:
52 dgBigVector m_vertex;
53 dgFloat64 m_normal_x;
54 dgFloat64 m_normal_y;
55 dgFloat64 m_normal_z;
56 dgFloat64 m_u0;
57 dgFloat64 m_v0;
58 dgFloat64 m_u1;
59 dgFloat64 m_v1;
60 dgFloat64 m_material;
61 };
62
63 class dgIndexArray
64 {
65 public:
66 dgInt32 m_materialCount;
67 dgInt32 m_indexCount;
68 dgInt32 m_materials[256];
69 dgInt32 m_materialsIndexCount[256];
70 dgInt32* m_indexList;
71 };
72
73
74
75 public:
76 class dgMeshBVH
77 {
78 public:
79 class dgMeshBVHNode
80 {
81 public:
82 dgMeshBVHNode (const dgMeshEffect* const mesh, dgEdge* const face, void* const userData);
83 dgMeshBVHNode (dgMeshBVHNode* const left, dgMeshBVHNode* const right);
84 ~dgMeshBVHNode ();
85 void SetBox (const dgVector& p0, const dgVector& p1);
86
87 DG_CLASS_ALLOCATOR(allocator)
88 dgVector m_p0;
89 dgVector m_p1;
90
91 dgFloat32 m_area;
92 dgEdge* m_face;
93 void* m_userData;
94 dgMeshBVHNode* m_left;
95 dgMeshBVHNode* m_right;
96 dgMeshBVHNode* m_parent;
97 };
98
99 class dgFitnessList: public dgTree <dgMeshBVHNode*, dgMeshBVHNode*>
100 {
101 public:
102 dgFitnessList (dgMemoryAllocator* const allocator);
103 dgFloat64 TotalCost () const;
104 };
105
106
107 dgMeshBVH (dgMeshEffect* const mesh);
108 virtual ~dgMeshBVH();
109
110 virtual void Build ();
111 virtual void Cleanup ();
112
113 void GetOverlapNodes (dgList<dgMeshBVHNode*>& overlapNodes, const dgBigVector& p0, const dgBigVector& p1) const;
114 dgMeshBVHNode* FaceRayCast (const dgBigVector& l0, const dgBigVector& l1, dgFloat64& paramOut, bool doubleSidedFaces) const;
115
116 protected:
117 dgMeshBVHNode* AddFaceNode (dgEdge* const face, void* const userData);
118 void RemoveNode (dgMeshBVHNode* const treeNode);
119 void ImproveNodeFitness ();
120 void ImproveNodeFitness (dgMeshBVHNode* const node);
121 dgFloat32 CalculateSurfaceArea (dgMeshBVHNode* const node0, dgMeshBVHNode* const node1, dgVector& minBox, dgVector& maxBox) const;
122 virtual bool SanityCheck() const;
123
124 virtual dgFloat64 VertexRayCast (const dgBigVector& l0, const dgBigVector& l1) const;
125 virtual dgFloat64 RayFaceIntersect (const dgMeshBVHNode* const face, const dgBigVector& p0, const dgBigVector& p1, bool dobleSidedFaces) const;
126 virtual bool RayRayIntersect (dgEdge* const edge, const dgMeshEffect* const otherMesh, dgEdge* const otherEdge, dgFloat64& param, dgFloat64& otherParam) const;
127
128 dgMeshEffect* m_mesh;
129 dgMeshBVHNode* m_rootNode;
130 dgFitnessList m_fitness;
131 friend class dgMeshEffect;
132 };
133
134
135
136 dgMeshEffect(dgMemoryAllocator* const allocator);
137 dgMeshEffect(dgCollisionInstance* const collision);
138 dgMeshEffect(const dgMeshEffect& source);
139 dgMeshEffect(dgPolyhedra& mesh, const dgMeshEffect& source);
140 dgMeshEffect (dgMemoryAllocator* const allocator, dgDeserialize deserialization, void* const userData);
141
142 // create from OFF or PLY file format
143 dgMeshEffect(dgMemoryAllocator* const allocator, const char* const fileName);
144
145 // Create a convex hull Mesh form point cloud
146 dgMeshEffect (dgMemoryAllocator* const allocator, const dgFloat64* const vertexCloud, dgInt32 count, dgInt32 strideInByte, dgFloat64 distTol);
147
148 // create a planar Mesh
149 dgMeshEffect(dgMemoryAllocator* const allocator, const dgMatrix& planeMatrix, dgFloat32 witdth, dgFloat32 breadth, dgInt32 material, const dgMatrix& textureMatrix0, const dgMatrix& textureMatrix1);
150 virtual ~dgMeshEffect(void);
151
152 void Trace () const;
153 void SaveOFF (const char* const fileName) const;
154
155 void ApplyTransform (const dgMatrix& matrix);
156 dgMatrix CalculateOOBB (dgBigVector& size) const;
157 void CalculateAABB (dgBigVector& min, dgBigVector& max) const;
158
159 void CalculateNormals (dgFloat64 angleInRadians);
160 void SphericalMapping (dgInt32 material);
161 void BoxMapping (dgInt32 front, dgInt32 side, dgInt32 top);
162 void UniformBoxMapping (dgInt32 material, const dgMatrix& textruMatrix);
163 void CylindricalMapping (dgInt32 cylinderMaterial, dgInt32 capMaterial);
164 void AngleBaseFlatteningMapping (dgInt32 cylinderMaterial, dgReportProgress progressReportCallback, void* const userData);
165
166 dgEdge* InsertEdgeVertex (dgEdge* const edge, dgFloat64 param);
167
168 dgMeshEffect* Union (const dgMatrix& matrix, const dgMeshEffect* const clipper) const;
169 dgMeshEffect* Difference (const dgMatrix& matrix, const dgMeshEffect* const clipper) const;
170 dgMeshEffect* Intersection (const dgMatrix& matrix, const dgMeshEffect* const clipper) const;
171 void ClipMesh (const dgMatrix& matrix, const dgMeshEffect* const clipper, dgMeshEffect** const top, dgMeshEffect** const bottom) const;
172
173 //bool PlaneClip (const dgBigPlane& plane);
174
175 dgMeshEffect* ConvexMeshIntersection (const dgMeshEffect* const convexMesh) const;
176
177 dgMeshEffect* GetFirstLayer ();
178 dgMeshEffect* GetNextLayer (dgMeshEffect* const layer);
179
180 void Triangulate ();
181 void ConvertToPolygons ();
182 void RemoveUnusedVertices(dgInt32* const vertexRemapTable);
183
184 void BeginPolygon ();
185 void AddPolygon (dgInt32 count, const dgFloat32* const vertexList, dgInt32 stride, dgInt32 material);
186 #ifndef _NEWTON_USE_DOUBLE
187 void AddPolygon (dgInt32 count, const dgFloat64* const vertexList, dgInt32 stride, dgInt32 material);
188 #endif
189 void EndPolygon (dgFloat64 tol, bool fixTjoint = true);
190
191 void PackVertexArrays ();
192
193 void BuildFromVertexListIndexList(dgInt32 faceCount, const dgInt32 * const faceIndexCount, const dgInt32 * const faceMaterialIndex,
194 const dgFloat32* const vertex, dgInt32 vertexStrideInBytes, const dgInt32 * const vertexIndex,
195 const dgFloat32* const normal, dgInt32 normalStrideInBytes, const dgInt32 * const normalIndex,
196 const dgFloat32* const uv0, dgInt32 uv0StrideInBytes, const dgInt32 * const uv0Index,
197 const dgFloat32* const uv1, dgInt32 uv1StrideInBytes, const dgInt32 * const uv1Index);
198
199
200 dgInt32 GetVertexCount() const;
201 dgInt32 GetVertexStrideInByte() const;
202 dgFloat64* GetVertexPool () const;
203
204 dgInt32 GetPropertiesCount() const;
205 dgInt32 GetPropertiesStrideInByte() const;
206 dgFloat64* GetAttributePool() const;
207 dgFloat64* GetNormalPool() const;
208 dgFloat64* GetUV0Pool() const;
209 dgFloat64* GetUV1Pool() const;
210
211 dgEdge* SpliteFace (dgInt32 v0, dgInt32 v1);
212
213 dgInt32 GetTotalFaceCount() const;
214 dgInt32 GetTotalIndexCount() const;
215 void GetFaces (dgInt32* const faceCount, dgInt32* const materials, void** const faceNodeList) const;
216
217 void RepairTJoints ();
218 bool SeparateDuplicateLoops (dgEdge* const face);
219
220 bool HasOpenEdges () const;
221
222 dgFloat64 CalculateVolume () const;
223
224 void GetVertexStreams (dgInt32 vetexStrideInByte, dgFloat32* const vertex,
225 dgInt32 normalStrideInByte, dgFloat32* const normal,
226 dgInt32 uvStrideInByte0, dgFloat32* const uv0,
227 dgInt32 uvStrideInByte1, dgFloat32* const uv1);
228
229 void GetIndirectVertexStreams(dgInt32 vetexStrideInByte, dgFloat64* const vertex, dgInt32* const vertexIndices, dgInt32* const vertexCount,
230 dgInt32 normalStrideInByte, dgFloat64* const normal, dgInt32* const normalIndices, dgInt32* const normalCount,
231 dgInt32 uvStrideInByte0, dgFloat64* const uv0, dgInt32* const uvIndices0, dgInt32* const uvCount0,
232 dgInt32 uvStrideInByte1, dgFloat64* const uv1, dgInt32* const uvIndices1, dgInt32* const uvCount1);
233
234
235
236 dgIndexArray* MaterialGeometryBegin();
237 void MaterialGeomteryEnd(dgIndexArray* const handle);
238 dgInt32 GetFirstMaterial (dgIndexArray* const handle) const;
239 dgInt32 GetNextMaterial (dgIndexArray* const handle, dgInt32 materialHandle) const;
240 dgInt32 GetMaterialID (dgIndexArray* const handle, dgInt32 materialHandle) const;
241 dgInt32 GetMaterialIndexCount (dgIndexArray* const handle, dgInt32 materialHandle) const;
242 void GetMaterialGetIndexStream (dgIndexArray* const handle, dgInt32 materialHandle, dgInt32* const index) const;
243 void GetMaterialGetIndexStreamShort (dgIndexArray* const handle, dgInt32 materialHandle, dgInt16* const index) const;
244
245 dgCollisionInstance* CreateCollisionTree(dgWorld* const world, dgInt32 shapeID) const;
246 dgCollisionInstance* CreateConvexCollision(dgWorld* const world, dgFloat64 tolerance, dgInt32 shapeID, const dgMatrix& matrix = dgGetIdentityMatrix()) const;
247
248 dgMeshEffect* CreateSimplification (dgInt32 maxVertexCount, dgReportProgress reportProgressCallback, void* const userData) const;
249 dgMeshEffect* CreateConvexApproximation (dgFloat32 maxConcavity, dgFloat32 backFaceDistanceFactor, dgInt32 maxHullOuputCount, dgInt32 maxVertexPerHull, dgReportProgress reportProgressCallback, void* const userData) const;
250
251 static dgMeshEffect* CreateDelaunayTetrahedralization (dgMemoryAllocator* const allocator, dgInt32 pointCount, dgInt32 pointStrideInBytes, const dgFloat32* const pointCloud, dgInt32 materialId, const dgMatrix& textureProjectionMatrix);
252 static dgMeshEffect* CreateVoronoiConvexDecomposition (dgMemoryAllocator* const allocator, dgInt32 pointCount, dgInt32 pointStrideInBytes, const dgFloat32* const pointCloud, dgInt32 materialId, const dgMatrix& textureProjectionMatrix);
253 static dgMeshEffect* CreateFromSerialization (dgMemoryAllocator* const allocator, dgDeserialize deserialization, void* const userData);
254
255 void Serialize (dgSerialize callback, void* const userData) const;
256
257 dgBigVector& GetVertex (dgInt32 index) const;
258 dgVertexAtribute& GetAttribute (dgInt32 index) const;
259 void TransformMesh (const dgMatrix& matrix);
260
261
262 void* GetFirstVertex () const;
263 void* GetNextVertex (const void* const vertex) const;
264 int GetVertexIndex (const void* const vertex) const;
265
266 void* GetFirstPoint () const;
267 void* GetNextPoint (const void* const point) const;
268 int GetPointIndex (const void* const point) const;
269 int GetVertexIndexFromPoint (const void* const point) const;
270
271
272 void* GetFirstEdge () const;
273 void* GetNextEdge (const void* const edge) const;
274 void GetEdgeIndex (const void* const edge, dgInt32& v0, dgInt32& v1) const;
275 // void GetEdgeAttributeIndex (const void* edge, dgInt32& v0, dgInt32& v1) const;
276
277 void* GetFirstFace () const;
278 void* GetNextFace (const void* const face) const;
279 int IsFaceOpen (const void* const face) const;
280 int GetFaceMaterial (const void* const face) const;
281 int GetFaceIndexCount (const void* const face) const;
282 void GetFaceIndex (const void* const face, dgInt32* const indices) const;
283 void GetFaceAttributeIndex (const void* const face, dgInt32* const indices) const;
284 dgBigVector CalculateFaceNormal (const void* const face) const;
285
286 void SetFaceMaterial (const void* const face, int materialID) const;
287
288
289 dgVertexAtribute InterpolateVertex (const dgBigVector& point, const dgEdge* const face) const;
290
291 bool Sanity () const;
292 void AddVertex(const dgBigVector& vertex);
293 void AddAtribute (const dgVertexAtribute& attib);
294 void AddPoint(const dgFloat64* vertexList, dgInt32 material);
295
296 protected:
297 virtual void BeginFace();
298 virtual void EndFace ();
299
300 void Init ();
301 dgBigVector GetOrigin ()const;
302 dgInt32 CalculateMaxAttributes () const;
303 dgFloat64 QuantizeCordinade(dgFloat64 val) const;
304
305 void ClearAttributeArray ();
306 dgInt32 EnumerateAttributeArray (dgVertexAtribute* const attib);
307 void ApplyAttributeArray (dgVertexAtribute* const attib, dgInt32 maxCount);
308
309 void MergeFaces (const dgMeshEffect* const source);
310 // void ReverseMergeFaces (dgMeshEffect* const source);
311 dgVertexAtribute InterpolateEdge (dgEdge* const edge, dgFloat64 param) const;
312
313 bool PlaneClip (const dgMeshEffect& convexMesh, const dgEdge* const face);
314
315 dgMeshEffect* GetNextLayer (dgInt32 mark);
316 dgMeshEffect* CreateVoronoiConvex (const dgBigVector* const conevexPointCloud, dgInt32 count, dgInt32 materialId, const dgMatrix& textureProjectionMatrix, dgFloat32 normalAngleInRadians) const;
317
318
319 dgInt32 m_pointCount;
320 dgInt32 m_maxPointCount;
321
322 dgInt32 m_atribCount;
323 dgInt32 m_maxAtribCount;
324
325 dgBigVector* m_points;
326 dgVertexAtribute* m_attrib;
327
328 friend class dgConvexHull3d;
329 friend class dgConvexHull4d;
330 friend class dgBooleanMeshBVH;
331 friend class dgTriangleAnglesToUV;
332 friend class dgCollisionCompoundFractured;
333 };
334
335
336
337 DG_INLINE dgInt32 dgMeshEffect::GetVertexCount() const
338 {
339 return m_pointCount;
340 }
341
342 DG_INLINE dgInt32 dgMeshEffect::GetPropertiesCount() const
343 {
344 return m_atribCount;
345 }
346
347 DG_INLINE dgInt32 dgMeshEffect::GetMaterialID (dgIndexArray* const handle, dgInt32 materialHandle) const
348 {
349 return handle->m_materials[materialHandle];
350 }
351
352 DG_INLINE dgInt32 dgMeshEffect::GetMaterialIndexCount (dgIndexArray* const handle, dgInt32 materialHandle) const
353 {
354 return handle->m_materialsIndexCount[materialHandle];
355 }
356
357 DG_INLINE dgMeshEffect::dgVertexAtribute& dgMeshEffect::GetAttribute (dgInt32 index) const
358 {
359 return m_attrib[index];
360 }
361
362 DG_INLINE dgBigVector& dgMeshEffect::GetVertex (dgInt32 index) const
363 {
364 return m_points[index];
365 }
366
367 DG_INLINE dgInt32 dgMeshEffect::GetPropertiesStrideInByte() const
368 {
369 return sizeof (dgVertexAtribute);
370 }
371
372 DG_INLINE dgFloat64* dgMeshEffect::GetAttributePool() const
373 {
374 return &m_attrib->m_vertex.m_x;
375 }
376
377 DG_INLINE dgFloat64* dgMeshEffect::GetNormalPool() const
378 {
379 return &m_attrib->m_normal_x;
380 }
381
382 DG_INLINE dgFloat64* dgMeshEffect::GetUV0Pool() const
383 {
384 return &m_attrib->m_u0;
385 }
386
387 DG_INLINE dgFloat64* dgMeshEffect::GetUV1Pool() const
388 {
389 return &m_attrib->m_u1;
390 }
391
392 DG_INLINE dgInt32 dgMeshEffect::GetVertexStrideInByte() const
393 {
394 return sizeof (dgBigVector);
395 }
396
397 DG_INLINE dgFloat64* dgMeshEffect::GetVertexPool () const
398 {
399 return &m_points[0].m_x;
400 }
401
402
403 DG_INLINE dgMeshEffect* dgMeshEffect::GetFirstLayer ()
404 {
405 return GetNextLayer (IncLRU());
406 }
407
408 DG_INLINE dgMeshEffect* dgMeshEffect::GetNextLayer (dgMeshEffect* const layerSegment)
409 {
410 if (!layerSegment) {
411 return NULL;
412 }
413 return GetNextLayer (layerSegment->IncLRU() - 1);
414 }
415
416
417 DG_INLINE dgFloat64 dgMeshEffect::QuantizeCordinade(dgFloat64 x) const
418 {
419 dgInt32 exp;
420 dgFloat64 mantissa = frexp(x, &exp);
421 mantissa = DG_MESH_EFFECT_PRECISION_SCALE_INV * floor (mantissa * DG_MESH_EFFECT_PRECISION_SCALE);
422
423 dgFloat64 x1 = ldexp(mantissa, exp);
424 return x1;
425 }
426
427 #endif
dgMeshEffect::dgMeshBVH::m_rootNode
dgMeshBVHNode * m_rootNode
Definition: dgMeshEffect.h:129
dgMeshEffect::dgVertexAtribute::m_u1
dgFloat64 m_u1
Definition: dgMeshEffect.h:58
dgMeshEffect::GetPropertiesCount
dgInt32 GetPropertiesCount() const
Definition: dgMeshEffect.h:342
dgMeshEffect::dgBooleanMeshBVH
friend class dgBooleanMeshBVH
Definition: dgMeshEffect.h:330
dgMeshEffect::m_attrib
dgVertexAtribute * m_attrib
Definition: dgMeshEffect.h:326
dgMeshEffect::ApplyTransform
void ApplyTransform(const dgMatrix &matrix)
Definition: dgMeshEffect1.cpp:1556
dgMeshEffect::dgVertexAtribute::m_v1
dgFloat64 m_v1
Definition: dgMeshEffect.h:59
dgMeshEffect::MaterialGeomteryEnd
void MaterialGeomteryEnd(dgIndexArray *const handle)
Definition: dgMeshEffect1.cpp:2644
dgMeshEffect::GetVertexStreams
void GetVertexStreams(dgInt32 vetexStrideInByte, dgFloat32 *const vertex, dgInt32 normalStrideInByte, dgFloat32 *const normal, dgInt32 uvStrideInByte0, dgFloat32 *const uv0, dgInt32 uvStrideInByte1, dgFloat32 *const uv1)
Definition: dgMeshEffect1.cpp:2507
dgMeshEffect::RepairTJoints
void RepairTJoints()
Definition: dgMeshEffect1.cpp:3137
dgMeshEffect::dgVertexAtribute::m_u0
dgFloat64 m_u0
Definition: dgMeshEffect.h:56
dgMeshEffect::ConvertToPolygons
void ConvertToPolygons()
Definition: dgMeshEffect1.cpp:1392
dgMeshEffect::CalculateFaceNormal
dgBigVector CalculateFaceNormal(const void *const face) const
Definition: dgMeshEffect1.cpp:2437
dgInt16
short dgInt16
Definition: dgTypes.h:215
dgMeshEffect::SetFaceMaterial
void SetFaceMaterial(const void *const face, int materialID) const
Definition: dgMeshEffect1.cpp:2382
dgMeshEffect::AddAtribute
void AddAtribute(const dgVertexAtribute &attib)
Definition: dgMeshEffect1.cpp:1628
dgMeshEffect::GetNextMaterial
dgInt32 GetNextMaterial(dgIndexArray *const handle, dgInt32 materialHandle) const
Definition: dgMeshEffect1.cpp:2655
dgMeshEffect::dgIndexArray::m_materialsIndexCount
dgInt32 m_materialsIndexCount[256]
Definition: dgMeshEffect.h:69
dgMeshEffect::dgVertexAtribute::m_normal_y
dgFloat64 m_normal_y
Definition: dgMeshEffect.h:54
dgMeshEffect::InterpolateEdge
dgVertexAtribute InterpolateEdge(dgEdge *const edge, dgFloat64 param) const
Definition: dgMeshEffect1.cpp:2782
dgMeshEffect::BeginFace
virtual void BeginFace()
Definition: dgMeshEffect1.cpp:1163
dgMeshEffect::Intersection
dgMeshEffect * Intersection(const dgMatrix &matrix, const dgMeshEffect *const clipper) const
Definition: dgMeshEffect5.cpp:2931
dgMeshEffect::m_pointCount
dgInt32 m_pointCount
Definition: dgMeshEffect.h:319
dgMeshEffect::dgMeshBVH
Definition: dgMeshEffect.h:76
dgMeshEffect::dgMeshBVH::dgMeshBVHNode
Definition: dgMeshEffect.h:79
dgMeshEffect::dgVertexAtribute::m_material
dgFloat64 m_material
Definition: dgMeshEffect.h:60
userData
void *const userData
Definition: dgBroadPhase.h:35
dgMeshEffect::GetFaces
void GetFaces(dgInt32 *const faceCount, dgInt32 *const materials, void **const faceNodeList) const
Definition: dgMeshEffect1.cpp:2125
DG_INLINE
#define DG_INLINE
Definition: dgTypes.h:178
dgMeshEffect::BuildFromVertexListIndexList
void BuildFromVertexListIndexList(dgInt32 faceCount, const dgInt32 *const faceIndexCount, const dgInt32 *const faceMaterialIndex, const dgFloat32 *const vertex, dgInt32 vertexStrideInBytes, const dgInt32 *const vertexIndex, const dgFloat32 *const normal, dgInt32 normalStrideInBytes, const dgInt32 *const normalIndex, const dgFloat32 *const uv0, dgInt32 uv0StrideInBytes, const dgInt32 *const uv0Index, const dgFloat32 *const uv1, dgInt32 uv1StrideInBytes, const dgInt32 *const uv1Index)
Definition: dgMeshEffect1.cpp:1927
dgMeshEffect::m_points
dgBigVector * m_points
Definition: dgMeshEffect.h:325
dgMeshEffect::CalculateNormals
void CalculateNormals(dgFloat64 angleInRadians)
Definition: dgMeshEffect6.cpp:1523
dgMeshEffect::GetMaterialIndexCount
dgInt32 GetMaterialIndexCount(dgIndexArray *const handle, dgInt32 materialHandle) const
Definition: dgMeshEffect.h:352
dgMeshEffect::dgVertexAtribute::m_normal_x
dgFloat64 m_normal_x
Definition: dgMeshEffect.h:53
dgFloat32
float dgFloat32
Definition: dgTypes.h:233
dgInt32
int dgInt32
Definition: dgTypes.h:218
dgMeshEffect::EndPolygon
void EndPolygon(dgFloat64 tol, bool fixTjoint=true)
Definition: dgMeshEffect1.cpp:1839
dgMeshEffect::AddPolygon
void AddPolygon(dgInt32 count, const dgFloat32 *const vertexList, dgInt32 stride, dgInt32 material)
Definition: dgMeshEffect1.cpp:1798
dgMeshEffect::GetFaceIndexCount
int GetFaceIndexCount(const void *const face) const
Definition: dgMeshEffect1.cpp:2397
dgVector
Definition: dgVector.h:639
dgMeshEffect::IsFaceOpen
int IsFaceOpen(const void *const face) const
Definition: dgMeshEffect1.cpp:2368
dgCollisionCompoundFractured
Definition: dgCollisionCompoundFractured.h:32
dgConvexHull3d
Definition: dgConvexHull3d.h:60
dgTriangleAnglesToUV
Definition: dgMeshEffect6.cpp:54
dgMeshEffect::TransformMesh
void TransformMesh(const dgMatrix &matrix)
Definition: dgMeshEffect1.cpp:2771
dgMeshEffect::Triangulate
void Triangulate()
Definition: dgMeshEffect1.cpp:1319
dgRefCounter
Definition: dgRefCounter.h:25
DG_MESH_EFFECT_PRECISION_SCALE_INV
#define DG_MESH_EFFECT_PRECISION_SCALE_INV
Definition: dgMeshEffect.h:33
dgMeshEffect::GetFirstFace
void * GetFirstFace() const
Definition: dgMeshEffect1.cpp:2324
dgMeshEffect::CreateDelaunayTetrahedralization
static dgMeshEffect * CreateDelaunayTetrahedralization(dgMemoryAllocator *const allocator, dgInt32 pointCount, dgInt32 pointStrideInBytes, const dgFloat32 *const pointCloud, dgInt32 materialId, const dgMatrix &textureProjectionMatrix)
Definition: dgMeshEffect2.cpp:81
dgMeshEffect::GetTotalIndexCount
dgInt32 GetTotalIndexCount() const
Definition: dgMeshEffect1.cpp:2100
dgEdge
Definition: dgPolyhedra.h:45
dgMeshEffect::GetFaceIndex
void GetFaceIndex(const void *const face, dgInt32 *const indices) const
Definition: dgMeshEffect1.cpp:2410
dgMeshEffect::dgIndexArray::m_indexCount
dgInt32 m_indexCount
Definition: dgMeshEffect.h:67
DG_CLASS_ALLOCATOR
#define DG_CLASS_ALLOCATOR(allocator)
Definition: dgMemory.h:60
dgMeshEffect::Serialize
void Serialize(dgSerialize callback, void *const userData) const
Definition: dgMeshEffect1.cpp:141
dgRefCounter.h
dgMeshEffect::GetNextPoint
void * GetNextPoint(const void *const point) const
Definition: dgMeshEffect1.cpp:2222
dgMeshEffect::GetVertexCount
dgInt32 GetVertexCount() const
Definition: dgMeshEffect.h:337
dgMeshEffect::GetVertex
dgBigVector & GetVertex(dgInt32 index) const
Definition: dgMeshEffect.h:362
dgFloat64
double dgFloat64
Definition: dgTypes.h:224
dgMeshEffect::dgIndexArray::m_indexList
dgInt32 * m_indexList
Definition: dgMeshEffect.h:70
dgList
Definition: dgList.h:33
dgMeshEffect::GetVertexStrideInByte
dgInt32 GetVertexStrideInByte() const
Definition: dgMeshEffect.h:392
dgMeshEffect::EnumerateAttributeArray
dgInt32 EnumerateAttributeArray(dgVertexAtribute *const attib)
Definition: dgMeshEffect6.cpp:1454
dgMeshEffect
Definition: dgMeshEffect.h:45
dgMeshEffect::GetFirstMaterial
dgInt32 GetFirstMaterial(dgIndexArray *const handle) const
Definition: dgMeshEffect1.cpp:2650
dgMeshEffect::CreateConvexApproximation
dgMeshEffect * CreateConvexApproximation(dgFloat32 maxConcavity, dgFloat32 backFaceDistanceFactor, dgInt32 maxHullOuputCount, dgInt32 maxVertexPerHull, dgReportProgress reportProgressCallback, void *const userData) const
Definition: dgMeshEffect3.cpp:1346
dgMeshEffect::CreateCollisionTree
dgCollisionInstance * CreateCollisionTree(dgWorld *const world, dgInt32 shapeID) const
Definition: dgMeshEffect1.cpp:2694
dgMeshEffect::ClipMesh
void ClipMesh(const dgMatrix &matrix, const dgMeshEffect *const clipper, dgMeshEffect **const top, dgMeshEffect **const bottom) const
Definition: dgMeshEffect5.cpp:1817
dgMeshEffect::RemoveUnusedVertices
void RemoveUnusedVertices(dgInt32 *const vertexRemapTable)
Definition: dgMeshEffect1.cpp:1464
dgMeshEffect::m_atribCount
dgInt32 m_atribCount
Definition: dgMeshEffect.h:322
dgSerialize
void(dgApi * dgSerialize)(void *const userData, const void *const buffer, size_t size)
Definition: dgTypes.h:280
dgTree
Definition: dgTree.h:88
dgMeshEffect::GetMaterialGetIndexStream
void GetMaterialGetIndexStream(dgIndexArray *const handle, dgInt32 materialHandle, dgInt32 *const index) const
Definition: dgMeshEffect1.cpp:2664
dgMeshEffect::SphericalMapping
void SphericalMapping(dgInt32 material)
Definition: dgMeshEffect6.cpp:1610
dgMeshEffect::GetNextLayer
dgMeshEffect * GetNextLayer(dgMeshEffect *const layer)
Definition: dgMeshEffect.h:408
dgJointCallbackParam
Definition: dgConstraint.h:63
dgMeshEffect::GetNextEdge
void * GetNextEdge(const void *const edge) const
Definition: dgMeshEffect1.cpp:2291
dgMeshEffect::ConvexMeshIntersection
dgMeshEffect * ConvexMeshIntersection(const dgMeshEffect *const convexMesh) const
Definition: dgMeshEffect5.cpp:3266
dgMeshEffect::BeginPolygon
void BeginPolygon()
Definition: dgMeshEffect1.cpp:1619
dgPolyhedra
Definition: dgPolyhedra.h:62
dgMeshEffect::PlaneClip
bool PlaneClip(const dgMeshEffect &convexMesh, const dgEdge *const face)
Definition: dgMeshEffect5.cpp:2956
dgMeshEffect::GetOrigin
dgBigVector GetOrigin() const
Definition: dgMeshEffect6.cpp:1444
dgMeshEffect::QuantizeCordinade
dgFloat64 QuantizeCordinade(dgFloat64 val) const
Definition: dgMeshEffect.h:417
dgMeshEffect::CalculateAABB
void CalculateAABB(dgBigVector &min, dgBigVector &max) const
Definition: dgMeshEffect1.cpp:1594
dgMeshEffect::dgVertexAtribute::m_vertex
dgBigVector m_vertex
Definition: dgMeshEffect.h:52
dgDeserialize
void(dgApi * dgDeserialize)(void *const userData, void *buffer, size_t size)
Definition: dgTypes.h:279
dgMeshEffect::PackVertexArrays
void PackVertexArrays()
Definition: dgMeshEffect1.cpp:1697
dgMeshEffect::GetAttributePool
dgFloat64 * GetAttributePool() const
Definition: dgMeshEffect.h:372
dgMeshEffect::m_maxAtribCount
dgInt32 m_maxAtribCount
Definition: dgMeshEffect.h:323
dgMeshEffect::GetFaceAttributeIndex
void GetFaceAttributeIndex(const void *const face, dgInt32 *const indices) const
Definition: dgMeshEffect1.cpp:2423
dgMeshEffect::dgVertexAtribute
Definition: dgMeshEffect.h:49
dgMeshEffect::dgIndexArray::m_materials
dgInt32 m_materials[256]
Definition: dgMeshEffect.h:68
dgMeshEffect::GetNormalPool
dgFloat64 * GetNormalPool() const
Definition: dgMeshEffect.h:377
dgMeshEffect::GetVertexIndex
int GetVertexIndex(const void *const vertex) const
Definition: dgMeshEffect1.cpp:2201
dgMeshEffect::GetIndirectVertexStreams
void GetIndirectVertexStreams(dgInt32 vetexStrideInByte, dgFloat64 *const vertex, dgInt32 *const vertexIndices, dgInt32 *const vertexCount, dgInt32 normalStrideInByte, dgFloat64 *const normal, dgInt32 *const normalIndices, dgInt32 *const normalCount, dgInt32 uvStrideInByte0, dgFloat64 *const uv0, dgInt32 *const uvIndices0, dgInt32 *const uvCount0, dgInt32 uvStrideInByte1, dgFloat64 *const uv1, dgInt32 *const uvIndices1, dgInt32 *const uvCount1)
Definition: dgMeshEffect1.cpp:2538
dgMeshEffect::MaterialGeometryBegin
dgIndexArray * MaterialGeometryBegin()
Definition: dgMeshEffect1.cpp:2582
dgMeshEffect::dgIndexArray::m_materialCount
dgInt32 m_materialCount
Definition: dgMeshEffect.h:66
dgMeshEffect::Trace
void Trace() const
Definition: dgMeshEffect1.cpp:1241
dgMeshEffect::m_maxPointCount
dgInt32 m_maxPointCount
Definition: dgMeshEffect.h:320
dgMeshEffect::AngleBaseFlatteningMapping
void AngleBaseFlatteningMapping(dgInt32 cylinderMaterial, dgReportProgress progressReportCallback, void *const userData)
Definition: dgMeshEffect6.cpp:1932
dgCollisionInstance
Definition: dgCollisionInstance.h:30
dgMeshEffect::CalculateMaxAttributes
dgInt32 CalculateMaxAttributes() const
dgMeshEffect::CreateVoronoiConvexDecomposition
static dgMeshEffect * CreateVoronoiConvexDecomposition(dgMemoryAllocator *const allocator, dgInt32 pointCount, dgInt32 pointStrideInBytes, const dgFloat32 *const pointCloud, dgInt32 materialId, const dgMatrix &textureProjectionMatrix)
Definition: dgMeshEffect2.cpp:90
dgMeshEffect::GetTotalFaceCount
dgInt32 GetTotalFaceCount() const
Definition: dgMeshEffect1.cpp:2095
dgMeshEffect::GetFirstLayer
dgMeshEffect * GetFirstLayer()
Definition: dgMeshEffect.h:403
dgMeshEffect::InsertEdgeVertex
dgEdge * InsertEdgeVertex(dgEdge *const edge, dgFloat64 param)
Definition: dgMeshEffect1.cpp:2832
DG_MESH_EFFECT_PRECISION_SCALE
#define DG_MESH_EFFECT_PRECISION_SCALE
Definition: dgMeshEffect.h:32
dgMeshEffect::GetNextVertex
void * GetNextVertex(const void *const vertex) const
Definition: dgMeshEffect1.cpp:2179
dgMeshEffect::Sanity
bool Sanity() const
Definition: dgMeshEffect1.cpp:2808
dgMeshEffect::CreateConvexCollision
dgCollisionInstance * CreateConvexCollision(dgWorld *const world, dgFloat64 tolerance, dgInt32 shapeID, const dgMatrix &matrix=dgGetIdentityMatrix()) const
Definition: dgMeshEffect1.cpp:2725
dgMeshEffect::InterpolateVertex
dgVertexAtribute InterpolateVertex(const dgBigVector &point, const dgEdge *const face) const
Definition: dgMeshEffect1.cpp:2864
dgMeshEffect::ApplyAttributeArray
void ApplyAttributeArray(dgVertexAtribute *const attib, dgInt32 maxCount)
Definition: dgMeshEffect6.cpp:1497
dgMeshEffect::SeparateDuplicateLoops
bool SeparateDuplicateLoops(dgEdge *const face)
Definition: dgMeshEffect1.cpp:3108
dgMeshEffect::SpliteFace
dgEdge * SpliteFace(dgInt32 v0, dgInt32 v1)
Definition: dgMeshEffect1.cpp:2249
dgMeshEffect::Union
dgMeshEffect * Union(const dgMatrix &matrix, const dgMeshEffect *const clipper) const
Definition: dgMeshEffect5.cpp:1878
dgMeshEffect::GetUV1Pool
dgFloat64 * GetUV1Pool() const
Definition: dgMeshEffect.h:387
dgConvexHull4d
Definition: dgConvexHull4d.h:98
dgMeshEffect::dgMeshBVH::m_fitness
dgFitnessList m_fitness
Definition: dgMeshEffect.h:130
dgMeshEffect::GetFirstPoint
void * GetFirstPoint() const
Definition: dgMeshEffect1.cpp:2209
dgReportProgress
bool(dgApi * dgReportProgress)(dgFloat32 progressNormalzedPercent, void *const userData)
Definition: dgTypes.h:281
dgMeshEffect::GetPointIndex
int GetPointIndex(const void *const point) const
Definition: dgMeshEffect1.cpp:2236
dgMeshEffect::CreateVoronoiConvex
dgMeshEffect * CreateVoronoiConvex(const dgBigVector *const conevexPointCloud, dgInt32 count, dgInt32 materialId, const dgMatrix &textureProjectionMatrix, dgFloat32 normalAngleInRadians) const
dgMeshEffect::dgIndexArray
Definition: dgMeshEffect.h:63
dgMeshEffect::CreateFromSerialization
static dgMeshEffect * CreateFromSerialization(dgMemoryAllocator *const allocator, dgDeserialize deserialization, void *const userData)
Definition: dgMeshEffect1.cpp:136
dgPolyhedra::IncLRU
dgInt32 IncLRU() const
Definition: dgPolyhedra.h:246
dgMeshEffect::GetMaterialID
dgInt32 GetMaterialID(dgIndexArray *const handle, dgInt32 materialHandle) const
Definition: dgMeshEffect.h:347
dgMeshEffect::MergeFaces
void MergeFaces(const dgMeshEffect *const source)
Definition: dgMeshEffect1.cpp:3084
dgMeshEffect::CreateSimplification
dgMeshEffect * CreateSimplification(dgInt32 maxVertexCount, dgReportProgress reportProgressCallback, void *const userData) const
Definition: dgMeshEffect4.cpp:1527
dgMatrix
Definition: dgMatrix.h:40
dgMemoryAllocator
Definition: dgMemory.h:73
dgMeshEffect::CylindricalMapping
void CylindricalMapping(dgInt32 cylinderMaterial, dgInt32 capMaterial)
Definition: dgMeshEffect6.cpp:1688
dgMeshEffect::GetUV0Pool
dgFloat64 * GetUV0Pool() const
Definition: dgMeshEffect.h:382
dgMeshEffect::AddVertex
void AddVertex(const dgBigVector &vertex)
Definition: dgMeshEffect1.cpp:1657
dgMeshEffect::SaveOFF
void SaveOFF(const char *const fileName) const
Definition: dgMeshEffect1.cpp:1269
dgMeshEffect::GetFirstVertex
void * GetFirstVertex() const
Definition: dgMeshEffect1.cpp:2159
dgGetIdentityMatrix
const dgMatrix & dgGetIdentityMatrix()
Definition: dgMatrix.cpp:47
dgMeshEffect::GetVertexIndexFromPoint
int GetVertexIndexFromPoint(const void *const point) const
Definition: dgMeshEffect1.cpp:2243
dgMeshEffect::Difference
dgMeshEffect * Difference(const dgMatrix &matrix, const dgMeshEffect *const clipper) const
Definition: dgMeshEffect5.cpp:1902
dgMeshEffect::GetPropertiesStrideInByte
dgInt32 GetPropertiesStrideInByte() const
Definition: dgMeshEffect.h:367
dgMeshEffect::CalculateOOBB
dgMatrix CalculateOOBB(dgBigVector &size) const
Definition: dgMeshEffect1.cpp:1573
dgWorld
Definition: dgWorld.h:129
dgMeshEffect::GetVertexPool
dgFloat64 * GetVertexPool() const
Definition: dgMeshEffect.h:397
dgMeshEffect::Init
void Init()
Definition: dgMeshEffect1.cpp:1230
dgMeshEffect::dgMeshBVH::m_mesh
dgMeshEffect * m_mesh
Definition: dgMeshEffect.h:128
dgMeshEffect::dgVertexAtribute::m_v0
dgFloat64 m_v0
Definition: dgMeshEffect.h:57
dgMeshEffect::EndFace
virtual void EndFace()
Definition: dgMeshEffect1.cpp:1168
dgMeshEffect::HasOpenEdges
bool HasOpenEdges() const
Definition: dgMeshEffect1.cpp:2976
dgMeshEffect::dgMeshBVH::dgFitnessList
Definition: dgMeshEffect.h:99
dgMeshEffect::dgVertexAtribute::m_normal_z
dgFloat64 m_normal_z
Definition: dgMeshEffect.h:55
dgMeshEffect::GetEdgeIndex
void GetEdgeIndex(const void *const edge, dgInt32 &v0, dgInt32 &v1) const
Definition: dgMeshEffect1.cpp:2309
dgMeshEffect::CalculateVolume
dgFloat64 CalculateVolume() const
Definition: dgMeshEffect1.cpp:2988
dgMeshEffect::BoxMapping
void BoxMapping(dgInt32 front, dgInt32 side, dgInt32 top)
Definition: dgMeshEffect6.cpp:1813
dgMeshEffect::GetNextFace
void * GetNextFace(const void *const face) const
Definition: dgMeshEffect1.cpp:2345
dgMeshEffect::GetFirstEdge
void * GetFirstEdge() const
Definition: dgMeshEffect1.cpp:2273
dgTree< dgEdge, dgEdgeKey >::SanityCheck
bool SanityCheck() const
Definition: dgTree.h:764
dgMeshEffect::AddPoint
void AddPoint(const dgFloat64 *vertexList, dgInt32 material)
Definition: dgMeshEffect1.cpp:1675
dgBigVector
Definition: dgVector.h:207
dgMeshEffect::GetMaterialGetIndexStreamShort
void GetMaterialGetIndexStreamShort(dgIndexArray *const handle, dgInt32 materialHandle, dgInt16 *const index) const
Definition: dgMeshEffect1.cpp:2680
dgMeshEffect::GetFaceMaterial
int GetFaceMaterial(const void *const face) const
Definition: dgMeshEffect1.cpp:2375
dgMeshEffect::dgMeshEffect
dgMeshEffect(dgMemoryAllocator *const allocator)
Definition: dgMeshEffect1.cpp:801
dgMeshEffect::GetAttribute
dgVertexAtribute & GetAttribute(dgInt32 index) const
Definition: dgMeshEffect.h:357
dgTemplateVector::m_x
T m_x
Definition: dgVector.h:193
dgMeshEffect::ClearAttributeArray
void ClearAttributeArray()
Definition: dgMeshEffect6.cpp:1470
dgMeshEffect::UniformBoxMapping
void UniformBoxMapping(dgInt32 material, const dgMatrix &textruMatrix)
Definition: dgMeshEffect6.cpp:1885
dgMeshEffect::~dgMeshEffect
virtual ~dgMeshEffect(void)
Definition: dgMeshEffect1.cpp:1156