Bullet Collision Detection & Physics Library: btCollisionWorldImporter.h Source File

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

btCollisionWorldImporter.h
Go to the documentation of this file.
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2014 Erwin Coumans http://bulletphysics.org
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. 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.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16#ifndef BT_COLLISION_WORLD_IMPORTER_H
17#define BT_COLLISION_WORLD_IMPORTER_H
18
19#include "LinearMath/btTransform.h"
20#include "LinearMath/btVector3.h"
21#include "LinearMath/btAlignedObjectArray.h"
22#include "LinearMath/btHashMap.h"
23
24class btCollisionShape;
25class btCollisionObject;
26struct btBulletSerializedArrays;
27
28struct ConstraintInput;
29class btCollisionWorld;
30struct btCollisionShapeData;
31class btTriangleIndexVertexArray;
32class btStridingMeshInterface;
33struct btStridingMeshInterfaceData;
34class btGImpactMeshShape;
35class btOptimizedBvh;
36struct btTriangleInfoMap;
37class btBvhTriangleMeshShape;
38class btPoint2PointConstraint;
39class btHingeConstraint;
40class btConeTwistConstraint;
41class btGeneric6DofConstraint;
42class btGeneric6DofSpringConstraint;
43class btSliderConstraint;
44class btGearConstraint;
45struct btContactSolverInfo;
46
47 class btCollisionWorldImporter
48{
49protected:
50 btCollisionWorld* m_collisionWorld;
51
52 int m_verboseMode;
53
54 btAlignedObjectArray<btCollisionShape*> m_allocatedCollisionShapes;
55 btAlignedObjectArray<btCollisionObject*> m_allocatedRigidBodies;
56
57 btAlignedObjectArray<btOptimizedBvh*> m_allocatedBvhs;
58 btAlignedObjectArray<btTriangleInfoMap*> m_allocatedTriangleInfoMaps;
59 btAlignedObjectArray<btTriangleIndexVertexArray*> m_allocatedTriangleIndexArrays;
60 btAlignedObjectArray<btStridingMeshInterfaceData*> m_allocatedbtStridingMeshInterfaceDatas;
61 btAlignedObjectArray<btCollisionObject*> m_allocatedCollisionObjects;
62
63 btAlignedObjectArray<char*> m_allocatedNames;
64
65 btAlignedObjectArray<int*> m_indexArrays;
66 btAlignedObjectArray<short int*> m_shortIndexArrays;
67 btAlignedObjectArray<unsigned char*> m_charIndexArrays;
68
69 btAlignedObjectArray<btVector3FloatData*> m_floatVertexArrays;
70 btAlignedObjectArray<btVector3DoubleData*> m_doubleVertexArrays;
71
72 btHashMap<btHashPtr, btOptimizedBvh*> m_bvhMap;
73 btHashMap<btHashPtr, btTriangleInfoMap*> m_timMap;
74
75 btHashMap<btHashString, btCollisionShape*> m_nameShapeMap;
76 btHashMap<btHashString, btCollisionObject*> m_nameColObjMap;
77
78 btHashMap<btHashPtr, const char*> m_objectNameMap;
79
80 btHashMap<btHashPtr, btCollisionShape*> m_shapeMap;
81 btHashMap<btHashPtr, btCollisionObject*> m_bodyMap;
82
83 //methods
84
85 char* duplicateName(const char* name);
86
87 btCollisionShape* convertCollisionShape(btCollisionShapeData* shapeData);
88
89public:
90 btCollisionWorldImporter(btCollisionWorld* world);
91
92 virtual ~btCollisionWorldImporter();
93
94 bool convertAllObjects(btBulletSerializedArrays* arrays);
95
98 virtual void deleteAllData();
99
100 void setVerboseMode(int verboseMode)
101 {
102 m_verboseMode = verboseMode;
103 }
104
105 int getVerboseMode() const
106 {
107 return m_verboseMode;
108 }
109
110 // query for data
111 int getNumCollisionShapes() const;
112 btCollisionShape* getCollisionShapeByIndex(int index);
113 int getNumRigidBodies() const;
114 btCollisionObject* getRigidBodyByIndex(int index) const;
115
116 int getNumBvhs() const;
117 btOptimizedBvh* getBvhByIndex(int index) const;
118 int getNumTriangleInfoMaps() const;
119 btTriangleInfoMap* getTriangleInfoMapByIndex(int index) const;
120
121 // queris involving named objects
122 btCollisionShape* getCollisionShapeByName(const char* name);
123 btCollisionObject* getCollisionObjectByName(const char* name);
124
125 const char* getNameForPointer(const void* ptr) const;
126
128
129 //bodies
130
131 virtual btCollisionObject* createCollisionObject(const btTransform& startTransform, btCollisionShape* shape, const char* bodyName);
132
134
135 virtual btCollisionShape* createPlaneShape(const btVector3& planeNormal, btScalar planeConstant);
136 virtual btCollisionShape* createBoxShape(const btVector3& halfExtents);
137 virtual btCollisionShape* createSphereShape(btScalar radius);
138 virtual btCollisionShape* createCapsuleShapeX(btScalar radius, btScalar height);
139 virtual btCollisionShape* createCapsuleShapeY(btScalar radius, btScalar height);
140 virtual btCollisionShape* createCapsuleShapeZ(btScalar radius, btScalar height);
141
142 virtual btCollisionShape* createCylinderShapeX(btScalar radius, btScalar height);
143 virtual btCollisionShape* createCylinderShapeY(btScalar radius, btScalar height);
144 virtual btCollisionShape* createCylinderShapeZ(btScalar radius, btScalar height);
145 virtual btCollisionShape* createConeShapeX(btScalar radius, btScalar height);
146 virtual btCollisionShape* createConeShapeY(btScalar radius, btScalar height);
147 virtual btCollisionShape* createConeShapeZ(btScalar radius, btScalar height);
148 virtual class btTriangleIndexVertexArray* createTriangleMeshContainer();
149 virtual btBvhTriangleMeshShape* createBvhTriangleMeshShape(btStridingMeshInterface* trimesh, btOptimizedBvh* bvh);
150 virtual btCollisionShape* createConvexTriangleMeshShape(btStridingMeshInterface* trimesh);
151#ifdef SUPPORT_GIMPACT_SHAPE_IMPORT
152 virtual btGImpactMeshShape* createGimpactShape(btStridingMeshInterface* trimesh);
153#endif //SUPPORT_GIMPACT_SHAPE_IMPORT
154 virtual btStridingMeshInterfaceData* createStridingMeshInterfaceData(btStridingMeshInterfaceData* interfaceData);
155
156 virtual class btConvexHullShape* createConvexHullShape();
157 virtual class btCompoundShape* createCompoundShape();
158 virtual class btScaledBvhTriangleMeshShape* createScaledTrangleMeshShape(btBvhTriangleMeshShape* meshShape, const btVector3& localScalingbtBvhTriangleMeshShape);
159
160 virtual class btMultiSphereShape* createMultiSphereShape(const btVector3* positions, const btScalar* radi, int numSpheres);
161
162 virtual btTriangleIndexVertexArray* createMeshInterface(btStridingMeshInterfaceData& meshData);
163
165 virtual btOptimizedBvh* createOptimizedBvh();
166 virtual btTriangleInfoMap* createTriangleInfoMap();
167};
168
169#endif //BT_WORLD_IMPORTER_H
btAlignedObjectArray.h
btHashMap.h
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition btScalar.h:314
btTransform.h
btVector3.h
btAlignedObjectArray
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
Definition btAlignedObjectArray.h:46
btBvhTriangleMeshShape
The btBvhTriangleMeshShape is a static-triangle mesh shape, it can only be used for fixed/non-moving ...
Definition btBvhTriangleMeshShape.h:36
btCollisionObject
btCollisionObject can be used to manage collision detection objects.
Definition btCollisionObject.h:51
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
Definition btCollisionShape.h:28
btCollisionWorldImporter
Definition btCollisionWorldImporter.h:48
btCollisionWorldImporter::m_allocatedBvhs
btAlignedObjectArray< btOptimizedBvh * > m_allocatedBvhs
Definition btCollisionWorldImporter.h:57
btCollisionWorldImporter::deleteAllData
virtual void deleteAllData()
delete all memory collision shapes, rigid bodies, constraints etc.
Definition btCollisionWorldImporter.cpp:140
btCollisionWorldImporter::~btCollisionWorldImporter
virtual ~btCollisionWorldImporter()
Definition btCollisionWorldImporter.cpp:30
btCollisionWorldImporter::createStridingMeshInterfaceData
virtual btStridingMeshInterfaceData * createStridingMeshInterfaceData(btStridingMeshInterfaceData *interfaceData)
Definition btCollisionWorldImporter.cpp:727
btCollisionWorldImporter::createOptimizedBvh
virtual btOptimizedBvh * createOptimizedBvh()
acceleration and connectivity structures
Definition btCollisionWorldImporter.cpp:962
btCollisionWorldImporter::m_allocatedTriangleIndexArrays
btAlignedObjectArray< btTriangleIndexVertexArray * > m_allocatedTriangleIndexArrays
Definition btCollisionWorldImporter.h:59
btCollisionWorldImporter::createCylinderShapeX
virtual btCollisionShape * createCylinderShapeX(btScalar radius, btScalar height)
Definition btCollisionWorldImporter.cpp:913
btCollisionWorldImporter::convertAllObjects
bool convertAllObjects(btBulletSerializedArrays *arrays)
Definition btCollisionWorldImporter.cpp:34
btCollisionWorldImporter::getNumTriangleInfoMaps
int getNumTriangleInfoMaps() const
Definition btCollisionWorldImporter.cpp:1079
btCollisionWorldImporter::getCollisionShapeByName
btCollisionShape * getCollisionShapeByName(const char *name)
Definition btCollisionWorldImporter.cpp:1042
btCollisionWorldImporter::createPlaneShape
virtual btCollisionShape * createPlaneShape(const btVector3 &planeNormal, btScalar planeConstant)
shapes
Definition btCollisionWorldImporter.cpp:873
btCollisionWorldImporter::duplicateName
char * duplicateName(const char *name)
Definition btCollisionWorldImporter.cpp:596
btCollisionWorldImporter::createTriangleMeshContainer
virtual class btTriangleIndexVertexArray * createTriangleMeshContainer()
Definition btCollisionWorldImporter.cpp:955
btCollisionWorldImporter::convertCollisionShape
btCollisionShape * convertCollisionShape(btCollisionShapeData *shapeData)
Definition btCollisionWorldImporter.cpp:242
btCollisionWorldImporter::setVerboseMode
void setVerboseMode(int verboseMode)
Definition btCollisionWorldImporter.h:100
btCollisionWorldImporter::createConeShapeZ
virtual btCollisionShape * createConeShapeZ(btScalar radius, btScalar height)
Definition btCollisionWorldImporter.cpp:948
btCollisionWorldImporter::getNumBvhs
int getNumBvhs() const
Definition btCollisionWorldImporter.cpp:1070
btCollisionWorldImporter::getTriangleInfoMapByIndex
btTriangleInfoMap * getTriangleInfoMapByIndex(int index) const
Definition btCollisionWorldImporter.cpp:1084
btCollisionWorldImporter::m_allocatedRigidBodies
btAlignedObjectArray< btCollisionObject * > m_allocatedRigidBodies
Definition btCollisionWorldImporter.h:55
btCollisionWorldImporter::getVerboseMode
int getVerboseMode() const
Definition btCollisionWorldImporter.h:105
btCollisionWorldImporter::m_collisionWorld
btCollisionWorld * m_collisionWorld
Definition btCollisionWorldImporter.h:50
btCollisionWorldImporter::createCompoundShape
virtual class btCompoundShape * createCompoundShape()
Definition btCollisionWorldImporter.cpp:1010
btCollisionWorldImporter::createMultiSphereShape
virtual class btMultiSphereShape * createMultiSphereShape(const btVector3 *positions, const btScalar *radi, int numSpheres)
Definition btCollisionWorldImporter.cpp:1024
btCollisionWorldImporter::m_shapeMap
btHashMap< btHashPtr, btCollisionShape * > m_shapeMap
Definition btCollisionWorldImporter.h:80
btCollisionWorldImporter::createConeShapeY
virtual btCollisionShape * createConeShapeY(btScalar radius, btScalar height)
Definition btCollisionWorldImporter.cpp:941
btCollisionWorldImporter::createSphereShape
virtual btCollisionShape * createSphereShape(btScalar radius)
Definition btCollisionWorldImporter.cpp:885
btCollisionWorldImporter::m_timMap
btHashMap< btHashPtr, btTriangleInfoMap * > m_timMap
Definition btCollisionWorldImporter.h:73
btCollisionWorldImporter::getCollisionShapeByIndex
btCollisionShape * getCollisionShapeByIndex(int index)
Definition btCollisionWorldImporter.cpp:1037
btCollisionWorldImporter::createBoxShape
virtual btCollisionShape * createBoxShape(const btVector3 &halfExtents)
Definition btCollisionWorldImporter.cpp:879
btCollisionWorldImporter::m_doubleVertexArrays
btAlignedObjectArray< btVector3DoubleData * > m_doubleVertexArrays
Definition btCollisionWorldImporter.h:70
btCollisionWorldImporter::createCylinderShapeZ
virtual btCollisionShape * createCylinderShapeZ(btScalar radius, btScalar height)
Definition btCollisionWorldImporter.cpp:927
btCollisionWorldImporter::createConvexHullShape
virtual class btConvexHullShape * createConvexHullShape()
Definition btCollisionWorldImporter.cpp:1003
btCollisionWorldImporter::m_indexArrays
btAlignedObjectArray< int * > m_indexArrays
Definition btCollisionWorldImporter.h:65
btCollisionWorldImporter::m_verboseMode
int m_verboseMode
Definition btCollisionWorldImporter.h:52
btCollisionWorldImporter::getNameForPointer
const char * getNameForPointer(const void *ptr) const
Definition btCollisionWorldImporter.cpp:1052
btCollisionWorldImporter::createTriangleInfoMap
virtual btTriangleInfoMap * createTriangleInfoMap()
Definition btCollisionWorldImporter.cpp:969
btCollisionWorldImporter::getNumCollisionShapes
int getNumCollisionShapes() const
Definition btCollisionWorldImporter.cpp:1032
btCollisionWorldImporter::createConeShapeX
virtual btCollisionShape * createConeShapeX(btScalar radius, btScalar height)
Definition btCollisionWorldImporter.cpp:934
btCollisionWorldImporter::m_nameShapeMap
btHashMap< btHashString, btCollisionShape * > m_nameShapeMap
Definition btCollisionWorldImporter.h:75
btCollisionWorldImporter::getCollisionObjectByName
btCollisionObject * getCollisionObjectByName(const char *name)
Definition btCollisionWorldImporter.cpp:845
btCollisionWorldImporter::m_allocatedNames
btAlignedObjectArray< char * > m_allocatedNames
Definition btCollisionWorldImporter.h:63
btCollisionWorldImporter::createBvhTriangleMeshShape
virtual btBvhTriangleMeshShape * createBvhTriangleMeshShape(btStridingMeshInterface *trimesh, btOptimizedBvh *bvh)
Definition btCollisionWorldImporter.cpp:976
btCollisionWorldImporter::m_shortIndexArrays
btAlignedObjectArray< short int * > m_shortIndexArrays
Definition btCollisionWorldImporter.h:66
btCollisionWorldImporter::m_allocatedbtStridingMeshInterfaceDatas
btAlignedObjectArray< btStridingMeshInterfaceData * > m_allocatedbtStridingMeshInterfaceDatas
Definition btCollisionWorldImporter.h:60
btCollisionWorldImporter::getBvhByIndex
btOptimizedBvh * getBvhByIndex(int index) const
Definition btCollisionWorldImporter.cpp:1074
btCollisionWorldImporter::m_nameColObjMap
btHashMap< btHashString, btCollisionObject * > m_nameColObjMap
Definition btCollisionWorldImporter.h:76
btCollisionWorldImporter::getRigidBodyByIndex
btCollisionObject * getRigidBodyByIndex(int index) const
Definition btCollisionWorldImporter.cpp:1065
btCollisionWorldImporter::m_bvhMap
btHashMap< btHashPtr, btOptimizedBvh * > m_bvhMap
Definition btCollisionWorldImporter.h:72
btCollisionWorldImporter::m_objectNameMap
btHashMap< btHashPtr, const char * > m_objectNameMap
Definition btCollisionWorldImporter.h:78
btCollisionWorldImporter::getNumRigidBodies
int getNumRigidBodies() const
Definition btCollisionWorldImporter.cpp:1060
btCollisionWorldImporter::m_allocatedCollisionObjects
btAlignedObjectArray< btCollisionObject * > m_allocatedCollisionObjects
Definition btCollisionWorldImporter.h:61
btCollisionWorldImporter::createConvexTriangleMeshShape
virtual btCollisionShape * createConvexTriangleMeshShape(btStridingMeshInterface *trimesh)
Definition btCollisionWorldImporter.cpp:990
btCollisionWorldImporter::createScaledTrangleMeshShape
virtual class btScaledBvhTriangleMeshShape * createScaledTrangleMeshShape(btBvhTriangleMeshShape *meshShape, const btVector3 &localScalingbtBvhTriangleMeshShape)
Definition btCollisionWorldImporter.cpp:1017
btCollisionWorldImporter::createCylinderShapeY
virtual btCollisionShape * createCylinderShapeY(btScalar radius, btScalar height)
Definition btCollisionWorldImporter.cpp:920
btCollisionWorldImporter::createCapsuleShapeY
virtual btCollisionShape * createCapsuleShapeY(btScalar radius, btScalar height)
Definition btCollisionWorldImporter.cpp:899
btCollisionWorldImporter::createCapsuleShapeZ
virtual btCollisionShape * createCapsuleShapeZ(btScalar radius, btScalar height)
Definition btCollisionWorldImporter.cpp:906
btCollisionWorldImporter::m_floatVertexArrays
btAlignedObjectArray< btVector3FloatData * > m_floatVertexArrays
Definition btCollisionWorldImporter.h:69
btCollisionWorldImporter::m_allocatedTriangleInfoMaps
btAlignedObjectArray< btTriangleInfoMap * > m_allocatedTriangleInfoMaps
Definition btCollisionWorldImporter.h:58
btCollisionWorldImporter::createCollisionObject
virtual btCollisionObject * createCollisionObject(const btTransform &startTransform, btCollisionShape *shape, const char *bodyName)
those virtuals are called by load and can be overridden by the user
Definition btCollisionWorldImporter.cpp:855
btCollisionWorldImporter::createMeshInterface
virtual btTriangleIndexVertexArray * createMeshInterface(btStridingMeshInterfaceData &meshData)
Definition btCollisionWorldImporter.cpp:610
btCollisionWorldImporter::m_bodyMap
btHashMap< btHashPtr, btCollisionObject * > m_bodyMap
Definition btCollisionWorldImporter.h:81
btCollisionWorldImporter::btCollisionWorldImporter
btCollisionWorldImporter(btCollisionWorld *world)
Definition btCollisionWorldImporter.cpp:24
btCollisionWorldImporter::m_charIndexArrays
btAlignedObjectArray< unsigned char * > m_charIndexArrays
Definition btCollisionWorldImporter.h:67
btCollisionWorldImporter::m_allocatedCollisionShapes
btAlignedObjectArray< btCollisionShape * > m_allocatedCollisionShapes
Definition btCollisionWorldImporter.h:54
btCollisionWorldImporter::createCapsuleShapeX
virtual btCollisionShape * createCapsuleShapeX(btScalar radius, btScalar height)
Definition btCollisionWorldImporter.cpp:892
btCollisionWorld
CollisionWorld is interface and container for the collision detection.
Definition btCollisionWorld.h:86
btCompoundShape
The btCompoundShape allows to store multiple other btCollisionShapes This allows for moving concave c...
Definition btCompoundShape.h:57
btConeTwistConstraint
btConeTwistConstraint can be used to simulate ragdoll joints (upper arm, leg etc)
Definition btConeTwistConstraint.h:59
btConvexHullShape
The btConvexHullShape implements an implicit convex hull of an array of vertices.
Definition btConvexHullShape.h:27
btGImpactMeshShape
This class manages a mesh supplied by the btStridingMeshInterface interface.
Definition btGImpactShape.h:851
btGearConstraint
The btGeatConstraint will couple the angular velocity for two bodies around given local axis and rati...
Definition btGearConstraint.h:32
btGeneric6DofConstraint
btGeneric6DofConstraint between two rigidbodies each with a pivotpoint that descibes the axis locatio...
Definition btGeneric6DofConstraint.h:268
btGeneric6DofSpringConstraint
Generic 6 DOF constraint that allows to set spring motors to any translational and rotational DOF.
Definition btGeneric6DofSpringConstraint.h:43
btHashMap
The btHashMap template class implements a generic and lightweight hashmap.
Definition btHashMap.h:220
btHingeConstraint
hinge constraint between two rigidbodies each with a pivotpoint that descibes the axis location in lo...
Definition btHingeConstraint.h:49
btMultiSphereShape
The btMultiSphereShape represents the convex hull of a collection of spheres.
Definition btMultiSphereShape.h:28
btOptimizedBvh
The btOptimizedBvh extends the btQuantizedBvh to create AABB tree for triangle meshes,...
Definition btOptimizedBvh.h:28
btPoint2PointConstraint
point to point constraint between two rigidbodies each with a pivotpoint that descibes the 'ballsocke...
Definition btPoint2PointConstraint.h:54
btScaledBvhTriangleMeshShape
The btScaledBvhTriangleMeshShape allows to instance a scaled version of an existing btBvhTriangleMesh...
Definition btScaledBvhTriangleMeshShape.h:25
btSliderConstraint
Definition btSliderConstraint.h:67
btStridingMeshInterface
The btStridingMeshInterface is the interface class for high performance generic access to triangle me...
Definition btStridingMeshInterface.h:28
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition btTransform.h:30
btTriangleIndexVertexArray
The btTriangleIndexVertexArray allows to access multiple triangle meshes, by indexing into existing t...
Definition btTriangleIndexVertexArray.h:67
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition btVector3.h:82
btBulletSerializedArrays
Definition btSerializer.h:134
btCollisionShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition btCollisionShape.h:163
btContactSolverInfo
Definition btContactSolverInfo.h:76
btStridingMeshInterfaceData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition btStridingMeshInterface.h:139
btTriangleInfoMap
The btTriangleInfoMap stores edge angle information for some triangles. You can compute this informat...
Definition btTriangleInfoMap.h:54