24#ifndef GIMPACT_SHAPE_H
25#define GIMPACT_SHAPE_H
61 const btVector3& v0,
const btVector3& v1,
62 const btVector3&
v2,
const btVector3& v3)
129 transformedbox.appy_transform(t);
130 aabbMin = transformedbox.m_min;
131 aabbMax = transformedbox.m_max;
172 child->setMargin(margin);
238 child_aabb.appy_transform(t);
239 aabbMin = child_aabb.m_min;
240 aabbMax = child_aabb.m_max;
265 (void)resultCallback;
339 prim_trans.setIdentity();
342 shape->getAabb(prim_trans, primbox.m_min, primbox.m_max);
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];
665 primbox.calc_from_triangle_margin(
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]);
684 get_vertex(indices[0], triangle.m_vertices1[0]);
685 get_vertex(indices[1], triangle.m_vertices1[1]);
686 get_vertex(indices[2], triangle.m_vertices1[2]);
769 return "GImpactMeshShapePart";
858 for (
int i = 0; i < meshInterface->getNumSubParts(); ++i)
928 part->setLocalScaling(scaling);
942 part->setMargin(margin);
1077 return "GImpactMesh";
ATTR_WARN_UNUSED_RESULT const BMVert * v2
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
@ GIMPACT_SHAPE_PROXYTYPE
Used for GIMPACT Trimesh integration.
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
btScalar m_collisionMargin
btConvexShape * getChildShape()
@ 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
btStridingMeshInterface * m_meshInterface
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
SIMD_FORCE_INLINE void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0),...
SIMD_FORCE_INLINE int size() const
return the number of elements in the array
SIMD_FORCE_INLINE void push_back(const T &_Val)
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
Base method for determinig which kind of GIMPACT shape we get.
SIMD_FORCE_INLINE CompoundPrimitiveManager * getCompoundPrimitiveManager()
Obtains the compopund primitive manager.
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
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const
Trimesh primitive manager.
btStridingMeshInterface * m_meshInterface
virtual ~TrimeshPrimitiveManager()
SIMD_FORCE_INLINE void get_bullet_triangle(int prim_index, btTriangleShapeEx &triangle) const
SIMD_FORCE_INLINE void get_indices(int face_index, unsigned int &i0, unsigned int &i1, unsigned int &i2) const
SIMD_FORCE_INLINE int get_vertex_count() const
TrimeshPrimitiveManager(btStridingMeshInterface *meshInterface, int part)
virtual int get_primitive_count() 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
SIMD_FORCE_INLINE void get_vertex(unsigned int vertex_index, btVector3 &vertex) const
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
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.
SIMD_FORCE_INLINE int getPart() const
virtual void calculateLocalInertia(btScalar mass, btVector3 &inertia) const
SIMD_FORCE_INLINE int getVertexCount() const
virtual const btCollisionShape * getChildShape(int index) const
Gets the child.
virtual void setLocalScaling(const btVector3 &scaling)
SIMD_FORCE_INLINE void getVertex(int vertex_index, btVector3 &vertex) const
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const
SIMD_FORCE_INLINE TrimeshPrimitiveManager * getTrimeshPrimitiveManager()
virtual void processAllTrianglesRay(btTriangleCallback *callback, const btVector3 &rayFrom, const btVector3 &rayTo) const
Function for retrieve triangles.
SIMD_FORCE_INLINE void setMargin(btScalar margin)
virtual int getNumChildShapes() const
Gets the number of children.
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
Base method for determinig which kind of GIMPACT shape we get.
TrimeshPrimitiveManager m_primitive_manager
virtual bool needsRetrieveTetrahedrons() const
Determines if this shape has tetrahedrons.
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()
SIMD_FORCE_INLINE btScalar getMargin() const
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const
virtual void unlockChildShapes() const
This class manages a mesh supplied by the btStridingMeshInterface interface.
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)
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 int calculateSerializeBufferSize() const
virtual bool needsRetrieveTetrahedrons() const
Determines if this shape has tetrahedrons.
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
Base method for determinig which kind of GIMPACT shape we get.
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
SIMD_FORCE_INLINE void update()
this attemps to refit the box set.
SIMD_FORCE_INLINE int getNodeCount() const
node count
SIMD_FORCE_INLINE void setPrimitiveManager(btPrimitiveManagerBase *primitive_manager)
SIMD_FORCE_INLINE 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.
SIMD_FORCE_INLINE void getPrimitiveTriangle(int index, btPrimitiveTriangle &triangle) const
if this trimesh
virtual void calcLocalAABB()
virtual void getChildAabb(int child_index, const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
Retrieves the bound from a child.
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const =0
Base method for determinig which kind of GIMPACT shape we get.
virtual void setMargin(btScalar margin)
SIMD_FORCE_INLINE const btAABB & getLocalBox()
Obtains the local box, which is the global calculated box of the total of subshapes.
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
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.
SIMD_FORCE_INLINE void updateBound()
performs refit operation
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.
SIMD_FORCE_INLINE const btGImpactBoxSet * getBoxSet() const
gets boxset
virtual void unlockChildShapes() const
virtual void processAllTrianglesRay(btTriangleCallback *, const btVector3 &, const btVector3 &) const
Function for retrieve triangles.
SIMD_FORCE_INLINE bool hasBoxSet() const
Determines if this class has a hierarchy structure for sorting its primitives.
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
Helper class for tetrahedrons.
SIMD_FORCE_INLINE void setVertices(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2, const btVector3 &v3)
Helper class for colliding Bullet Triangle Shapes.
DEGForeachIDComponentCallback callback
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