Bullet Collision Detection & Physics Library
btCollisionWorldImporter.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2014 Erwin Coumans http://bulletphysics.org
4 
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10 
11 1. 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.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15 
16 
17 #ifndef BT_COLLISION_WORLD_IMPORTER_H
18 #define BT_COLLISION_WORLD_IMPORTER_H
19 
20 #include "LinearMath/btTransform.h"
21 #include "LinearMath/btVector3.h"
23 #include "LinearMath/btHashMap.h"
24 
25 class btCollisionShape;
26 class btCollisionObject;
28 
29 
30 struct ConstraintInput;
31 class btCollisionWorld;
36 class btGImpactMeshShape;
37 class btOptimizedBvh;
38 struct btTriangleInfoMap;
41 class btHingeConstraint;
45 class btSliderConstraint;
46 class btGearConstraint;
47 struct btContactSolverInfo;
48 
49 
50 
51 
53 {
54 protected:
56 
58 
61 
67 
68 
70 
74 
77 
78 
81 
84 
86 
89 
90 
91  //methods
92 
93 
94 
95  char* duplicateName(const char* name);
96 
98 
99 
100 public:
101 
103 
104  virtual ~btCollisionWorldImporter();
105 
107 
110  virtual void deleteAllData();
111 
112  void setVerboseMode(int verboseMode)
113  {
114  m_verboseMode = verboseMode;
115  }
116 
117  int getVerboseMode() const
118  {
119  return m_verboseMode;
120  }
121 
122  // query for data
123  int getNumCollisionShapes() const;
125  int getNumRigidBodies() const;
126  btCollisionObject* getRigidBodyByIndex(int index) const;
127 
128  int getNumBvhs() const;
129  btOptimizedBvh* getBvhByIndex(int index) const;
130  int getNumTriangleInfoMaps() const;
132 
133  // queris involving named objects
134  btCollisionShape* getCollisionShapeByName(const char* name);
135  btCollisionObject* getCollisionObjectByName(const char* name);
136 
137 
138  const char* getNameForPointer(const void* ptr) const;
139 
141 
142 
143 
144  //bodies
145 
146  virtual btCollisionObject* createCollisionObject( const btTransform& startTransform, btCollisionShape* shape,const char* bodyName);
147 
149 
150  virtual btCollisionShape* createPlaneShape(const btVector3& planeNormal,btScalar planeConstant);
151  virtual btCollisionShape* createBoxShape(const btVector3& halfExtents);
153  virtual btCollisionShape* createCapsuleShapeX(btScalar radius, btScalar height);
154  virtual btCollisionShape* createCapsuleShapeY(btScalar radius, btScalar height);
155  virtual btCollisionShape* createCapsuleShapeZ(btScalar radius, btScalar height);
156 
157  virtual btCollisionShape* createCylinderShapeX(btScalar radius,btScalar height);
158  virtual btCollisionShape* createCylinderShapeY(btScalar radius,btScalar height);
159  virtual btCollisionShape* createCylinderShapeZ(btScalar radius,btScalar height);
160  virtual btCollisionShape* createConeShapeX(btScalar radius,btScalar height);
161  virtual btCollisionShape* createConeShapeY(btScalar radius,btScalar height);
162  virtual btCollisionShape* createConeShapeZ(btScalar radius,btScalar height);
166 #ifdef SUPPORT_GIMPACT_SHAPE_IMPORT
167  virtual btGImpactMeshShape* createGimpactShape(btStridingMeshInterface* trimesh);
168 #endif //SUPPORT_GIMPACT_SHAPE_IMPORT
170 
171  virtual class btConvexHullShape* createConvexHullShape();
172  virtual class btCompoundShape* createCompoundShape();
173  virtual class btScaledBvhTriangleMeshShape* createScaledTrangleMeshShape(btBvhTriangleMeshShape* meshShape,const btVector3& localScalingbtBvhTriangleMeshShape);
174 
175  virtual class btMultiSphereShape* createMultiSphereShape(const btVector3* positions,const btScalar* radi,int numSpheres);
176 
178 
182 
183 
184 
185 
186 };
187 
188 
189 #endif //BT_WORLD_IMPORTER_H
btAlignedObjectArray< btTriangleIndexVertexArray * > m_allocatedTriangleIndexArrays
point to point constraint between two rigidbodies each with a pivotpoint that descibes the &#39;ballsocke...
btAlignedObjectArray< btCollisionShape * > m_allocatedCollisionShapes
virtual btOptimizedBvh * createOptimizedBvh()
acceleration and connectivity structures
btCollisionObject * getRigidBodyByIndex(int index) const
btHashMap< btHashPtr, btTriangleInfoMap * > m_timMap
btAlignedObjectArray< int * > m_indexArrays
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)
virtual btCollisionShape * createCylinderShapeZ(btScalar radius, btScalar height)
btAlignedObjectArray< btVector3DoubleData * > m_doubleVertexArrays
virtual btCollisionShape * createCylinderShapeX(btScalar radius, btScalar height)
char * duplicateName(const char *name)
virtual btTriangleInfoMap * createTriangleInfoMap()
The btGeatConstraint will couple the angular velocity for two bodies around given local axis and rati...
The btMultiSphereShape represents the convex hull of a collection of spheres.
btGeneric6DofConstraint between two rigidbodies each with a pivotpoint that descibes the axis locatio...
virtual btCollisionShape * createSphereShape(btScalar radius)
btAlignedObjectArray< btStridingMeshInterfaceData * > m_allocatedbtStridingMeshInterfaceDatas
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
virtual btCollisionShape * createCapsuleShapeX(btScalar radius, btScalar height)
virtual class btConvexHullShape * createConvexHullShape()
This class manages a mesh supplied by the btStridingMeshInterface interface.
const char * getNameForPointer(const void *ptr) const
virtual btCollisionShape * createPlaneShape(const btVector3 &planeNormal, btScalar planeConstant)
shapes
hinge constraint between two rigidbodies each with a pivotpoint that descibes the axis location in lo...
btHashMap< btHashString, btCollisionObject * > m_nameColObjMap
virtual btBvhTriangleMeshShape * createBvhTriangleMeshShape(btStridingMeshInterface *trimesh, btOptimizedBvh *bvh)
btHashMap< btHashPtr, btCollisionObject * > m_bodyMap
btAlignedObjectArray< char * > m_allocatedNames
btTriangleInfoMap * getTriangleInfoMapByIndex(int index) const
btAlignedObjectArray< unsigned char * > m_charIndexArrays
void setVerboseMode(int verboseMode)
The btBvhTriangleMeshShape is a static-triangle mesh shape, it can only be used for fixed/non-moving ...
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
virtual class btCompoundShape * createCompoundShape()
The btTriangleIndexVertexArray allows to access multiple triangle meshes, by indexing into existing t...
virtual btCollisionShape * createCapsuleShapeZ(btScalar radius, btScalar height)
virtual class btScaledBvhTriangleMeshShape * createScaledTrangleMeshShape(btBvhTriangleMeshShape *meshShape, const btVector3 &localScalingbtBvhTriangleMeshShape)
btCollisionShape * convertCollisionShape(btCollisionShapeData *shapeData)
btCollisionObject can be used to manage collision detection objects.
btAlignedObjectArray< btVector3FloatData * > m_floatVertexArrays
The btOptimizedBvh extends the btQuantizedBvh to create AABB tree for triangle meshes, through the btStridingMeshInterface.
btAlignedObjectArray< btCollisionObject * > m_allocatedRigidBodies
btHashMap< btHashPtr, btCollisionShape * > m_shapeMap
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:83
btHashMap< btHashString, btCollisionShape * > m_nameShapeMap
btAlignedObjectArray< btCollisionObject * > m_allocatedCollisionObjects
btHashMap< btHashPtr, const char * > m_objectNameMap
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:34
btConeTwistConstraint can be used to simulate ragdoll joints (upper arm, leg etc) ...
The btStridingMeshInterface is the interface class for high performance generic access to triangle me...
CollisionWorld is interface and container for the collision detection.
btCollisionShape * getCollisionShapeByIndex(int index)
virtual btCollisionShape * createConeShapeY(btScalar radius, btScalar height)
virtual btStridingMeshInterfaceData * createStridingMeshInterfaceData(btStridingMeshInterfaceData *interfaceData)
btAlignedObjectArray< btTriangleInfoMap * > m_allocatedTriangleInfoMaps
bool convertAllObjects(btBulletSerializedArrays *arrays)
virtual class btMultiSphereShape * createMultiSphereShape(const btVector3 *positions, const btScalar *radi, int numSpheres)
virtual btCollisionShape * createBoxShape(const btVector3 &halfExtents)
virtual btCollisionShape * createCylinderShapeY(btScalar radius, btScalar height)
virtual class btTriangleIndexVertexArray * createTriangleMeshContainer()
virtual btCollisionShape * createConeShapeZ(btScalar radius, btScalar height)
The btScaledBvhTriangleMeshShape allows to instance a scaled version of an existing btBvhTriangleMesh...
virtual void deleteAllData()
delete all memory collision shapes, rigid bodies, constraints etc.
btHashMap< btHashPtr, btOptimizedBvh * > m_bvhMap
The btConvexHullShape implements an implicit convex hull of an array of vertices. ...
virtual btCollisionShape * createConeShapeX(btScalar radius, btScalar height)
The btTriangleInfoMap stores edge angle information for some triangles. You can compute this informat...
The btCompoundShape allows to store multiple other btCollisionShapes This allows for moving concave c...
btOptimizedBvh * getBvhByIndex(int index) const
btAlignedObjectArray< short int * > m_shortIndexArrays
virtual btCollisionShape * createCapsuleShapeY(btScalar radius, btScalar height)
btCollisionObject * getCollisionObjectByName(const char *name)
Generic 6 DOF constraint that allows to set spring motors to any translational and rotational DOF...
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
btCollisionShape * getCollisionShapeByName(const char *name)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:292
virtual btCollisionShape * createConvexTriangleMeshShape(btStridingMeshInterface *trimesh)
btCollisionWorldImporter(btCollisionWorld *world)
btAlignedObjectArray< btOptimizedBvh * > m_allocatedBvhs