1 /*! \file btGImpactShape.h
2 \author Francisco Le
\7fn Nßjera
5 This source file is part of GIMPACT Library.
7 For the latest info, see http://gimpact.sourceforge.net/
9 Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371.
10 email: projectileman@yahoo.com
13 This software is provided 'as-is', without any express or implied warranty.
14 In no event will the authors be held liable for any damages arising from the use of this software.
15 Permission is granted to anyone to use this software for any purpose,
16 including commercial applications, and to alter it and redistribute it freely,
17 subject to the following restrictions:
19 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
20 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
21 3. This notice may not be removed or altered from any source distribution.
25 #ifndef GIMPACT_SHAPE_H
26 #define GIMPACT_SHAPE_H
28 #include "BulletCollision/CollisionShapes/btCollisionShape.h"
29 #include "BulletCollision/CollisionShapes/btTriangleShape.h"
30 #include "BulletCollision/CollisionShapes/btStridingMeshInterface.h"
31 #include "BulletCollision/CollisionShapes/btCollisionMargin.h"
32 #include "BulletCollision/CollisionDispatch/btCollisionWorld.h"
33 #include "BulletCollision/CollisionShapes/btConcaveShape.h"
34 #include "BulletCollision/CollisionShapes/btTetrahedronShape.h"
35 #include "LinearMath/btVector3.h"
36 #include "LinearMath/btTransform.h"
37 #include "LinearMath/btMatrix3x3.h"
38 #include "LinearMath/btAlignedObjectArray.h"
40 #include "btGImpactQuantizedBvh.h" // box tree class
43 //! declare Quantized trees, (you can change to float based trees)
44 typedef btGImpactQuantizedBvh btGImpactBoxSet;
46 enum eGIMPACT_SHAPE_TYPE
48 CONST_GIMPACT_COMPOUND_SHAPE = 0,
49 CONST_GIMPACT_TRIMESH_SHAPE_PART,
50 CONST_GIMPACT_TRIMESH_SHAPE
54 //! Helper class for tetrahedrons
55 class btTetrahedronShapeEx:public btBU_Simplex1to4
58 btTetrahedronShapeEx()
64 SIMD_FORCE_INLINE void setVertices(
65 const btVector3 & v0,const btVector3 & v1,
66 const btVector3 & v2,const btVector3 & v3)
77 //! Base class for gimpact shapes
78 class btGImpactShapeInterface : public btConcaveShape
83 btVector3 localScaling;
84 btGImpactBoxSet m_box_set;// optionally boxset
86 //! use this function for perfofm refit in bounding boxes
87 //! use this function for perfofm refit in bounding boxes
88 virtual void calcLocalAABB()
91 if(m_box_set.getNodeCount() == 0)
101 m_localAABB = m_box_set.getGlobalBox();
106 btGImpactShapeInterface()
108 m_shapeType=GIMPACT_SHAPE_PROXYTYPE;
109 m_localAABB.invalidate();
110 m_needs_update = true;
111 localScaling.setValue(1.f,1.f,1.f);
115 //! performs refit operation
117 Updates the entire Box set of this shape.
118 \pre postUpdate() must be called for attemps to calculating the box set, else this function
120 \post if m_needs_update == true, then it calls calcLocalAABB();
122 SIMD_FORCE_INLINE void updateBound()
124 if(!m_needs_update) return;
126 m_needs_update = false;
129 //! If the Bounding box is not updated, then this class attemps to calculate it.
131 \post Calls updateBound() for update the box set.
133 void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
135 btAABB transformedbox = m_localAABB;
136 transformedbox.appy_transform(t);
137 aabbMin = transformedbox.m_min;
138 aabbMax = transformedbox.m_max;
141 //! Tells to this object that is needed to refit the box set
142 virtual void postUpdate()
144 m_needs_update = true;
147 //! Obtains the local box, which is the global calculated box of the total of subshapes
148 SIMD_FORCE_INLINE const btAABB & getLocalBox()
154 virtual int getShapeType() const
156 return GIMPACT_SHAPE_PROXYTYPE;
160 \post You must call updateBound() for update the box set.
162 virtual void setLocalScaling(const btVector3& scaling)
164 localScaling = scaling;
168 virtual const btVector3& getLocalScaling() const
174 virtual void setMargin(btScalar margin)
176 m_collisionMargin = margin;
177 int i = getNumChildShapes();
180 btCollisionShape* child = getChildShape(i);
181 child->setMargin(margin);
184 m_needs_update = true;
188 //! Subshape member functions
191 //! Base method for determinig which kind of GIMPACT shape we get
192 virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const = 0 ;
195 SIMD_FORCE_INLINE const btGImpactBoxSet * getBoxSet() const
200 //! Determines if this class has a hierarchy structure for sorting its primitives
201 SIMD_FORCE_INLINE bool hasBoxSet() const
203 if(m_box_set.getNodeCount() == 0) return false;
207 //! Obtains the primitive manager
208 virtual const btPrimitiveManagerBase * getPrimitiveManager() const = 0;
211 //! Gets the number of children
212 virtual int getNumChildShapes() const = 0;
214 //! if true, then its children must get transforms.
215 virtual bool childrenHasTransform() const = 0;
217 //! Determines if this shape has triangles
218 virtual bool needsRetrieveTriangles() const = 0;
220 //! Determines if this shape has tetrahedrons
221 virtual bool needsRetrieveTetrahedrons() const = 0;
223 virtual void getBulletTriangle(int prim_index,btTriangleShapeEx & triangle) const = 0;
225 virtual void getBulletTetrahedron(int prim_index,btTetrahedronShapeEx & tetrahedron) const = 0;
229 //! call when reading child shapes
230 virtual void lockChildShapes() const
234 virtual void unlockChildShapes() const
239 SIMD_FORCE_INLINE void getPrimitiveTriangle(int index,btPrimitiveTriangle & triangle) const
241 getPrimitiveManager()->get_primitive_triangle(index,triangle);
245 //! Retrieves the bound from a child
248 virtual void getChildAabb(int child_index,const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
251 getPrimitiveManager()->get_primitive_box(child_index,child_aabb);
252 child_aabb.appy_transform(t);
253 aabbMin = child_aabb.m_min;
254 aabbMax = child_aabb.m_max;
257 //! Gets the children
258 virtual btCollisionShape* getChildShape(int index) = 0;
262 virtual const btCollisionShape* getChildShape(int index) const = 0;
264 //! Gets the children transform
265 virtual btTransform getChildTransform(int index) const = 0;
267 //! Sets the children transform
269 \post You must call updateBound() for update the box set.
271 virtual void setChildTransform(int index, const btTransform & transform) = 0;
276 //! virtual method for ray collision
277 virtual void rayTest(const btVector3& rayFrom, const btVector3& rayTo, btCollisionWorld::RayResultCallback& resultCallback) const
279 (void) rayFrom; (void) rayTo; (void) resultCallback;
282 //! Function for retrieve triangles.
284 It gives the triangles in local space
286 virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
288 (void) callback; (void) aabbMin; (void) aabbMax;
296 //! btGImpactCompoundShape allows to handle multiple btCollisionShape objects at once
298 This class only can manage Convex subshapes
300 class btGImpactCompoundShape : public btGImpactShapeInterface
303 //! compound primitive manager
304 class CompoundPrimitiveManager:public btPrimitiveManagerBase
307 virtual ~CompoundPrimitiveManager() {}
308 btGImpactCompoundShape * m_compoundShape;
311 CompoundPrimitiveManager(const CompoundPrimitiveManager& compound)
312 : btPrimitiveManagerBase()
314 m_compoundShape = compound.m_compoundShape;
317 CompoundPrimitiveManager(btGImpactCompoundShape * compoundShape)
319 m_compoundShape = compoundShape;
322 CompoundPrimitiveManager()
324 m_compoundShape = NULL;
327 virtual bool is_trimesh() const
332 virtual int get_primitive_count() const
334 return (int )m_compoundShape->getNumChildShapes();
337 virtual void get_primitive_box(int prim_index ,btAABB & primbox) const
339 btTransform prim_trans;
340 if(m_compoundShape->childrenHasTransform())
342 prim_trans = m_compoundShape->getChildTransform(prim_index);
346 prim_trans.setIdentity();
348 const btCollisionShape* shape = m_compoundShape->getChildShape(prim_index);
349 shape->getAabb(prim_trans,primbox.m_min,primbox.m_max);
352 virtual void get_primitive_triangle(int prim_index,btPrimitiveTriangle & triangle) const
355 (void) prim_index; (void) triangle;
363 CompoundPrimitiveManager m_primitive_manager;
364 btAlignedObjectArray<btTransform> m_childTransforms;
365 btAlignedObjectArray<btCollisionShape*> m_childShapes;
370 btGImpactCompoundShape(bool children_has_transform = true)
372 (void) children_has_transform;
373 m_primitive_manager.m_compoundShape = this;
374 m_box_set.setPrimitiveManager(&m_primitive_manager);
377 virtual ~btGImpactCompoundShape()
382 //! if true, then its children must get transforms.
383 virtual bool childrenHasTransform() const
385 if(m_childTransforms.size()==0) return false;
390 //! Obtains the primitive manager
391 virtual const btPrimitiveManagerBase * getPrimitiveManager() const
393 return &m_primitive_manager;
396 //! Obtains the compopund primitive manager
397 SIMD_FORCE_INLINE CompoundPrimitiveManager * getCompoundPrimitiveManager()
399 return &m_primitive_manager;
402 //! Gets the number of children
403 virtual int getNumChildShapes() const
405 return m_childShapes.size();
409 //! Use this method for adding children. Only Convex shapes are allowed.
410 void addChildShape(const btTransform& localTransform,btCollisionShape* shape)
412 btAssert(shape->isConvex());
413 m_childTransforms.push_back(localTransform);
414 m_childShapes.push_back(shape);
417 //! Use this method for adding children. Only Convex shapes are allowed.
418 void addChildShape(btCollisionShape* shape)
420 btAssert(shape->isConvex());
421 m_childShapes.push_back(shape);
424 //! Gets the children
425 virtual btCollisionShape* getChildShape(int index)
427 return m_childShapes[index];
430 //! Gets the children
431 virtual const btCollisionShape* getChildShape(int index) const
433 return m_childShapes[index];
436 //! Retrieves the bound from a child
439 virtual void getChildAabb(int child_index,const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
442 if(childrenHasTransform())
444 m_childShapes[child_index]->getAabb(t*m_childTransforms[child_index],aabbMin,aabbMax);
448 m_childShapes[child_index]->getAabb(t,aabbMin,aabbMax);
453 //! Gets the children transform
454 virtual btTransform getChildTransform(int index) const
456 btAssert(m_childTransforms.size() == m_childShapes.size());
457 return m_childTransforms[index];
460 //! Sets the children transform
462 \post You must call updateBound() for update the box set.
464 virtual void setChildTransform(int index, const btTransform & transform)
466 btAssert(m_childTransforms.size() == m_childShapes.size());
467 m_childTransforms[index] = transform;
471 //! Determines if this shape has triangles
472 virtual bool needsRetrieveTriangles() const
477 //! Determines if this shape has tetrahedrons
478 virtual bool needsRetrieveTetrahedrons() const
484 virtual void getBulletTriangle(int prim_index,btTriangleShapeEx & triangle) const
486 (void) prim_index; (void) triangle;
490 virtual void getBulletTetrahedron(int prim_index,btTetrahedronShapeEx & tetrahedron) const
492 (void) prim_index; (void) tetrahedron;
497 //! Calculates the exact inertia tensor for this shape
498 virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
500 virtual const char* getName()const
502 return "GImpactCompound";
505 virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
507 return CONST_GIMPACT_COMPOUND_SHAPE;
514 //! This class manages a sub part of a mesh supplied by the btStridingMeshInterface interface.
516 - Simply create this shape by passing the btStridingMeshInterface to the constructor btGImpactMeshShapePart, then you must call updateBound() after creating the mesh
517 - When making operations with this shape, you must call <b>lock</b> before accessing to the trimesh primitives, and then call <b>unlock</b>
518 - You can handle deformable meshes with this shape, by calling postUpdate() every time when changing the mesh vertices.
521 class btGImpactMeshShapePart : public btGImpactShapeInterface
524 //! Trimesh primitive manager
526 Manages the info from btStridingMeshInterface object and controls the Lock/Unlock mechanism
528 class TrimeshPrimitiveManager:public btPrimitiveManagerBase
532 btStridingMeshInterface * m_meshInterface;
536 const unsigned char *vertexbase;
540 const unsigned char *indexbase;
543 PHY_ScalarType indicestype;
545 TrimeshPrimitiveManager()
547 m_meshInterface = NULL;
550 m_scale = btVector3(1.f,1.f,1.f);
560 TrimeshPrimitiveManager(const TrimeshPrimitiveManager & manager)
561 : btPrimitiveManagerBase()
563 m_meshInterface = manager.m_meshInterface;
564 m_part = manager.m_part;
565 m_margin = manager.m_margin;
566 m_scale = manager.m_scale;
577 TrimeshPrimitiveManager(
578 btStridingMeshInterface * meshInterface, int part)
580 m_meshInterface = meshInterface;
582 m_scale = m_meshInterface->getScaling();
594 virtual ~TrimeshPrimitiveManager() {}
603 m_meshInterface->getLockedReadOnlyVertexIndexBase(
604 &vertexbase,numverts,
605 type, stride,&indexbase, indexstride, numfaces,indicestype,m_part);
612 if(m_lock_count == 0) return;
618 m_meshInterface->unLockReadOnlyVertexBase(m_part);
623 virtual bool is_trimesh() const
628 virtual int get_primitive_count() const
630 return (int )numfaces;
633 SIMD_FORCE_INLINE int get_vertex_count() const
635 return (int )numverts;
638 SIMD_FORCE_INLINE void get_indices(int face_index,int &i0,int &i1,int &i2) const
640 if(indicestype == PHY_SHORT)
642 unsigned short * s_indices = (unsigned short *)(indexbase + face_index*indexstride);
649 int * i_indices = (int *)(indexbase + face_index*indexstride);
656 SIMD_FORCE_INLINE void get_vertex(int vertex_index, btVector3 & vertex) const
658 if(type == PHY_DOUBLE)
660 double * dvertices = (double *)(vertexbase + vertex_index*stride);
661 vertex[0] = btScalar(dvertices[0]*m_scale[0]);
662 vertex[1] = btScalar(dvertices[1]*m_scale[1]);
663 vertex[2] = btScalar(dvertices[2]*m_scale[2]);
667 float * svertices = (float *)(vertexbase + vertex_index*stride);
668 vertex[0] = svertices[0]*m_scale[0];
669 vertex[1] = svertices[1]*m_scale[1];
670 vertex[2] = svertices[2]*m_scale[2];
674 virtual void get_primitive_box(int prim_index ,btAABB & primbox) const
676 btPrimitiveTriangle triangle;
677 get_primitive_triangle(prim_index,triangle);
678 primbox.calc_from_triangle_margin(
679 triangle.m_vertices[0],
680 triangle.m_vertices[1],triangle.m_vertices[2],triangle.m_margin);
683 virtual void get_primitive_triangle(int prim_index,btPrimitiveTriangle & triangle) const
686 get_indices(prim_index,indices[0],indices[1],indices[2]);
687 get_vertex(indices[0],triangle.m_vertices[0]);
688 get_vertex(indices[1],triangle.m_vertices[1]);
689 get_vertex(indices[2],triangle.m_vertices[2]);
690 triangle.m_margin = m_margin;
693 SIMD_FORCE_INLINE void get_bullet_triangle(int prim_index,btTriangleShapeEx & triangle) const
696 get_indices(prim_index,indices[0],indices[1],indices[2]);
697 get_vertex(indices[0],triangle.m_vertices1[0]);
698 get_vertex(indices[1],triangle.m_vertices1[1]);
699 get_vertex(indices[2],triangle.m_vertices1[2]);
700 triangle.setMargin(m_margin);
707 TrimeshPrimitiveManager m_primitive_manager;
710 btGImpactMeshShapePart()
712 m_box_set.setPrimitiveManager(&m_primitive_manager);
716 btGImpactMeshShapePart(btStridingMeshInterface * meshInterface, int part)
718 m_primitive_manager.m_meshInterface = meshInterface;
719 m_primitive_manager.m_part = part;
720 m_box_set.setPrimitiveManager(&m_primitive_manager);
723 virtual ~btGImpactMeshShapePart()
727 //! if true, then its children must get transforms.
728 virtual bool childrenHasTransform() const
734 //! call when reading child shapes
735 virtual void lockChildShapes() const
737 void * dummy = (void*)(m_box_set.getPrimitiveManager());
738 TrimeshPrimitiveManager * dummymanager = static_cast<TrimeshPrimitiveManager *>(dummy);
739 dummymanager->lock();
742 virtual void unlockChildShapes() const
744 void * dummy = (void*)(m_box_set.getPrimitiveManager());
745 TrimeshPrimitiveManager * dummymanager = static_cast<TrimeshPrimitiveManager *>(dummy);
746 dummymanager->unlock();
749 //! Gets the number of children
750 virtual int getNumChildShapes() const
752 return m_primitive_manager.get_primitive_count();
756 //! Gets the children
757 virtual btCollisionShape* getChildShape(int index)
767 virtual const btCollisionShape* getChildShape(int index) const
774 //! Gets the children transform
775 virtual btTransform getChildTransform(int index) const
779 return btTransform();
782 //! Sets the children transform
784 \post You must call updateBound() for update the box set.
786 virtual void setChildTransform(int index, const btTransform & transform)
794 //! Obtains the primitive manager
795 virtual const btPrimitiveManagerBase * getPrimitiveManager() const
797 return &m_primitive_manager;
800 SIMD_FORCE_INLINE TrimeshPrimitiveManager * getTrimeshPrimitiveManager()
802 return &m_primitive_manager;
809 virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
814 virtual const char* getName()const
816 return "GImpactMeshShapePart";
819 virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
821 return CONST_GIMPACT_TRIMESH_SHAPE_PART;
824 //! Determines if this shape has triangles
825 virtual bool needsRetrieveTriangles() const
830 //! Determines if this shape has tetrahedrons
831 virtual bool needsRetrieveTetrahedrons() const
836 virtual void getBulletTriangle(int prim_index,btTriangleShapeEx & triangle) const
838 m_primitive_manager.get_bullet_triangle(prim_index,triangle);
841 virtual void getBulletTetrahedron(int prim_index,btTetrahedronShapeEx & tetrahedron) const
850 SIMD_FORCE_INLINE int getVertexCount() const
852 return m_primitive_manager.get_vertex_count();
855 SIMD_FORCE_INLINE void getVertex(int vertex_index, btVector3 & vertex) const
857 m_primitive_manager.get_vertex(vertex_index,vertex);
860 SIMD_FORCE_INLINE void setMargin(btScalar margin)
862 m_primitive_manager.m_margin = margin;
866 SIMD_FORCE_INLINE btScalar getMargin() const
868 return m_primitive_manager.m_margin;
871 virtual void setLocalScaling(const btVector3& scaling)
873 m_primitive_manager.m_scale = scaling;
877 virtual const btVector3& getLocalScaling() const
879 return m_primitive_manager.m_scale;
882 SIMD_FORCE_INLINE int getPart() const
884 return (int)m_primitive_manager.m_part;
887 virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
891 //! This class manages a mesh supplied by the btStridingMeshInterface interface.
893 Set of btGImpactMeshShapePart parts
894 - Simply create this shape by passing the btStridingMeshInterface to the constructor btGImpactMeshShape, then you must call updateBound() after creating the mesh
896 - You can handle deformable meshes with this shape, by calling postUpdate() every time when changing the mesh vertices.
899 class btGImpactMeshShape : public btGImpactShapeInterface
901 btStridingMeshInterface* m_meshInterface;
904 btAlignedObjectArray<btGImpactMeshShapePart*> m_mesh_parts;
905 void buildMeshParts(btStridingMeshInterface * meshInterface)
907 for (int i=0;i<meshInterface->getNumSubParts() ;++i )
909 btGImpactMeshShapePart * newpart = new btGImpactMeshShapePart(meshInterface,i);
910 m_mesh_parts.push_back(newpart);
914 //! use this function for perfofm refit in bounding boxes
915 virtual void calcLocalAABB()
917 m_localAABB.invalidate();
918 int i = m_mesh_parts.size();
921 m_mesh_parts[i]->updateBound();
922 m_localAABB.merge(m_mesh_parts[i]->getLocalBox());
927 btGImpactMeshShape(btStridingMeshInterface * meshInterface)
929 m_meshInterface = meshInterface;
930 buildMeshParts(meshInterface);
933 virtual ~btGImpactMeshShape()
935 int i = m_mesh_parts.size();
938 btGImpactMeshShapePart * part = m_mesh_parts[i];
941 m_mesh_parts.clear();
945 btStridingMeshInterface* getMeshInterface()
947 return m_meshInterface;
950 const btStridingMeshInterface* getMeshInterface() const
952 return m_meshInterface;
955 int getMeshPartCount() const
957 return m_mesh_parts.size();
960 btGImpactMeshShapePart * getMeshPart(int index)
962 return m_mesh_parts[index];
967 const btGImpactMeshShapePart * getMeshPart(int index) const
969 return m_mesh_parts[index];
973 virtual void setLocalScaling(const btVector3& scaling)
975 localScaling = scaling;
977 int i = m_mesh_parts.size();
980 btGImpactMeshShapePart * part = m_mesh_parts[i];
981 part->setLocalScaling(scaling);
984 m_needs_update = true;
987 virtual void setMargin(btScalar margin)
989 m_collisionMargin = margin;
991 int i = m_mesh_parts.size();
994 btGImpactMeshShapePart * part = m_mesh_parts[i];
995 part->setMargin(margin);
998 m_needs_update = true;
1001 //! Tells to this object that is needed to refit all the meshes
1002 virtual void postUpdate()
1004 int i = m_mesh_parts.size();
1007 btGImpactMeshShapePart * part = m_mesh_parts[i];
1011 m_needs_update = true;
1014 virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
1017 //! Obtains the primitive manager
1018 virtual const btPrimitiveManagerBase * getPrimitiveManager() const
1025 //! Gets the number of children
1026 virtual int getNumChildShapes() const
1033 //! if true, then its children must get transforms.
1034 virtual bool childrenHasTransform() const
1040 //! Determines if this shape has triangles
1041 virtual bool needsRetrieveTriangles() const
1047 //! Determines if this shape has tetrahedrons
1048 virtual bool needsRetrieveTetrahedrons() const
1054 virtual void getBulletTriangle(int prim_index,btTriangleShapeEx & triangle) const
1056 (void) prim_index; (void) triangle;
1060 virtual void getBulletTetrahedron(int prim_index,btTetrahedronShapeEx & tetrahedron) const
1062 (void) prim_index; (void) tetrahedron;
1066 //! call when reading child shapes
1067 virtual void lockChildShapes() const
1072 virtual void unlockChildShapes() const
1080 //! Retrieves the bound from a child
1083 virtual void getChildAabb(int child_index,const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
1085 (void) child_index; (void) t; (void) aabbMin; (void) aabbMax;
1089 //! Gets the children
1090 virtual btCollisionShape* getChildShape(int index)
1099 virtual const btCollisionShape* getChildShape(int index) const
1106 //! Gets the children transform
1107 virtual btTransform getChildTransform(int index) const
1111 return btTransform();
1114 //! Sets the children transform
1116 \post You must call updateBound() for update the box set.
1118 virtual void setChildTransform(int index, const btTransform & transform)
1120 (void) index; (void) transform;
1125 virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
1127 return CONST_GIMPACT_TRIMESH_SHAPE;
1131 virtual const char* getName()const
1133 return "GImpactMesh";
1136 virtual void rayTest(const btVector3& rayFrom, const btVector3& rayTo, btCollisionWorld::RayResultCallback& resultCallback) const;
1138 //! Function for retrieve triangles.
1140 It gives the triangles in local space
1142 virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
1144 virtual int calculateSerializeBufferSize() const;
1146 ///fills the dataBuffer and returns the struct name (and 0 on failure)
1147 virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
1151 ///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
1152 struct btGImpactMeshShapeData
1154 btCollisionShapeData m_collisionShapeData;
1156 btStridingMeshInterfaceData m_meshInterface;
1158 btVector3FloatData m_localScaling;
1160 float m_collisionMargin;
1162 int m_gimpactSubType;
1165 SIMD_FORCE_INLINE int btGImpactMeshShape::calculateSerializeBufferSize() const
1167 return sizeof(btGImpactMeshShapeData);
1171 #endif //GIMPACT_MESH_SHAPE_H