Newton Dynamics  4.00
dMeshEffect.h
1 /* Copyright (c) <2003-2019> <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 __D_MESH_EFFECT_H__
23 #define __D_MESH_EFFECT_H__
24 
25 #include "dCoreStdafx.h"
26 #include "dArray.h"
27 #include "dVector.h"
28 #include "dPolyhedra.h"
29 
30 
31 #define DG_MESH_EFFECT_PRECISION_BITS 48
32 #define DG_MESH_EFFECT_PRECISION_SCALE dFloat64(dInt64(1)<<DG_MESH_EFFECT_PRECISION_BITS)
33 #define DG_MESH_EFFECT_PRECISION_SCALE_INV (dFloat64 (1.0f) / DG_MESH_EFFECT_PRECISION_SCALE)
34 
35 #define DG_VERTEXLIST_INDEXLIST_TOL (dFloat64 (0.0f))
36 #define DG_MESH_EFFECT_POINT_SPLITED 512
37 #define DG_MESH_EFFECT_BVH_STACK_DEPTH 256
38 
40 {
41  public:
42  dInt32 m_materialCount;
43  dInt32 m_indexCount;
44  dInt32 m_materials[256];
45  dInt32 m_materialsIndexCount[256];
46  dInt32* m_indexList;
47 };
48 
49 class dMeshEffect: public dPolyhedra
50 {
51 #if 0
52  public:
53  class dMeshBVH
54  {
55  public:
56  class dgMeshBVHNode
57  {
58  public:
59  dgMeshBVHNode (const dMeshEffect* const mesh, dEdge* const face, void* const userData);
60  dgMeshBVHNode (dgMeshBVHNode* const left, dgMeshBVHNode* const right);
61  ~dgMeshBVHNode ();
62  void SetBox (const dVector& p0, const dVector& p1);
63 
64  DG_CLASS_ALLOCATOR(allocator)
65  dVector m_p0;
66  dVector m_p1;
67 
68  dFloat32 m_area;
69  dEdge* m_face;
70  void* m_userData;
71  dgMeshBVHNode* m_left;
72  dgMeshBVHNode* m_right;
73  dgMeshBVHNode* m_parent;
74  };
75 
76  class dgFitnessList: public dTree <dgMeshBVHNode*, dgMeshBVHNode*>
77  {
78  public:
79  dgFitnessList (dMemoryAllocator___* const allocator);
80  dFloat64 TotalCost () const;
81  };
82 
83 
84  dMeshBVH (const dMeshEffect* const mesh);
85  virtual ~dMeshBVH();
86 
87  virtual void Build ();
88  virtual void Cleanup ();
89 
90  void FaceRayCast (const dBigVector& l0, const dBigVector& l1, void* const userData) const;
91  void GetOverlapNodes (dList<dgMeshBVHNode*>& overlapNodes, const dBigVector& p0, const dBigVector& p1) const;
92 
93  protected:
94  virtual dgMeshBVHNode* CreateLeafNode (dEdge* const face, void* const userData) = 0;
95 
96  dgMeshBVHNode* AddFaceNode (dEdge* const face, void* const userData);
97  void RemoveNode (dgMeshBVHNode* const treeNode);
98  void ImproveNodeFitness ();
99  void ImproveNodeFitness (dgMeshBVHNode* const node);
100  dFloat32 CalculateSurfaceArea (dgMeshBVHNode* const node0, dgMeshBVHNode* const node1, dVector& minBox, dVector& maxBox) const;
101  virtual bool SanityCheck() const;
102 
103  virtual dFloat64 RayFaceIntersect (const dgMeshBVHNode* const face, const dBigVector& p0, const dBigVector& p1, void* const userData) const;
104 // virtual dFloat64 VertexRayCast (const dBigVector& l0, const dBigVector& l1) const;
105 // virtual bool RayRayIntersect (dEdge* const edge, const dMeshEffect* const otherMesh, dEdge* const otherEdge, dFloat64& param, dFloat64& otherParam) const;
106 
107  const dMeshEffect* m_mesh;
108  dgMeshBVHNode* m_rootNode;
109  dgFitnessList m_fitness;
110  friend class dMeshEffect;
111  };
112 
113 
114  dMeshEffect(dMemoryAllocator___* const allocator);
115  dMeshEffect(dgCollisionInstance* const collision);
116  dMeshEffect(const dMeshEffect& source);
117  dMeshEffect(dPolyhedra& mesh, const dMeshEffect& source);
118  dMeshEffect (dMemoryAllocator___* const allocator, dgDeserialize deserialization, void* const userData);
119 
120  // create from OFF or PLY file format
121  dMeshEffect(dMemoryAllocator___* const allocator, const char* const fileName);
122 
123  // Create a convex hull Mesh form point cloud
124  dMeshEffect (dMemoryAllocator___* const allocator, const dFloat64* const vertexCloud, dInt32 count, dInt32 strideInByte, dFloat64 distTol);
125 
126  // create a planar Mesh
127  dMeshEffect(dMemoryAllocator___* const allocator, const dMatrix& planeMatrix, dFloat32 witdth, dFloat32 breadth, dInt32 material, const dMatrix& textureMatrix0, const dMatrix& textureMatrix1);
128 
129  void Trace () const;
130 
131  void ApplyTransform (const dMatrix& matrix);
132  dMatrix CalculateOOBB (dBigVector& size) const;
133  void CalculateAABB (dBigVector& min, dBigVector& max) const;
134 
135  void FlipWinding();
136  void CylindricalMapping (dInt32 cylinderMaterial, dInt32 capMaterial, const dMatrix& uvAligment);
137  void AngleBaseFlatteningMapping (dInt32 cylinderMaterial, dgReportProgress progressReportCallback, void* const userData);
138 
139  dEdge* InsertEdgeVertex (dEdge* const edge, dFloat64 param);
140 
141  dMeshEffect* Union (const dMatrix& matrix, const dMeshEffect* const clipper) const;
142  dMeshEffect* Difference (const dMatrix& matrix, const dMeshEffect* const clipper) const;
143  dMeshEffect* Intersection (const dMatrix& matrix, const dMeshEffect* const clipper) const;
144  void ClipMesh (const dMatrix& matrix, const dMeshEffect* const clipper, dMeshEffect** const top, dMeshEffect** const bottom) const;
145 
146  //bool PlaneClip (const dBigPlane& plane);
147 
148  dMeshEffect* ConvexMeshIntersection (const dMeshEffect* const convexMesh) const;
149 
150  dMeshEffect* GetFirstLayer ();
151  dMeshEffect* GetNextLayer (dMeshEffect* const layer);
152 
153  void Triangulate ();
154  void ConvertToPolygons ();
155  void RemoveUnusedVertices(dInt32* const vertexRemapTable);
156 
157 
158  dInt32 GetVertexCount() const;
159  dInt32 GetVertexStrideInByte() const;
160  const dFloat64* GetVertexPool () const;
161 
162  dInt32 GetVertexBaseCount() const;
163  void SetVertexBaseCount(dInt32 count);
164 
165  dEdge* SpliteFace (dInt32 v0, dInt32 v1);
166 
167  dInt32 GetTotalFaceCount() const;
168  dInt32 GetTotalIndexCount() const;
169  void GetFaces (dInt32* const faceCount, dInt32* const materials, void** const faceNodeList) const;
170 
171  bool HasOpenEdges () const;
172 
173  dFloat64 CalculateVolume () const;
174 
175  void OptimizePoints();
176  void OptimizeAttibutes();
177  const dInt32* GetIndexToVertexMap() const;
178 
179  bool HasLayersChannel() const;
180  bool HasNormalChannel() const;
181  bool HasBinormalChannel() const;
182  bool HasUV0Channel() const;
183  bool HasUV1Channel() const;
184  bool HasVertexColorChannel() const;
185 
186  dgCollisionInstance* CreateCollisionTree(dgWorld* const world, dInt32 shapeID) const;
187  dgCollisionInstance* CreateConvexCollision(dgWorld* const world, dFloat64 tolerance, dInt32 shapeID, const dMatrix& matrix = dGetIdentityMatrix()) const;
188 
189  dMeshEffect* CreateSimplification (dInt32 maxVertexCount, dgReportProgress reportProgressCallback, void* const userData) const;
190  dMeshEffect* CreateConvexApproximation (dFloat32 maxConcavity, dFloat32 backFaceDistanceFactor, dInt32 maxHullOuputCount, dInt32 maxVertexPerHull, dgReportProgress reportProgressCallback, void* const userData) const;
191 
192  dMeshEffect* CreateTetrahedraIsoSurface() const;
193  void CreateTetrahedraLinearBlendSkinWeightsChannel (const dMeshEffect* const tetrahedraMesh);
194 
195  static dMeshEffect* CreateVoronoiConvexDecomposition (dMemoryAllocator___* const allocator, dInt32 pointCount, dInt32 pointStrideInBytes, const dFloat32* const pointCloud, dInt32 materialId, const dMatrix& textureProjectionMatrix);
196  static dMeshEffect* CreateFromSerialization (dMemoryAllocator___* const allocator, dgDeserialize deserialization, void* const userData);
197 
198  void LoadOffMesh (const char* const filename);
199  void LoadTetraMesh (const char* const filename);
200  void Serialize (dgSerialize callback, void* const userData) const;
201 
202  dBigVector GetVertex (dInt32 index) const;
203  dInt32 GetVertexLayer (dInt32 index) const;
204 
205  void TransformMesh (const dMatrix& matrix);
206 
207  void* GetFirstVertex () const;
208  void* GetNextVertex (const void* const vertex) const;
209  int GetVertexIndex (const void* const vertex) const;
210 
211  void* GetFirstPoint () const;
212  void* GetNextPoint (const void* const point) const;
213  dInt32 GetPointIndex (const void* const point) const;
214  dInt32 GetVertexIndexFromPoint (const void* const point) const;
215 
216  void* GetFirstEdge () const;
217  void* GetNextEdge (const void* const edge) const;
218 // void* FindEdge (dInt32 v0, dInt32 v1) const;
219  void GetEdgeIndex (const void* const edge, dInt32& v0, dInt32& v1) const;
220 // void GetEdgeAttributeIndex (const void* edge, dInt32& v0, dInt32& v1) const;
221 
222  const dEdge* GetPolyhedraEdgeFromNode(const void* const edge) const;
223 
224  void* GetFirstFace () const;
225  void* GetNextFace (const void* const face) const;
226  dInt32 IsFaceOpen (const void* const face) const;
227  dInt32 GetFaceMaterial (const void* const face) const;
228  dInt32 GetFaceIndexCount (const void* const face) const;
229  void GetFaceIndex (const void* const face, dInt32* const indices) const;
230  void GetFaceAttributeIndex (const void* const face, dInt32* const indices) const;
231  dBigVector CalculateFaceNormal (const void* const face) const;
232 
233  void SetFaceMaterial (const void* const face, int materialID);
234  void AddInterpolatedEdgeAttribute (dEdge* const edge, dFloat64 param);
235  dInt32 InterpolateVertex (const dBigVector& point, const dEdge* const face) const;
236 
237  protected:
238 
239  dBigVector GetOrigin ()const;
240  dInt32 CalculateMaxAttributes () const;
241  dFloat64 QuantizeCordinade(dFloat64 val) const;
242 
243  void MergeFaces (const dMeshEffect* const source);
244 // void ReverseMergeFaces (dMeshEffect* const source);
245 
246  bool PlaneClip (const dMeshEffect& convexMesh, const dEdge* const face);
247 
248  dMeshEffect* GetNextLayer (dInt32 mark);
249  dMeshEffect* CreateVoronoiConvex (const dBigVector* const conevexPointCloud, dInt32 count, dInt32 materialId, const dMatrix& textureProjectionMatrix, dFloat32 normalAngleInRadians) const;
250 
251  void PackPoints (dFloat64 tol);
252  void UnpackPoints();
253 
254  friend class dConvexHull3d;
255  friend class dgConvexHull4d;
256  friend class dgBooleanMeshBVH;
257  friend class dgHACDClusterGraph;
258  friend class dgTriangleAnglesToUV;
259  friend class dgTetraIsoSufaceStuffing;
260  friend class dgCollisionCompoundFractured;
261 #endif
262 
263  enum dChannelType
264  {
265  m_vertex,
266  m_normal,
267  m_binormal,
268  m_uv0,
269  m_uv1,
270  m_color,
271  m_material,
272  m_layer,
273  m_point,
274  };
275 
276  template<class T, dChannelType type>
277  class dChannel: public dArray<T>
278  {
279  public:
280  dChannel();
281  dChannel(const dChannel& source);
282  ~dChannel();
283 
284  void Clear();
285  void PushBack(const T& element);
286 
287  //void CopyFrom(const dChannel<T, type>& source)
288  //{
289  // dArray<T>& me = *this;
290  // dChannel& src = *((dChannel*)&source);
291  //
292  // Clear();
293  // m_count = src.m_count;
294  // dAssert(m_type == src.m_type);
295  // for (dInt32 i = 0; i < m_count; i++)
296  // {
297  // me[i] = src[i];
298  // }
299  //}
300  //void Reserve(dInt32 size)
301  //{
302  // dArray<T>::Resize(size);
303  // m_count = size;
304  //}
305  //void SetCount(dInt32 count)
306  //{
307  // if (m_count)
308  // {
309  // dAssert(count >= 0);
310  // dAssert(m_count >= count);
311  // m_count = count;
312  // }
313  //}
314 
315 
316  dChannelType m_type;
317  bool m_isValid;
318  };
319 
320  class dFormat
321  {
322  public:
323  class dSortKey
324  {
325  public:
326  dInt32 m_mask;
327  dInt32 m_ordinal;
328  dInt32 m_vertexIndex;
329  dInt32 m_attibuteIndex;
330  };
332  {
333  public:
334  const dChannel<dBigVector, m_point>* m_points;
335  dInt32 m_vertexSortIndex;
336  };
337 
338  dInt32 GetSortIndex(const dChannel<dBigVector, m_point>& points, dFloat64& dist) const;
339  static dInt32 CompareVertex(const dSortKey* const ptr0, const dSortKey* const ptr1, void* const context);
340  };
341 
342  class dPointFormat: public dFormat
343  {
344  public:
345  dPointFormat();
346  dPointFormat(const dPointFormat& source);
347  ~dPointFormat();
348 
349  void Clear();
350  void SetCount(dInt32 count);
351  void CompressData(dInt32* const indexList);
352 
353  dChannel<dInt32, m_layer> m_layers;
354  dChannel<dBigVector, m_point> m_vertex;
355  };
356 
357  class dAttibutFormat: public dFormat
358  {
359  public:
360  class dgUV
361  {
362  public:
363  dFloat32 m_u;
364  dFloat32 m_v;
365  };
366 
367  dAttibutFormat();
368  dAttibutFormat(const dAttibutFormat& source);
369  ~dAttibutFormat();
370 
371  void Clear();
372  void SetCount(dInt32 count);
373  void CopyFrom(const dAttibutFormat& source);
374  void CopyEntryFrom(dInt32 index, const dAttibutFormat& source, dInt32 sourceIndex);
375  void CompressData(const dPointFormat& points, dInt32* const indexList);
376 
377  dChannel<dInt32, m_vertex> m_pointChannel;
378  dChannel<dInt32, m_material> m_materialChannel;
379  dChannel<dTriplex, m_normal> m_normalChannel;
380  dChannel<dTriplex, m_binormal> m_binormalChannel;
381  dChannel<dVector, m_color> m_colorChannel;
382  dChannel<dgUV, m_uv0> m_uv0Channel;
383  dChannel<dgUV, m_uv1> m_uv1Channel;
384  };
385 
386  protected:
388  {
389  public:
391  {
392  public:
393  const dFloat64* m_data;
394  const dInt32* m_indexList;
395  dInt32 m_strideInBytes;
396  };
397 
399  {
400  public:
401  const dFloat32* m_data;
402  const dInt32* m_indexList;
403  dInt32 m_strideInBytes;
404  };
405 
407  {
408  Clear();
409  }
410 
411  void Clear()
412  {
413  memset(this, 0, sizeof(dMeshVertexFormat));
414  }
415 
416  dInt32 m_faceCount;
417  const dInt32* m_faceIndexCount;
418  const dInt32* m_faceMaterial;
419  dDoubleData m_vertex;
420  dFloatData m_normal;
421  dFloatData m_binormal;
422  dFloatData m_uv0;
423  dFloatData m_uv1;
424  dFloatData m_vertexColor;
425  };
426 
427  public:
428  D_CORE_API dMeshEffect();
429  D_CORE_API virtual ~dMeshEffect();
430 
431  D_CORE_API void CalculateNormals(dFloat64 angleInRadians);
432  D_CORE_API void BuildFromIndexList(const dMeshVertexFormat* const format);
433 
434  dInt32 GetPropertiesCount() const;
435  D_CORE_API void GetVertexChannel64(dInt32 strideInByte, dFloat64* const bufferOut) const;
436  D_CORE_API void GetVertexChannel(dInt32 strideInByte, dFloat32* const bufferOut) const;
437  D_CORE_API void GetNormalChannel(dInt32 strideInByte, dFloat32* const bufferOut) const;
438  D_CORE_API void GetBinormalChannel(dInt32 strideInByte, dFloat32* const bufferOut) const;
439  D_CORE_API void GetUV0Channel(dInt32 strideInByte, dFloat32* const bufferOut) const;
440  D_CORE_API void GetUV1Channel(dInt32 strideInByte, dFloat32* const bufferOut) const;
441  D_CORE_API void GetVertexColorChannel(dInt32 strideInByte, dFloat32* const bufferOut) const;
442  // void GetWeightBlendChannel(dInt32 strideInByte, dFloat32* const bufferOut) const;
443  // void GetWeightIndexChannel(dInt32 strideInByte, dInt32* const bufferOut) const;
444 
445  D_CORE_API ndIndexArray* MaterialGeometryBegin();
446  D_CORE_API dInt32 GetFirstMaterial(ndIndexArray* const handle) const;
447  D_CORE_API dInt32 GetNextMaterial(ndIndexArray* const handle, dInt32 materialHandle) const;
448  D_CORE_API dInt32 GetMaterialID(ndIndexArray* const handle, dInt32 materialHandle) const;
449  D_CORE_API dInt32 GetMaterialIndexCount(ndIndexArray* const handle, dInt32 materialHandle) const;
450  D_CORE_API void GetMaterialGetIndexStream(ndIndexArray* const handle, dInt32 materialHandle, dInt32* const index) const;
451  D_CORE_API void GetMaterialGetIndexStreamShort(ndIndexArray* const handle, dInt32 materialHandle, dInt16* const index) const;
452  D_CORE_API void MaterialGeomteryEnd(ndIndexArray* const handle);
453 
454  D_CORE_API void BeginBuild();
455  // D_CORE_API void BeginBuildFace();
456  // D_CORE_API void AddPoint(dFloat64 x, dFloat64 y, dFloat64 z);
457  // D_CORE_API void AddLayer(dInt32 layer);
458  // D_CORE_API void AddMaterial(dInt32 materialIndex);
459  // D_CORE_API void AddNormal(dFloat32 x, dFloat32 y, dFloat32 z);
460  // D_CORE_API void AddBinormal(dFloat32 x, dFloat32 y, dFloat32 z);
461  // D_CORE_API void AddVertexColor(dFloat32 x, dFloat32 y, dFloat32 z, dFloat32 w);
462  // D_CORE_API void AddUV0(dFloat32 u, dFloat32 v);
463  // D_CORE_API void AddUV1(dFloat32 u, dFloat32 v);
464  // D_CORE_API void EndBuildFace();
465  D_CORE_API void EndBuild(dFloat64 tol, bool fixTjoint = true);
466 
467  D_CORE_API dBigVector GetOrigin()const;
468  D_CORE_API void SphericalMapping(dInt32 material, const dMatrix& uvAligment);
469  D_CORE_API void UniformBoxMapping(dInt32 material, const dMatrix& textureMatrix);
470  D_CORE_API void BoxMapping(dInt32 front, dInt32 side, dInt32 top, const dMatrix& uvAligment);
471 
472  protected:
473  D_CORE_API void Init();
474  D_CORE_API void RepairTJoints();
475  D_CORE_API virtual void BeginFace();
476  D_CORE_API virtual bool EndFace();
477 
478  bool Sanity() const;
479  void PackAttibuteData();
480  void UnpackAttibuteData();
481  bool SeparateDuplicateLoops(dEdge* const face);
482  dInt32 AddInterpolatedHalfAttribute(dEdge* const edge, dInt32 midPoint);
483 
484  dPointFormat m_points;
485  dAttibutFormat m_attrib;
486  dInt32 m_vertexBaseCount;
487  dInt32 m_constructionIndex;
488 };
489 
490 #if 0
491 inline dInt32 dMeshEffect::GetVertexCount() const
492 {
493  return m_points.m_vertex.m_count;
494 }
495 
496 inline dInt32 dMeshEffect::GetVertexBaseCount() const
497 {
498  return m_vertexBaseCount;
499 }
500 
501 inline void dMeshEffect::SetVertexBaseCount(dInt32 count)
502 {
503  m_vertexBaseCount = count;
504 }
505 
506 
507 inline const dInt32* dMeshEffect::GetIndexToVertexMap() const
508 {
509  return &m_attrib.m_pointChannel[0];
510 }
511 
512 inline dBigVector dMeshEffect::GetVertex (dInt32 index) const
513 {
514  dAssert(index >= 0);
515  dAssert(index < m_points.m_vertex.m_count);
516  return m_points.m_vertex[index];
517 }
518 
519 inline bool dMeshEffect::HasLayersChannel() const
520 {
521  return m_points.m_layers.m_count != 0;
522 }
523 
524 inline dInt32 dMeshEffect::GetVertexLayer(dInt32 index) const
525 {
526  dAssert(index >= 0);
527  dAssert(index < m_points.m_vertex.m_count);
528  return (m_points.m_layers.m_count) ? m_points.m_layers[index] : 0;
529 }
530 
531 
532 inline dInt32 dMeshEffect::GetVertexStrideInByte() const
533 {
534  return sizeof (dBigVector);
535 }
536 
537 inline const dFloat64* dMeshEffect::GetVertexPool () const
538 {
539  return &m_points.m_vertex[0].m_x;
540 }
541 
542 inline dMeshEffect* dMeshEffect::GetFirstLayer ()
543 {
544  return GetNextLayer (IncLRU());
545 }
546 
547 inline dMeshEffect* dMeshEffect::GetNextLayer (dMeshEffect* const layerSegment)
548 {
549  if (!layerSegment) {
550  return nullptr;
551  }
552  return GetNextLayer (layerSegment->IncLRU() - 1);
553 }
554 
555 
556 inline dFloat64 dMeshEffect::QuantizeCordinade(dFloat64 x) const
557 {
558  dInt32 exp;
559  dFloat64 mantissa = frexp(x, &exp);
560  mantissa = DG_MESH_EFFECT_PRECISION_SCALE_INV * floor (mantissa * DG_MESH_EFFECT_PRECISION_SCALE);
561 
562  dFloat64 x1 = ldexp(mantissa, exp);
563  return x1;
564 }
565 #endif
566 
567 template<class T, dMeshEffect::dChannelType type>
568 dMeshEffect::dChannel<T, type>::dChannel()
569  :dArray<T>()
570  ,m_type(type)
571  ,m_isValid(false)
572 {
573 }
574 
575 template<class T, dMeshEffect::dChannelType type>
576 dMeshEffect::dChannel<T, type>::dChannel(const dChannel& source)
577  :dArray<T>(source)
578  ,m_type(source.m_type)
579  ,m_isValid(source.m_isValid)
580 {
581 }
582 
583 template<class T, dMeshEffect::dChannelType type>
584 dMeshEffect::dChannel<T, type>::~dChannel()
585 {
586 }
587 
588 template<class T, dMeshEffect::dChannelType type>
589 void dMeshEffect::dChannel<T, type>::Clear()
590 {
591  m_isValid = false;
593 }
594 
595 template<class T, dMeshEffect::dChannelType type>
596 void dMeshEffect::dChannel<T, type>::PushBack(const T& element)
597 {
598  T tmp(element);
599  m_isValid = true;
600  dArray<T>::PushBack(tmp);
601 }
602 
603 inline dMeshEffect::dPointFormat::dPointFormat()
604  :m_layers()
605  ,m_vertex()
606 {
607 }
608 
609 inline dMeshEffect::dPointFormat::dPointFormat(const dPointFormat& source)
610  :m_layers(source.m_layers)
611  , m_vertex(source.m_vertex)
612 {
613 }
614 
615 inline dMeshEffect::dPointFormat::~dPointFormat()
616 {
617 }
618 
619 inline void dMeshEffect::dPointFormat::Clear()
620 {
621  m_layers.Clear();
622  m_vertex.Clear();
623 }
624 
625 inline void dMeshEffect::dPointFormat::SetCount(dInt32 count)
626 {
627  m_layers.SetCount(count);
628  m_vertex.SetCount(count);
629 }
630 
631 inline dMeshEffect::dAttibutFormat::dAttibutFormat()
632  :m_pointChannel()
633  ,m_materialChannel()
634  ,m_normalChannel()
635  ,m_binormalChannel()
636  ,m_colorChannel()
637  ,m_uv0Channel()
638  ,m_uv1Channel()
639 {
640 }
641 
642 inline dMeshEffect::dAttibutFormat::dAttibutFormat(const dAttibutFormat& source)
643  :m_pointChannel(source.m_pointChannel)
644  ,m_materialChannel(source.m_materialChannel)
645  ,m_normalChannel(source.m_normalChannel)
646  ,m_binormalChannel(source.m_binormalChannel)
647  ,m_colorChannel(source.m_colorChannel)
648  ,m_uv0Channel(source.m_uv0Channel)
649  ,m_uv1Channel(source.m_uv1Channel)
650 {
651 }
652 
653 inline dMeshEffect::dAttibutFormat::~dAttibutFormat()
654 {
655 }
656 
657 inline void dMeshEffect::dAttibutFormat::Clear()
658 {
659  m_pointChannel.Clear();
660  m_materialChannel.Clear();
661  m_normalChannel.Clear();
662  m_binormalChannel.Clear();
663  m_colorChannel.Clear();
664  m_uv0Channel.Clear();
665  m_uv1Channel.Clear();
666 }
667 
668 inline void dMeshEffect::dAttibutFormat::SetCount(dInt32 count)
669 {
670  m_pointChannel.SetCount(count);
671  m_materialChannel.SetCount(count);
672  m_normalChannel.SetCount(count);
673  m_binormalChannel.SetCount(count);
674  m_colorChannel.SetCount(count);
675  m_uv0Channel.SetCount(count);
676  m_uv1Channel.SetCount(count);
677 }
678 
679 inline dInt32 dMeshEffect::GetPropertiesCount() const
680 {
681  return m_attrib.m_pointChannel.GetCount();
682 }
683 
684 
685 #endif
ndIndexArray
Definition: dMeshEffect.h:40
dTree
Definition: dTree.h:84
dMeshEffect::dMeshVertexFormat::dDoubleData
Definition: dMeshEffect.h:391
dMeshEffect::dAttibutFormat::dgUV
Definition: dMeshEffect.h:361
dEdge
Definition: dPolyhedra.h:45
dMeshEffect::dFormat::dSortKey
Definition: dMeshEffect.h:324
dArray
Definition: dArray.h:36
dBigVector
Definition: dVectorArmNeon.h:1521
dMeshEffect::dMeshVertexFormat
Definition: dMeshEffect.h:388
dVector
Definition: dVectorArmNeon.h:1104
dList
Definition: dList.h:32
dMatrix
Definition: dMatrix.h:39
dMeshEffect::dMeshVertexFormat::dFloatData
Definition: dMeshEffect.h:399
dPolyhedra
Definition: dPolyhedra.h:61
dConvexHull3d
Definition: dConvexHull3d.h:61
dMeshEffect
Definition: dMeshEffect.h:50
dMeshEffect::dFormat::dVertexSortData
Definition: dMeshEffect.h:332