Newton Dynamics  4.00
ndPolygonMeshDesc.h
1 /* Copyright (c) <2003-2022> <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 __ND_POLOGON_MESH_DESC_H__
23 #define __ND_POLOGON_MESH_DESC_H__
24 
25 #include "ndCollisionStdafx.h"
26 #include "ndShape.h"
27 
28 class ndBodyKinematic;
29 class ndShapeInstance;
30 class ndContactSolver;
31 class ndShapeStaticMesh;
32 
33 D_MSV_NEWTON_ALIGN_32
35 {
36  public:
38  {
39  public:
41  {
42  m_hitDistance.Resize(256);
43  m_faceIndexCount.Resize(256);
44  m_faceIndexStart.Resize(256);
45  m_faceVertexIndex.Resize(256);
46  }
47 
48  void Reset()
49  {
50  m_hitDistance.SetCount(0);
51  m_faceIndexCount.SetCount(0);
52  m_faceIndexStart.SetCount(0);
53  m_faceVertexIndex.SetCount(0);
54  }
55 
56  ndArray<ndFloat32> m_hitDistance;
57  ndArray<ndInt32> m_faceIndexCount;
58  ndArray<ndInt32> m_faceIndexStart;
59  ndArray<ndInt32> m_faceVertexIndex;
60  };
61 
63  {
64  public:
66  {
67  m_vertex.Resize(256);
68  m_faceMaterial.Resize(256);
69  m_indexListList.Resize(256);
70  }
71 
72  void Reset()
73  {
74  m_vertex.SetCount(0);
75  m_faceMaterial.SetCount(0);
76  m_indexListList.SetCount(0);
77  }
78 
79  ndArray<ndVector> m_vertex;
80  ndArray<ndInt32> m_faceMaterial;
81  ndArray<ndInt32> m_indexListList;
82  };
83 
84  // colliding box in polygonSoup local space
85  D_COLLISION_API ndPolygonMeshDesc();
86  D_COLLISION_API ndPolygonMeshDesc(ndContactSolver& proxy, bool ccdMode);
87 
88  D_COLLISION_API void SortFaceArray();
89  D_COLLISION_API ndFloat32 GetSeparetionDistance() const;
90  D_COLLISION_API ndInt32 GetFaceIndexCount(ndInt32 indexCount) const;
91  D_COLLISION_API void SetDistanceTravel(const ndVector& distanceInGlobalSpace);
92  D_COLLISION_API ndInt32 GetFaceId(const ndInt32* const faceIndexArray, ndInt32 indexCount) const;
93  D_COLLISION_API ndInt32 GetNormalIndex(const ndInt32* const faceIndexArray, ndInt32 indexCount) const;
94  D_COLLISION_API ndFloat32 GetFaceSize(const ndInt32* const faceIndexArray, ndInt32 indexCount) const;
95  D_COLLISION_API const ndInt32* GetAdjacentFaceEdgeNormalArray(const ndInt32* const faceIndexArray, ndInt32 indexCount) const;
96 
97  ndVector m_boxDistanceTravelInMeshSpace;
98  ndInt32 m_vertexStrideInBytes;
99  ndFloat32 m_skinMargin;
100  ndShapeInstance* m_convexInstance;
101  ndShapeInstance* m_polySoupInstance;
102  ndFloat32* m_vertex;
103 
104  // private data;
105  ndStaticMeshFaceQuery* m_staticMeshQuery;
106  ndProceduralStaticMeshFaceQuery* m_proceduralStaticMeshFaceQuery;
107  ndFloat32 m_maxT;
108  ndInt32 m_threadId;
109  bool m_doContinueCollisionTest;
110 } D_GCC_NEWTON_ALIGN_32;
111 
112 #endif
113 
114 
115 
ndPolygonMeshDesc
Definition: ndPolygonMeshDesc.h:35
ndArray< ndFloat32 >
ndShapeStaticMesh
Definition: ndShapeStaticMesh.h:32
ndContactSolver
Definition: ndContactSolver.h:60
ndPolygonMeshDesc::ndStaticMeshFaceQuery
Definition: ndPolygonMeshDesc.h:38
ndBodyKinematic
Definition: ndBodyKinematic.h:40
ndPolygonMeshDesc::ndProceduralStaticMeshFaceQuery
Definition: ndPolygonMeshDesc.h:63
ndFastAabb
Definition: ndFastAabb.h:32
ndArray::Resize
void Resize(ndInt32 count)
Set a new size.
Definition: ndArray.h:224
ndShapeInstance
Definition: ndShapeInstance.h:62
ndArray::SetCount
void SetCount(ndInt32 count)
Set a new size.
Definition: ndArray.h:188
ndVector
Definition: ndVectorArmNeon.h:41