24#ifndef GIMPACT_SHAPE_H
25#define GIMPACT_SHAPE_H
130 aabbMin = transformedbox.
m_min;
131 aabbMax = transformedbox.
m_max;
239 aabbMin = child_aabb.
m_min;
240 aabbMax = child_aabb.
m_max;
265 (void)resultCallback;
361 (void)children_has_transform;
486 return "GImpactCompound";
655 vertex[0] = svertices[0] *
m_scale[0];
656 vertex[1] = svertices[1] *
m_scale[1];
657 vertex[2] = svertices[2] *
m_scale[2];
672 unsigned int indices[3];
673 get_indices(prim_index, indices[0], indices[1], indices[2]);
682 unsigned int indices[3];
683 get_indices(prim_index, indices[0], indices[1], indices[2]);
769 return "GImpactMeshShapePart";
1077 return "GImpactMesh";
@ GIMPACT_SHAPE_PROXYTYPE
Used for GIMPACT Trimesh integration.
PHY_ScalarType
PHY_ScalarType enumerates possible scalar types.
@ CONST_GIMPACT_TRIMESH_SHAPE
@ CONST_GIMPACT_TRIMESH_SHAPE_PART
@ CONST_GIMPACT_COMPOUND_SHAPE
btGImpactQuantizedBvh btGImpactBoxSet
declare Quantized trees, (you can change to float based trees)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
#define SIMD_FORCE_INLINE
void merge(const btAABB &box)
Merges a Box.
void calc_from_triangle_margin(const CLASS_POINT &V1, const CLASS_POINT &V2, const CLASS_POINT &V3, btScalar margin)
void appy_transform(const btTransform &trans)
Apply a transform to an AABB.
int size() const
return the number of elements in the array
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0),...
void push_back(const T &_Val)
The btBU_Simplex1to4 implements tetrahedron, triangle, line, vertex collision shapes....
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
virtual void setMargin(btScalar margin)=0
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.
The btConcaveShape class provides an interface for non-moving (static) concave shapes.
btScalar m_collisionMargin
virtual void setMargin(btScalar margin)
compound primitive manager
virtual int get_primitive_count() const
CompoundPrimitiveManager(btGImpactCompoundShape *compoundShape)
CompoundPrimitiveManager(const CompoundPrimitiveManager &compound)
virtual void get_primitive_box(int prim_index, btAABB &primbox) const
btGImpactCompoundShape * m_compoundShape
virtual bool is_trimesh() const
determines if this manager consist on only triangles, which special case will be optimized
virtual ~CompoundPrimitiveManager()
CompoundPrimitiveManager()
virtual void get_primitive_triangle(int prim_index, btPrimitiveTriangle &triangle) const
retrieves only the points of the triangle, and the collision margin
btGImpactCompoundShape allows to handle multiple btCollisionShape objects at once
virtual const char * getName() const
void addChildShape(btCollisionShape *shape)
Use this method for adding children. Only Convex shapes are allowed.
virtual const btPrimitiveManagerBase * getPrimitiveManager() const
Obtains the primitive manager.
btGImpactCompoundShape(bool children_has_transform=true)
virtual void calculateLocalInertia(btScalar mass, btVector3 &inertia) const
Calculates the exact inertia tensor for this shape.
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const
void addChildShape(const btTransform &localTransform, btCollisionShape *shape)
Use this method for adding children. Only Convex shapes are allowed.
virtual const btCollisionShape * getChildShape(int index) const
Gets the children.
virtual void setChildTransform(int index, const btTransform &transform)
Sets the children transform.
btAlignedObjectArray< btTransform > m_childTransforms
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
Subshape member functions.
virtual btCollisionShape * getChildShape(int index)
Gets the children.
btAlignedObjectArray< btCollisionShape * > m_childShapes
virtual bool needsRetrieveTriangles() const
Determines if this shape has triangles.
virtual bool childrenHasTransform() const
if true, then its children must get transforms.
virtual bool needsRetrieveTetrahedrons() const
Determines if this shape has tetrahedrons.
virtual btTransform getChildTransform(int index) const
Gets the children transform.
virtual void getChildAabb(int child_index, const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
Retrieves the bound from a child.
virtual ~btGImpactCompoundShape()
virtual int getNumChildShapes() const
Gets the number of children.
CompoundPrimitiveManager m_primitive_manager
CompoundPrimitiveManager * getCompoundPrimitiveManager()
Obtains the compopund primitive manager.
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const
Trimesh primitive manager.
btStridingMeshInterface * m_meshInterface
void get_indices(int face_index, unsigned int &i0, unsigned int &i1, unsigned int &i2) const
virtual ~TrimeshPrimitiveManager()
TrimeshPrimitiveManager(btStridingMeshInterface *meshInterface, int part)
virtual int get_primitive_count() const
int get_vertex_count() const
void get_bullet_triangle(int prim_index, btTriangleShapeEx &triangle) const
const unsigned char * vertexbase
virtual void get_primitive_triangle(int prim_index, btPrimitiveTriangle &triangle) const
retrieves only the points of the triangle, and the collision margin
PHY_ScalarType indicestype
virtual bool is_trimesh() const
determines if this manager consist on only triangles, which special case will be optimized
TrimeshPrimitiveManager(const TrimeshPrimitiveManager &manager)
TrimeshPrimitiveManager()
const unsigned char * indexbase
void get_vertex(unsigned int vertex_index, btVector3 &vertex) const
virtual void get_primitive_box(int prim_index, btAABB &primbox) const
This class manages a sub part of a mesh supplied by the btStridingMeshInterface interface.
virtual btTransform getChildTransform(int index) const
Gets the children transform.
virtual void processAllTriangles(btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
Function for retrieve triangles.
virtual void setChildTransform(int index, const btTransform &transform)
Sets the children transform.
virtual void calculateLocalInertia(btScalar mass, btVector3 &inertia) const
virtual const btCollisionShape * getChildShape(int index) const
Gets the child.
virtual void setLocalScaling(const btVector3 &scaling)
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const
virtual void processAllTrianglesRay(btTriangleCallback *callback, const btVector3 &rayFrom, const btVector3 &rayTo) const
Function for retrieve triangles.
virtual int getNumChildShapes() const
Gets the number of children.
btScalar getMargin() const
virtual const btVector3 & getLocalScaling() const
virtual const btPrimitiveManagerBase * getPrimitiveManager() const
Obtains the primitive manager.
virtual bool needsRetrieveTriangles() const
Determines if this shape has triangles.
virtual const char * getName() const
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
Subshape member functions.
void getVertex(int vertex_index, btVector3 &vertex) const
TrimeshPrimitiveManager * getTrimeshPrimitiveManager()
void setMargin(btScalar margin)
TrimeshPrimitiveManager m_primitive_manager
virtual bool needsRetrieveTetrahedrons() const
Determines if this shape has tetrahedrons.
int getVertexCount() const
virtual bool childrenHasTransform() const
if true, then its children must get transforms.
virtual btCollisionShape * getChildShape(int index)
Gets the children.
virtual void lockChildShapes() const
call when reading child shapes
virtual ~btGImpactMeshShapePart()
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const
virtual void unlockChildShapes() const
This class manages a mesh supplied by the btStridingMeshInterface interface.
virtual int calculateSerializeBufferSize() const
virtual const btCollisionShape * getChildShape(int index) const
Gets the child.
virtual bool childrenHasTransform() const
if true, then its children must get transforms.
int getMeshPartCount() const
virtual int getNumChildShapes() const
Gets the number of children.
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const
virtual void setChildTransform(int index, const btTransform &transform)
Sets the children transform.
virtual void rayTest(const btVector3 &rayFrom, const btVector3 &rayTo, btCollisionWorld::RayResultCallback &resultCallback) const
virtual method for ray collision
virtual btTransform getChildTransform(int index) const
Gets the children transform.
virtual btCollisionShape * getChildShape(int index)
Gets the children.
virtual void calculateLocalInertia(btScalar mass, btVector3 &inertia) const
btGImpactMeshShapePart * getMeshPart(int index)
btStridingMeshInterface * m_meshInterface
virtual const btPrimitiveManagerBase * getPrimitiveManager() const
Obtains the primitive manager.
virtual ~btGImpactMeshShape()
virtual void lockChildShapes() const
call when reading child shapes
virtual void getChildAabb(int child_index, const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
Retrieves the bound from a child.
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const
const btGImpactMeshShapePart * getMeshPart(int index) const
void buildMeshParts(btStridingMeshInterface *meshInterface)
virtual void processAllTriangles(btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
Function for retrieve triangles.
virtual const char * getName() const
btGImpactMeshShape(btStridingMeshInterface *meshInterface)
virtual void calcLocalAABB()
use this function for perfofm refit in bounding boxes
virtual void setMargin(btScalar margin)
virtual void processAllTrianglesRay(btTriangleCallback *callback, const btVector3 &rayFrom, const btVector3 &rayTo) const
Function for retrieve triangles.
const btStridingMeshInterface * getMeshInterface() const
virtual bool needsRetrieveTetrahedrons() const
Determines if this shape has tetrahedrons.
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
Subshape member functions.
btAlignedObjectArray< btGImpactMeshShapePart * > m_mesh_parts
btStridingMeshInterface * getMeshInterface()
virtual void setLocalScaling(const btVector3 &scaling)
virtual const char * serialize(void *dataBuffer, btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
virtual bool needsRetrieveTriangles() const
Determines if this shape has triangles.
virtual void postUpdate()
Tells to this object that is needed to refit all the meshes.
virtual void unlockChildShapes() const
Structure for containing Boxes.
void buildSet()
this rebuild the entire set
int getNodeCount() const
node count
void update()
node manager prototype functions
void setPrimitiveManager(btPrimitiveManagerBase *primitive_manager)
btAABB getGlobalBox() const
Base class for gimpact shapes.
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 btCollisionShape * getChildShape(int index)=0
Gets the children.
const btGImpactBoxSet * getBoxSet() const
gets boxset
virtual void calcLocalAABB()
use this function for perfofm refit in bounding boxes use this function for perfofm refit in bounding...
virtual void getChildAabb(int child_index, const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
Retrieves the bound from a child.
void getPrimitiveTriangle(int index, btPrimitiveTriangle &triangle) const
if this trimesh
bool hasBoxSet() const
Determines if this class has a hierarchy structure for sorting its primitives.
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const =0
Subshape member functions.
virtual void setMargin(btScalar margin)
virtual void lockChildShapes() const
call when reading child shapes
btGImpactBoxSet m_box_set
virtual bool needsRetrieveTriangles() const =0
Determines if this shape has triangles.
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const =0
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const =0
virtual const btVector3 & getLocalScaling() const
void updateBound()
performs refit operation
virtual const btCollisionShape * getChildShape(int index) const =0
Gets the child.
virtual void setChildTransform(int index, const btTransform &transform)=0
Sets the children transform.
virtual const btPrimitiveManagerBase * getPrimitiveManager() const =0
Obtains the primitive manager.
virtual bool childrenHasTransform() const =0
if true, then its children must get transforms.
virtual int getNumChildShapes() const =0
Gets the number of children.
btGImpactShapeInterface()
virtual btTransform getChildTransform(int index) const =0
Gets the children transform.
virtual int getShapeType() const
virtual void postUpdate()
Tells to this object that is needed to refit the box set.
virtual bool needsRetrieveTetrahedrons() const =0
Determines if this shape has tetrahedrons.
virtual void setLocalScaling(const btVector3 &scaling)
virtual void processAllTriangles(btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
Function for retrieve triangles.
virtual void unlockChildShapes() const
virtual void processAllTrianglesRay(btTriangleCallback *, const btVector3 &, const btVector3 &) const
Function for retrieve triangles.
const btAABB & getLocalBox()
Obtains the local box, which is the global calculated box of the total of subshapes.
virtual void rayTest(const btVector3 &rayFrom, const btVector3 &rayTo, btCollisionWorld::RayResultCallback &resultCallback) const
virtual method for ray collision
Prototype Base class for primitive classification.
virtual void get_primitive_triangle(int prim_index, btPrimitiveTriangle &triangle) const =0
retrieves only the points of the triangle, and the collision margin
virtual void get_primitive_box(int prim_index, btAABB &primbox) const =0
The btStridingMeshInterface is the interface class for high performance generic access to triangle me...
const btVector3 & getScaling() const
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 int getNumSubParts() const =0
getNumSubParts returns the number of separate subparts each subpart has a continuous array of vertice...
virtual void unLockReadOnlyVertexBase(int subpart) const =0
Helper class for tetrahedrons.
void setVertices(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2, const btVector3 &v3)
The btTriangleCallback provides a callback for each overlapping triangle when calling processAllTrian...
Helper class for colliding Bullet Triangle Shapes.
btVector3 can be used to represent 3D points and vectors.
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
RayResultCallback is used to report new raycast results.
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btCollisionShapeData m_collisionShapeData
btStridingMeshInterfaceData m_meshInterface
btVector3FloatData m_localScaling
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64