25 #ifndef GIMPACT_SHAPE_H    26 #define GIMPACT_SHAPE_H   111                 m_needs_update = 
true;
   125         if(!m_needs_update) 
return;
   127         m_needs_update  = 
false;
   136         btAABB transformedbox = m_localAABB;
   138         aabbMin = transformedbox.
m_min;
   139         aabbMax = transformedbox.
m_max;
   145         m_needs_update = 
true;
   165                 localScaling = scaling;
   178         int i = getNumChildShapes();
   185                 m_needs_update = 
true;
   213         virtual int     getNumChildShapes() 
const  = 0;
   216         virtual bool childrenHasTransform() 
const = 0;
   219         virtual bool needsRetrieveTriangles() 
const = 0;
   222         virtual bool needsRetrieveTetrahedrons() 
const = 0;
   224         virtual void getBulletTriangle(
int prim_index,
btTriangleShapeEx & triangle) 
const = 0;
   242                 getPrimitiveManager()->get_primitive_triangle(index,triangle);
   252         getPrimitiveManager()->get_primitive_box(child_index,child_aabb);
   254         aabbMin = child_aabb.
m_min;
   255         aabbMax = child_aabb.
m_max;
   266         virtual btTransform     getChildTransform(
int index) 
const = 0;
   272         virtual void setChildTransform(
int index, 
const btTransform & transform) = 0;
   280         (void) rayFrom; (void) rayTo; (void) resultCallback;
   289         (void) callback; (void) aabbMin; (void) aabbMax;
   329                         m_compoundShape = compoundShape;
   334                         m_compoundShape = NULL;
   365             (void) prim_index; (void) triangle;
   382         (void) children_has_transform;
   384                 m_box_set.setPrimitiveManager(&m_primitive_manager);
   395                 if(m_childTransforms.
size()==0) 
return false;
   403                 return &m_primitive_manager;
   409                 return &m_primitive_manager;
   415                 return m_childShapes.
size();
   423                 m_childTransforms.
push_back(localTransform);
   437                 return m_childShapes[index];
   443                 return m_childShapes[index];
   452         if(childrenHasTransform())
   454                 m_childShapes[child_index]->getAabb(t*m_childTransforms[child_index],aabbMin,aabbMax);
   458                 m_childShapes[child_index]->getAabb(t,aabbMin,aabbMax);
   467                 return m_childTransforms[index];
   477                 m_childTransforms[index] = transform;
   496         (void) prim_index; (void) triangle;
   502         (void) prim_index; (void) tetrahedron;
   512                 return "GImpactCompound";
   557                         m_meshInterface = NULL;
   590                         m_meshInterface = meshInterface;
   614                                 &vertexbase,numverts,
   615                                 type, stride,&indexbase, indexstride, numfaces,indicestype,m_part);
   622                         if(m_lock_count == 0) 
return;
   640                         return (
int )numfaces;
   645                         return (
int )numverts;
   652                                 unsigned short* s_indices = (
unsigned short *)(indexbase + face_index * indexstride);
   659                                 unsigned int * i_indices = (
unsigned int *)(indexbase + face_index*indexstride);
   670                                 double * dvertices = (
double *)(vertexbase + vertex_index*stride);
   671                                 vertex[0] = 
btScalar(dvertices[0]*m_scale[0]);
   672                                 vertex[1] = 
btScalar(dvertices[1]*m_scale[1]);
   673                                 vertex[2] = 
btScalar(dvertices[2]*m_scale[2]);
   677                                 float * svertices = (
float *)(vertexbase + vertex_index*stride);
   678                                 vertex[0] = svertices[0]*m_scale[0];
   679                                 vertex[1] = svertices[1]*m_scale[1];
   680                                 vertex[2] = svertices[2]*m_scale[2];
   687                         get_primitive_triangle(prim_index,triangle);
   695                         unsigned int indices[3];
   696                         get_indices(prim_index,indices[0],indices[1],indices[2]);
   697                         get_vertex(indices[0],triangle.
m_vertices[0]);
   698                         get_vertex(indices[1],triangle.
m_vertices[1]);
   699                         get_vertex(indices[2],triangle.
m_vertices[2]);
   705                         unsigned int indices[3];
   706                         get_indices(prim_index,indices[0],indices[1],indices[2]);
   722                 m_box_set.setPrimitiveManager(&m_primitive_manager);
   729                 m_primitive_manager.
m_part = part;
   730                 m_box_set.setPrimitiveManager(&m_primitive_manager);
   747                 void * dummy = (
void*)(m_box_set.getPrimitiveManager());
   749                 dummymanager->
lock();
   754                 void * dummy = (
void*)(m_box_set.getPrimitiveManager());
   807                 return &m_primitive_manager;
   812                 return &m_primitive_manager;
   826                 return "GImpactMeshShapePart";
   867                 m_primitive_manager.
get_vertex(vertex_index,vertex);
   872         m_primitive_manager.
m_margin = margin;
   878         return m_primitive_manager.
m_margin;
   883         m_primitive_manager.
m_scale = scaling;
   889         return m_primitive_manager.
m_scale;
   894         return (
int)m_primitive_manager.
m_part;
   928         m_localAABB.invalidate();
   929         int i = m_mesh_parts.
size();
   932                 m_mesh_parts[i]->updateBound();
   933                 m_localAABB.merge(m_mesh_parts[i]->getLocalBox());
   940                 m_meshInterface = meshInterface;
   941                 buildMeshParts(meshInterface);
   946                 int i = m_mesh_parts.
size();
   952                 m_mesh_parts.
clear();
   958                 return m_meshInterface;
   963                 return m_meshInterface;
   968                 return m_mesh_parts.
size();
   973                 return m_mesh_parts[index];
   980                 return m_mesh_parts[index];
   986                 localScaling = scaling;
   988                 int i = m_mesh_parts.
size();
   995                 m_needs_update = 
true;
  1002                 int i = m_mesh_parts.
size();
  1009                 m_needs_update = 
true;
  1015                 int i = m_mesh_parts.
size();
  1022         m_needs_update = 
true;
  1067         (void) prim_index; (void) triangle;
  1073         (void) prim_index; (void) tetrahedron;
  1096         (void) child_index; (void) t; (void) aabbMin; (void) aabbMax;
  1131         (void) index; (void) transform;
  1144                 return "GImpactMesh";
  1184 #endif //GIMPACT_MESH_SHAPE_H const btStridingMeshInterface * getMeshInterface() const 
void get_bullet_triangle(int prim_index, btTriangleShapeEx &triangle) const 
virtual bool needsRetrieveTetrahedrons() const 
Determines if this shape has tetrahedrons. 
void push_back(const T &_Val)
virtual void getChildAabb(int child_index, const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const 
Retrieves the bound from a child. 
virtual ~btGImpactMeshShape()
Helper class for colliding Bullet Triangle Shapes. 
CompoundPrimitiveManager()
virtual bool childrenHasTransform() const 
if true, then its children must get transforms. 
virtual bool is_trimesh() const 
determines if this manager consist on only triangles, which special case will be optimized ...
btScalar m_collisionMargin
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
virtual void setMargin(btScalar margin)
virtual void postUpdate()
Tells to this object that is needed to refit all the meshes. 
void setVertices(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2, const btVector3 &v3)
virtual int calculateSerializeBufferSize() const 
virtual btTransform getChildTransform(int index) const 
Gets the children transform. 
virtual void lockChildShapes() const 
call when reading child shapes 
virtual void setLocalScaling(const btVector3 &scaling)
virtual bool is_trimesh() const 
determines if this manager consist on only triangles, which special case will be optimized ...
const btAABB & getLocalBox()
Obtains the local box, which is the global calculated box of the total of subshapes. 
void get_indices(int face_index, unsigned int &i0, unsigned int &i1, unsigned int &i2) const 
virtual const btPrimitiveManagerBase * getPrimitiveManager() const 
Obtains the primitive manager. 
void getVertex(int vertex_index, btVector3 &vertex) const 
btGImpactShapeInterface()
virtual bool childrenHasTransform() const 
if true, then its children must get transforms. 
TrimeshPrimitiveManager(btStridingMeshInterface *meshInterface, int part)
virtual void setLocalScaling(const btVector3 &scaling)
void setMargin(btScalar margin)
virtual int calculateSerializeBufferSize() const 
virtual const char * serialize(void *dataBuffer, btSerializer *serializer) const 
fills the dataBuffer and returns the struct name (and 0 on failure) 
CompoundPrimitiveManager(const CompoundPrimitiveManager &compound)
void addChildShape(const btTransform &localTransform, btCollisionShape *shape)
Use this method for adding children. Only Convex shapes are allowed. 
virtual void calcLocalAABB()
use this function for perfofm refit in bounding boxes 
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
RayResultCallback is used to report new raycast results. 
const btVector3 & getScaling() const 
#define SIMD_FORCE_INLINE
CompoundPrimitiveManager m_primitive_manager
void addChildShape(btCollisionShape *shape)
Use this method for adding children. Only Convex shapes are allowed. 
void buildMeshParts(btStridingMeshInterface *meshInterface)
virtual btTransform getChildTransform(int index) const 
Gets the children transform. 
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const 
Subshape member functions. 
This class manages a mesh supplied by the btStridingMeshInterface interface. 
Used for GIMPACT Trimesh integration. 
const unsigned char * vertexbase
virtual bool needsRetrieveTetrahedrons() const 
Determines if this shape has tetrahedrons. 
virtual const char * getName() const 
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const 
btGImpactBoxSet m_box_set
virtual bool childrenHasTransform() const 
if true, then its children must get transforms. 
Prototype Base class for primitive classification. 
void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const 
If the Bounding box is not updated, then this class attemps to calculate it. 
virtual void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const =0
getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t...
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const 
virtual const btPrimitiveManagerBase * getPrimitiveManager() const 
Obtains the primitive manager. 
CompoundPrimitiveManager(btGImpactCompoundShape *compoundShape)
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0), to reduce performance overhead of run-time memory (de)allocations. 
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const 
Subshape member functions. 
compound primitive manager 
btGImpactCompoundShape(bool children_has_transform=true)
virtual void processAllTrianglesRay(btTriangleCallback *, const btVector3 &, const btVector3 &) const 
Function for retrieve triangles. 
bool hasBoxSet() const 
Determines if this class has a hierarchy structure for sorting its primitives. 
btGImpactMeshShapePart * getMeshPart(int index)
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
void get_vertex(unsigned int vertex_index, btVector3 &vertex) const 
btStridingMeshInterface * getMeshInterface()
TrimeshPrimitiveManager * getTrimeshPrimitiveManager()
virtual void setMargin(btScalar margin)
btAlignedObjectArray< btTransform > m_childTransforms
Base class for gimpact shapes. 
This class manages a sub part of a mesh supplied by the btStridingMeshInterface interface. 
const btGImpactBoxSet * getBoxSet() const 
gets boxset 
virtual const btPrimitiveManagerBase * getPrimitiveManager() const 
Obtains the primitive manager. 
int size() const 
return the number of elements in the array 
virtual int getNumChildShapes() const 
Gets the number of children. 
virtual void postUpdate()
Tells to this object that is needed to refit the box set. 
The btTriangleCallback provides a callback for each overlapping triangle when calling processAllTrian...
virtual int getNumChildShapes() const 
Gets the number of children. 
virtual void get_primitive_triangle(int prim_index, btPrimitiveTriangle &triangle) const 
retrieves only the points of the triangle, and the collision margin 
The btBU_Simplex1to4 implements tetrahedron, triangle, line, vertex collision shapes. In most cases it is better to use btConvexHullShape instead. 
virtual void lockChildShapes() const 
call when reading child shapes 
void update()
node manager prototype functions 
btStridingMeshInterfaceData m_meshInterface
TrimeshPrimitiveManager m_primitive_manager
virtual btTransform getChildTransform(int index) const 
Gets the children transform. 
virtual const btCollisionShape * getChildShape(int index) const 
Gets the child. 
virtual ~TrimeshPrimitiveManager()
void calc_from_triangle_margin(const CLASS_POINT &V1, const CLASS_POINT &V2, const CLASS_POINT &V3, btScalar margin)
virtual void get_primitive_triangle(int prim_index, btPrimitiveTriangle &triangle) const 
retrieves only the points of the triangle, and the collision margin 
int getNodeCount() const 
node count 
virtual void setChildTransform(int index, const btTransform &transform)
Sets the children transform. 
int get_vertex_count() const 
virtual void unlockChildShapes() const 
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const 
virtual bool needsRetrieveTriangles() const 
Determines if this shape has triangles. 
virtual void unlockChildShapes() const 
virtual void setMargin(btScalar margin)=0
Helper class for tetrahedrons. 
TrimeshPrimitiveManager(const TrimeshPrimitiveManager &manager)
void appy_transform(const btTransform &trans)
Apply a transform to an AABB. 
virtual bool needsRetrieveTetrahedrons() const 
Determines if this shape has tetrahedrons. 
btScalar getMargin() const 
btGImpactMeshShapePart(btStridingMeshInterface *meshInterface, int part)
virtual void get_primitive_box(int prim_index, btAABB &primbox) const 
Trimesh primitive manager. 
CompoundPrimitiveManager * getCompoundPrimitiveManager()
Obtains the compopund primitive manager. 
virtual const char * getName() const 
btCollisionShapeData m_collisionShapeData
btVector3 can be used to represent 3D points and vectors. 
virtual int getNumSubParts() const =0
getNumSubParts returns the number of seperate subparts each subpart has a continuous array of vertice...
virtual void calcLocalAABB()
use this function for perfofm refit in bounding boxes 
PHY_ScalarType indicestype
virtual bool needsRetrieveTriangles() const 
Determines if this shape has triangles. 
virtual btCollisionShape * getChildShape(int index)
Gets the children. 
virtual void lockChildShapes() const 
call when reading child shapes 
virtual void unlockChildShapes() const 
The btStridingMeshInterface is the interface class for high performance generic access to triangle me...
virtual ~btGImpactMeshShapePart()
virtual bool needsRetrieveTriangles() const 
Determines if this shape has triangles. 
virtual void setLocalScaling(const btVector3 &scaling)
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const 
The btConcaveShape class provides an interface for non-moving (static) concave shapes. 
virtual btCollisionShape * getChildShape(int index)
Gets the children. 
virtual void getChildAabb(int child_index, const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const 
Retrieves the bound from a child. 
virtual const btVector3 & getLocalScaling() const 
const unsigned char * indexbase
virtual void setChildTransform(int index, const btTransform &transform)
Sets the children transform. 
virtual int get_primitive_count() const 
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
const btGImpactMeshShapePart * getMeshPart(int index) const 
virtual void calculateLocalInertia(btScalar mass, btVector3 &inertia) const 
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const 
btStridingMeshInterface * m_meshInterface
virtual void getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int &numverts, PHY_ScalarType &type, int &stride, const unsigned char **indexbase, int &indexstride, int &numfaces, PHY_ScalarType &indicestype, int subpart=0) const =0
virtual void processAllTriangles(btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const 
Function for retrieve triangles. 
virtual void rayTest(const btVector3 &rayFrom, const btVector3 &rayTo, btCollisionWorld::RayResultCallback &resultCallback) const 
virtual method for ray collision 
virtual const btVector3 & getLocalScaling() const 
virtual ~CompoundPrimitiveManager()
virtual btCollisionShape * getChildShape(int index)
Gets the children. 
virtual void unLockReadOnlyVertexBase(int subpart) const =0
void updateBound()
performs refit operation 
btAABB getGlobalBox() const 
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const 
Subshape member functions. 
virtual ~btGImpactCompoundShape()
void getPrimitiveTriangle(int index, btPrimitiveTriangle &triangle) const 
if this trimesh 
btAlignedObjectArray< btGImpactMeshShapePart * > m_mesh_parts
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const 
btVector3FloatData m_localScaling
Structure for containing Boxes. 
int getMeshPartCount() const 
btAlignedObjectArray< btCollisionShape * > m_childShapes
virtual void get_primitive_box(int prim_index, btAABB &primbox) const 
btGImpactCompoundShape * m_compoundShape
TrimeshPrimitiveManager()
virtual void getChildAabb(int child_index, const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const 
Retrieves the bound from a child. 
virtual void setChildTransform(int index, const btTransform &transform)
Sets the children transform. 
virtual int getNumChildShapes() const 
Gets the number of children. 
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
virtual const btCollisionShape * getChildShape(int index) const 
Gets the children. 
virtual const char * getName() const 
virtual int getShapeType() const 
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btGImpactCompoundShape allows to handle multiple btCollisionShape objects at once ...
PHY_ScalarType
PHY_ScalarType enumerates possible scalar types. 
btGImpactMeshShape(btStridingMeshInterface *meshInterface)
btStridingMeshInterface * m_meshInterface
btGImpactQuantizedBvh btGImpactBoxSet
declare Quantized trees, (you can change to float based trees) 
void buildSet()
this rebuild the entire set 
int getVertexCount() const 
virtual int get_primitive_count() const 
virtual const btCollisionShape * getChildShape(int index) const 
Gets the child. 
virtual void setMargin(btScalar margin)