22 #ifndef AFX_DGCOLLISION_H__57E159CE_6B6F_42DE_891C_1F6C38EB9D29__INCLUDED_ 23 #define AFX_DGCOLLISION_H__57E159CE_6B6F_42DE_891C_1F6C38EB9D29__INCLUDED_ 26 #include "hpl1/engine/libraries/newton/core/dg.h" 32 class dgPolygonSoupDesc;
35 class dgPolygonSoupRayHitDesc;
37 #define DG_MAX_COLLISION_PADDING dgFloat32(1.0f / 8.0f) 40 typedef dgInt32(*dgCollisionCompoundBreakableCallback)(
dgMeshEffect *
const solid,
void *userData,
dgMatrix &planeMatrixOut);
47 #define SERIALIZE_END 0x646e6520 48 #define PREFILTER_RAYCAST(filter, body, collision, userData) (filter && !filter(body, collision, userData)) 57 m_convexHullCollision,
58 m_convexCollisionModifier,
59 m_chamferCylinderCollision,
60 m_boundingBoxHierachy,
69 m_convexConvexIntance,
110 dgInt32 m_vertexCount;
111 dgInt32 m_strideInBytes;
121 dgInt32 m_chidrenCount;
126 dgInt32 m_vertexCount;
127 dgInt32 m_indexCount;
133 dgInt32 m_gridsDiagonals;
134 dgFloat32 m_horizonalScale;
135 dgFloat32 m_verticalScale;
136 dgUnsigned16 *m_elevation;
141 dgInt32 m_childrenProxyCount;
145 dgInt32 m_collisionType;
147 dgInt32 m_userDadaID;
161 dgFloat32 m_paramArray[32];
166 typedef void(dgApi *OnDebugCollisionMeshCallback)(
void *userData,
int vertexCount,
const dgFloat32 *FaceArray,
int faceId);
171 for (
unsigned i = 0; i <
sizeof(m_planes) /
sizeof(m_planes[0]); i++)
172 m_planes[i] =
dgPlane(0.0, 0.0, 0.0, 0.0);
177 DG_MSC_VECTOR_ALIGMENT
181 dgCollisionNull_RTTI = 1 << 0,
182 dgCollisionBox_RTTI = 1 << 1,
183 dgCollisionCone_RTTI = 1 << 2,
184 dgCollisionSphere_RTTI = 1 << 3,
185 dgCollisionEllipse_RTTI = 1 << 4,
186 dgCollisionCapsule_RTTI = 1 << 5,
187 dgCollisionCylinder_RTTI = 1 << 6,
188 dgCollisionConvexHull_RTTI = 1 << 7,
189 dgCollisionChamferCylinder_RTTI = 1 << 8,
190 dgCollisionConvexModifier_RTTI = 1 << 9,
191 dgCollisionConvexPolygon_RTTI = 1 << 10,
192 dgConvexCollision_RTTI = 1 << 11,
193 dgCollisionCompound_RTTI = 1 << 12,
195 dgCollisionBVH_RTTI = 1 << 13,
196 dgCollisionMesh_RTTI = 1 << 14,
197 dgCollisionUserMesh_RTTI = 1 << 15,
198 dgCollisionHeightField_RTTI = 1 << 16,
199 dgCollisionScene_RTTI = 1 << 17,
200 dgCollisionCompoundBreakable_RTTI = 1 << 18,
203 DG_CLASS_ALLOCATOR(allocator)
205 const dgMatrix &GetOffsetMatrix()
const;
206 void SetOffsetMatrix(
const dgMatrix &matrix);
208 dgCollisionID GetCollisionPrimityType()
const;
209 static dgUnsigned32 Quantize(dgFloat32 value);
210 static dgUnsigned32 MakeCRC(
void *buffer,
int size);
212 dgUnsigned32 SetUserDataID()
const;
213 void SetUserDataID(dgUnsigned32 userData);
215 dgInt32 IsType(RTTI type)
const {
216 return type & m_rtti;
219 virtual void *GetUserData()
const;
220 virtual void SetUserData(
void *
const userData);
227 virtual bool IsEdgeIntersection()
const;
229 virtual void DebugCollision(
const dgMatrix &matrix, OnDebugCollisionMeshCallback callback,
void *
const userData)
const = 0;
230 virtual dgFloat32 RayCast(
const dgVector &localP0,
const dgVector &localP1,
dgContactPoint &contactOut, OnRayPrecastAction preFilter,
const dgBody *
const body,
void *
const userData)
const = 0;
231 virtual dgFloat32 RayCastSimd(
const dgVector &localP0,
const dgVector &localP1,
dgContactPoint &contactOut, OnRayPrecastAction preFilter,
const dgBody *
const body,
void *
const userData)
const {
235 virtual dgFloat32 GetVolume()
const = 0;
237 virtual dgFloat32 GetBoxMinRadius()
const = 0;
238 virtual dgFloat32 GetBoxMaxRadius()
const = 0;
239 virtual void CalculateInertia(
dgVector &inertia,
dgVector &origin)
const = 0;
240 virtual dgVector CalculateVolumeIntegral(
const dgMatrix &globalMatrix, GetBuoyancyPlane bouyancyPlane,
void *
const context)
const = 0;
241 virtual void Serialize(dgSerialize callback,
void *
const userData)
const = 0;
244 virtual void SerializeLow(dgSerialize callback,
void *
const userData)
const;
246 dgUnsigned32 GetSignature()
const;
249 virtual dgMatrix ModifierGetMatrix()
const;
250 virtual void ModifierSetMatrix(
const dgMatrix &matrix);
252 virtual bool IsTriggerVolume()
const;
253 virtual void SetAsTriggerVolume(
bool mode);
255 virtual void SetBreakImpulse(dgFloat32 force);
256 virtual dgFloat32 GetBreakImpulse()
const;
259 virtual dgInt32 Release();
260 dgInt32 GetRefCount()
const;
266 dgCollision(
dgWorld *
const world, dgDeserialize deserialization,
void *
const userData);
269 void SetSignature(dgInt32 signature);
270 virtual dgInt32 CalculateSignature()
const = 0;
276 dgUnsigned32 m_userDataID;
277 dgUnsigned32 m_signature;
278 dgCollisionID m_collsionId;
285 friend class dgMinkowskiConv;
287 } DG_GCC_VECTOR_ALIGMENT;
289 inline dgCollisionID dgCollision::GetCollisionPrimityType()
const {
293 inline dgUnsigned32 dgCollision::GetSignature()
const {
297 inline void dgCollision::SetSignature(dgInt32 signature) {
298 m_signature = dgUnsigned32(signature);
301 inline const dgMatrix &dgCollision::GetOffsetMatrix()
const {
305 inline dgMatrix dgCollision::ModifierGetMatrix()
const {
306 return dgGetIdentityMatrix();
309 inline void dgCollision::ModifierSetMatrix(
const dgMatrix &matrix) {
312 inline void dgCollision::SetAsTriggerVolume(
bool mode) {
315 inline bool dgCollision::IsTriggerVolume()
const {
319 inline dgUnsigned32 dgCollision::SetUserDataID()
const {
323 inline void dgCollision::SetUserDataID(dgUnsigned32 userData) {
324 m_userDataID = userData;
332 inline dgInt32 dgCollision::Release() {
341 inline dgInt32 dgCollision::GetRefCount()
const {
345 inline void dgCollision::SetBreakImpulse(dgFloat32 force) {
348 inline dgFloat32 dgCollision::GetBreakImpulse()
const {
349 return dgFloat32(1.0e10f);
356 inline bool dgCollision::IsEdgeIntersection()
const {
Definition: dgCollision.h:140
Definition: dgCollision.h:168
Definition: dgCollision.h:81
Definition: dgCollision.h:93
Definition: dgCollision.h:73
Definition: dgCollision.h:109
Definition: dgVector.h:86
Definition: dgCollision.h:99
Definition: dgCollision.h:75
Definition: dgMeshEffect.h:78
Definition: dgCollision.h:116
Definition: dgCollisionConvex.h:39
Definition: dgCollision.h:178
Definition: dgMatrix.h:41
Definition: dgMemory.h:80
Definition: dgCollision.h:104
Definition: dgWorld.h:118
Definition: dgCollision.h:125
Definition: dgCollisionConvexHull.h:28
Definition: dgCollision.h:87
Definition: dgCollision.h:120
Definition: dgCollisionCompound.h:31
Definition: dgCollision.h:130