20 #ifdef SUPPORT_GIMPACT_SHAPE_IMPORT
25 : m_collisionWorld(
world),
41 for (i = 0; i <
arrays->m_bvhsDouble.size(); i++)
44 btQuantizedBvhDoubleData* bvhData =
arrays->m_bvhsDouble[i];
45 bvh->deSerializeDouble(*bvhData);
48 for (i = 0; i <
arrays->m_bvhsFloat.size(); i++)
51 btQuantizedBvhFloatData* bvhData =
arrays->m_bvhsFloat[i];
52 bvh->deSerializeFloat(*bvhData);
56 for (i = 0; i <
arrays->m_colShapeData.size(); i++)
66 if (shape && shapeData->
m_name)
74 for (i = 0; i <
arrays->m_collisionObjectDataDouble.size(); i++)
78 if (shapePtr && *shapePtr)
89 #ifdef USE_INTERNAL_EDGE_UTILITY
93 if (trimesh->getTriangleInfoMap())
103 printf(
"error: no shape found\n");
106 for (i = 0; i <
arrays->m_collisionObjectDataFloat.size(); i++)
110 if (shapePtr && *shapePtr)
119 #ifdef USE_INTERNAL_EDGE_UTILITY
123 if (trimesh->getTriangleInfoMap())
133 printf(
"error: no shape found\n");
255 shape->setLocalScaling(localScaling);
272 #ifdef SUPPORT_GIMPACT_SHAPE_IMPORT
287 shape = gimpactShape;
291 printf(
"unsupported gimpact sub type\n");
321 printf(
"error: wrong up axis for btCapsuleShape\n");
327 cap->deSerializeFloat(capData);
363 btVector3 halfExtents = implicitShapeDimensions + margin;
383 printf(
"unknown Cylinder up axis\n");
392 btVector3 halfExtents = implicitShapeDimensions;
412 printf(
"unknown Cone up axis\n");
425 radii.resize(numSpheres);
426 tmpPos.
resize(numSpheres);
428 for (i = 0; i < numSpheres; i++)
445 tmpPoints.
resize(numPoints);
447 for (i = 0; i < numPoints; i++)
449 #ifdef BT_USE_DOUBLE_PRECISION
462 for (i = 0; i < numPoints; i++)
464 hullShape->addPoint(tmpPoints[i]);
473 printf(
"error: cannot create shape type (%d)\n", shapeData->
m_shapeType);
483 shape->setLocalScaling(localScaling);
492 if (!meshInterface->getNumSubParts())
499 meshInterface->setScaling(scaling);
506 if (bvhPtr && *bvhPtr)
519 if (bvhPtr && *bvhPtr)
533 shape = trimeshShape;
539 trimeshShape->setTriangleInfoMap(
map);
541 #ifdef USE_INTERNAL_EDGE_UTILITY
568 compoundShape->addChildShape(localTransform, childShape);
573 printf(
"error: couldn't create childShape for compoundShape\n");
577 shape = compoundShape;
588 printf(
"unsupported shape type (%d)\n", shapeData->
m_shapeType);
600 int l = (int)strlen(name);
601 char* newName =
new char[
l + 1];
602 memcpy(newName, name,
l);
623 meshPart.m_triangleIndexStride = 3 *
sizeof(int);
624 int* indexArray = (
int*)
btAlignedAlloc(
sizeof(
int) * 3 * meshPart.m_numTriangles, 16);
626 for (
int j = 0; j < 3 * meshPart.m_numTriangles; j++)
630 meshPart.m_triangleIndexBase = (
const unsigned char*)indexArray;
637 meshPart.m_triangleIndexStride =
sizeof(
short int) * 3;
639 short int* indexArray = (
short int*)
btAlignedAlloc(
sizeof(
short int) * 3 * meshPart.m_numTriangles, 16);
642 for (
int j = 0; j < meshPart.m_numTriangles; j++)
649 meshPart.m_triangleIndexBase = (
const unsigned char*)indexArray;
654 meshPart.m_triangleIndexStride = 3 *
sizeof(
short int);
655 short int* indexArray = (
short int*)
btAlignedAlloc(
sizeof(
short int) * 3 * meshPart.m_numTriangles, 16);
657 for (
int j = 0; j < 3 * meshPart.m_numTriangles; j++)
662 meshPart.m_triangleIndexBase = (
const unsigned char*)indexArray;
668 meshPart.m_triangleIndexStride =
sizeof(
unsigned char) * 3;
670 unsigned char* indexArray = (
unsigned char*)
btAlignedAlloc(
sizeof(
unsigned char) * 3 * meshPart.m_numTriangles, 16);
673 for (
int j = 0; j < meshPart.m_numTriangles; j++)
680 meshPart.m_triangleIndexBase = (
const unsigned char*)indexArray;
691 for (
int j = 0; j < meshPart.m_numVertices; j++)
698 meshPart.m_vertexBase = (
const unsigned char*)vertices;
708 for (
int j = 0; j < meshPart.m_numVertices; j++)
715 meshPart.m_vertexBase = (
const unsigned char*)vertices;
718 if (meshPart.m_triangleIndexBase && meshPart.m_vertexBase)
720 meshInterface->addIndexedMesh(meshPart, meshPart.m_indexType);
724 return meshInterface;
763 bool uninitialized3indices8Workaround =
false;
767 uninitialized3indices8Workaround =
true;
776 uninitialized3indices8Workaround =
true;
785 uninitialized3indices8Workaround =
true;
792 if (!uninitialized3indices8Workaround && curPart->
m_3indices8)
806 #ifdef USE_INTERNAL_EDGE_UTILITY
848 if (bodyPtr && *bodyPtr)
858 colObj->setWorldTransform(startTransform);
859 colObj->setCollisionShape(shape);
981 bvhTriMesh->setOptimizedBvh(bvh);
994 #ifdef SUPPORT_GIMPACT_SHAPE_IMPORT
1045 if (shapePtr && *shapePtr)
1055 if (namePtr && *namePtr)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
ATTR_WARN_UNUSED_RESULT const BMLoop * l
#define btAlignedFree(ptr)
#define btAlignedAlloc(size, alignment)
btBoxShape(const btVector3 &boxHalfExtents)
@ COMPOUND_SHAPE_PROXYTYPE
@ GIMPACT_SHAPE_PROXYTYPE
Used for GIMPACT Trimesh integration.
@ SOFTBODY_SHAPE_PROXYTYPE
@ SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE
@ TRIANGLE_MESH_SHAPE_PROXYTYPE
@ MULTI_SPHERE_SHAPE_PROXYTYPE
@ CYLINDER_SHAPE_PROXYTYPE
@ CAPSULE_SHAPE_PROXYTYPE
@ CONVEX_HULL_SHAPE_PROXYTYPE
btBvhTriangleMeshShape(btStridingMeshInterface *meshInterface, bool useQuantizedAabbCompression, bool buildBvh=true)
btCapsuleShape()
only used for btCapsuleShapeZ and btCapsuleShapeX subclasses.
@ CF_CUSTOM_MATERIAL_CALLBACK
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
btCompoundShape(bool enableDynamicAabbTree=true, const int initialChildCapacity=0)
btConeShape(btScalar radius, btScalar height)
btConvexHullShape(const btScalar *points=0, int numPoints=0, int stride=sizeof(btVector3))
btCylinderShape(const btVector3 &halfExtents)
@ CONST_GIMPACT_TRIMESH_SHAPE
void btAdjustInternalEdgeContacts(btManifoldPoint &cp, const btCollisionObjectWrapper *colObj0Wrap, const btCollisionObjectWrapper *colObj1Wrap, int partId0, int index0, int normalAdjustFlags)
Changes a btManifoldPoint collision normal to the normal from the mesh.
ContactAddedCallback gContactAddedCallback
This is to allow MaterialCombiner/Custom Friction/Restitution values.
bool(* ContactAddedCallback)(btManifoldPoint &cp, const btCollisionObjectWrapper *colObj0Wrap, int partId0, int index0, const btCollisionObjectWrapper *colObj1Wrap, int partId1, int index1)
btMultiSphereShape(const btVector3 *positions, const btScalar *radi, int numSpheres)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btScaledBvhTriangleMeshShape(btBvhTriangleMeshShape *childShape, const btVector3 &localScaling)
btSphereShape(btScalar radius)
btStaticPlaneShape(const btVector3 &planeNormal, btScalar planeConstant)
btTriangleIndexVertexArray()
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 resize(int newsize, const T &fillData=T())
SIMD_FORCE_INLINE void push_back(const T &_Val)
btAlignedObjectArray< btOptimizedBvh * > m_allocatedBvhs
virtual void deleteAllData()
virtual ~btCollisionWorldImporter()
virtual btStridingMeshInterfaceData * createStridingMeshInterfaceData(btStridingMeshInterfaceData *interfaceData)
virtual btOptimizedBvh * createOptimizedBvh()
acceleration and connectivity structures
btAlignedObjectArray< btTriangleIndexVertexArray * > m_allocatedTriangleIndexArrays
virtual btCollisionShape * createCylinderShapeX(btScalar radius, btScalar height)
bool convertAllObjects(btBulletSerializedArrays *arrays)
int getNumTriangleInfoMaps() const
btCollisionShape * getCollisionShapeByName(const char *name)
virtual btCollisionShape * createPlaneShape(const btVector3 &planeNormal, btScalar planeConstant)
shapes
char * duplicateName(const char *name)
virtual class btTriangleIndexVertexArray * createTriangleMeshContainer()
btCollisionShape * convertCollisionShape(btCollisionShapeData *shapeData)
virtual btCollisionShape * createConeShapeZ(btScalar radius, btScalar height)
btTriangleInfoMap * getTriangleInfoMapByIndex(int index) const
btAlignedObjectArray< btCollisionObject * > m_allocatedRigidBodies
btCollisionWorld * m_collisionWorld
virtual class btCompoundShape * createCompoundShape()
virtual class btMultiSphereShape * createMultiSphereShape(const btVector3 *positions, const btScalar *radi, int numSpheres)
btHashMap< btHashPtr, btCollisionShape * > m_shapeMap
virtual btCollisionShape * createConeShapeY(btScalar radius, btScalar height)
virtual btCollisionShape * createSphereShape(btScalar radius)
btCollisionShape * getCollisionShapeByIndex(int index)
virtual btCollisionShape * createBoxShape(const btVector3 &halfExtents)
btAlignedObjectArray< btVector3DoubleData * > m_doubleVertexArrays
virtual btCollisionShape * createCylinderShapeZ(btScalar radius, btScalar height)
virtual class btConvexHullShape * createConvexHullShape()
btAlignedObjectArray< int * > m_indexArrays
const char * getNameForPointer(const void *ptr) const
virtual btTriangleInfoMap * createTriangleInfoMap()
int getNumCollisionShapes() const
virtual btCollisionShape * createConeShapeX(btScalar radius, btScalar height)
btHashMap< btHashString, btCollisionShape * > m_nameShapeMap
btCollisionObject * getCollisionObjectByName(const char *name)
btAlignedObjectArray< char * > m_allocatedNames
virtual btBvhTriangleMeshShape * createBvhTriangleMeshShape(btStridingMeshInterface *trimesh, btOptimizedBvh *bvh)
btAlignedObjectArray< short int * > m_shortIndexArrays
btAlignedObjectArray< btStridingMeshInterfaceData * > m_allocatedbtStridingMeshInterfaceDatas
btOptimizedBvh * getBvhByIndex(int index) const
btHashMap< btHashString, btCollisionObject * > m_nameColObjMap
btCollisionObject * getRigidBodyByIndex(int index) const
btHashMap< btHashPtr, btOptimizedBvh * > m_bvhMap
btHashMap< btHashPtr, const char * > m_objectNameMap
int getNumRigidBodies() const
btAlignedObjectArray< btCollisionObject * > m_allocatedCollisionObjects
virtual btCollisionShape * createConvexTriangleMeshShape(btStridingMeshInterface *trimesh)
virtual class btScaledBvhTriangleMeshShape * createScaledTrangleMeshShape(btBvhTriangleMeshShape *meshShape, const btVector3 &localScalingbtBvhTriangleMeshShape)
virtual btCollisionShape * createCylinderShapeY(btScalar radius, btScalar height)
virtual btCollisionShape * createCapsuleShapeY(btScalar radius, btScalar height)
virtual btCollisionShape * createCapsuleShapeZ(btScalar radius, btScalar height)
btAlignedObjectArray< btVector3FloatData * > m_floatVertexArrays
btAlignedObjectArray< btTriangleInfoMap * > m_allocatedTriangleInfoMaps
virtual btCollisionObject * createCollisionObject(const btTransform &startTransform, btCollisionShape *shape, const char *bodyName)
those virtuals are called by load and can be overridden by the user
virtual btTriangleIndexVertexArray * createMeshInterface(btStridingMeshInterfaceData &meshData)
btHashMap< btHashPtr, btCollisionObject * > m_bodyMap
btCollisionWorldImporter(btCollisionWorld *world)
btAlignedObjectArray< unsigned char * > m_charIndexArrays
btAlignedObjectArray< btCollisionShape * > m_allocatedCollisionShapes
virtual btCollisionShape * createCapsuleShapeX(btScalar radius, btScalar height)
CollisionWorld is interface and container for the collision detection.
virtual void removeCollisionObject(btCollisionObject *collisionObject)
virtual void addCollisionObject(btCollisionObject *collisionObject, int collisionFilterGroup=btBroadphaseProxy::DefaultFilter, int collisionFilterMask=btBroadphaseProxy::AllFilter)
btConeShape implements a Cone shape, around the X axis
btConeShapeZ implements a Cone shape, around the Z axis
This class manages a mesh supplied by the btStridingMeshInterface interface.
virtual void setMargin(btScalar margin)
virtual void setLocalScaling(const btVector3 &scaling)
SIMD_FORCE_INLINE void updateBound()
performs refit operation
void insert(const Key &key, const Value &value)
const Value * find(const Key &key) const
static RawVector< RawArray< int64_t, 0 > > arrays
MutableSpan< float3 > positions
MutableSpan< float > radii
SocketIndexByIdentifierMap * map
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
unsigned char m_values[3]
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btTransformDoubleData m_worldTransform
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btTransformFloatData m_worldTransform
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btTransformFloatData m_transform
btCollisionShapeData * m_childShape
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btCompoundShapeChildData * m_childShapePtr
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btVector3DoubleData * m_unscaledPointsDoublePtr
btVector3FloatData * m_unscaledPointsFloatPtr
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btVector3FloatData m_implicitShapeDimensions
btVector3FloatData m_localScaling
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btStridingMeshInterfaceData m_meshInterface
btVector3FloatData m_localScaling
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btShortIntIndexData * m_indices16
btCharIndexTripletData * m_3indices8
btVector3FloatData * m_vertices3f
btShortIntIndexTripletData * m_3indices16
btIntIndexData * m_indices32
btVector3DoubleData * m_vertices3d
int m_localPositionArraySize
btPositionAndRadius * m_localPositionArrayPtr
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btTriangleMeshShapeData m_trimeshShapeData
btVector3FloatData m_localScaling
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btVector3FloatData m_localScaling
btVector3FloatData m_planeNormal
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btMeshPartData * m_meshPartsPtr
btVector3FloatData m_scaling
The btTriangleInfoMap stores edge angle information for some triangles. You can compute this informat...
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btStridingMeshInterfaceData m_meshInterface
btQuantizedBvhDoubleData * m_quantizedDoubleBvh
btQuantizedBvhFloatData * m_quantizedFloatBvh
btTriangleInfoMapData * m_triangleInfoMap