Bullet Collision Detection & Physics Library
btBvhTriangleMeshShape.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2009 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 #ifndef BT_BVH_TRIANGLE_MESH_SHAPE_H
17 #define BT_BVH_TRIANGLE_MESH_SHAPE_H
18 
19 #include "btTriangleMeshShape.h"
20 #include "btOptimizedBvh.h"
22 #include "btTriangleInfoMap.h"
23 
35 {
36 
39 
41  bool m_ownsBvh;
42 #ifdef __clang__
43  bool m_pad[11] __attribute__((unused));
44 #else
45  bool m_pad[11];
46 #endif
47 
48 public:
49 
51 
52 
53  btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh = true);
54 
56  btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btVector3& bvhAabbMax, bool buildBvh = true);
57 
58  virtual ~btBvhTriangleMeshShape();
59 
60  bool getOwnsBvh () const
61  {
62  return m_ownsBvh;
63  }
64 
65 
66 
67  void performRaycast (btTriangleCallback* callback, const btVector3& raySource, const btVector3& rayTarget);
68  void performConvexcast (btTriangleCallback* callback, const btVector3& boxSource, const btVector3& boxTarget, const btVector3& boxMin, const btVector3& boxMax);
69 
70  virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
71 
72  void refitTree(const btVector3& aabbMin,const btVector3& aabbMax);
73 
75  void partialRefitTree(const btVector3& aabbMin,const btVector3& aabbMax);
76 
77  //debugging
78  virtual const char* getName()const {return "BVHTRIANGLEMESH";}
79 
80 
81  virtual void setLocalScaling(const btVector3& scaling);
82 
84  {
85  return m_bvh;
86  }
87 
88  void setOptimizedBvh(btOptimizedBvh* bvh, const btVector3& localScaling=btVector3(1,1,1));
89 
90  void buildOptimizedBvh();
91 
93  {
94  return m_useQuantizedAabbCompression;
95  }
96 
97  void setTriangleInfoMap(btTriangleInfoMap* triangleInfoMap)
98  {
99  m_triangleInfoMap = triangleInfoMap;
100  }
101 
103  {
104  return m_triangleInfoMap;
105  }
106 
108  {
109  return m_triangleInfoMap;
110  }
111 
112  virtual int calculateSerializeBufferSize() const;
113 
115  virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
116 
117  virtual void serializeSingleBvh(btSerializer* serializer) const;
118 
119  virtual void serializeSingleTriangleInfoMap(btSerializer* serializer) const;
120 
121 };
122 
125 {
127 
129 
132 
134 
136 
137  char m_pad3[4];
138 
139 };
140 
141 
143 {
144  return sizeof(btTriangleMeshShapeData);
145 }
146 
147 
148 
149 #endif //BT_BVH_TRIANGLE_MESH_SHAPE_H
bool usesQuantizedAabbCompression() const
const btTriangleInfoMap * getTriangleInfoMap() const
btCollisionShapeData m_collisionShapeData
#define SIMD_FORCE_INLINE
Definition: btScalar.h:81
btStridingMeshInterfaceData m_meshInterface
btTriangleInfoMapData * m_triangleInfoMap
The btTriangleMeshShape is an internal concave triangle mesh interface. Don't use this class directly...
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 ...
btTriangleInfoMap * m_triangleInfoMap
The btTriangleCallback provides a callback for each overlapping triangle when calling processAllTrian...
virtual int calculateSerializeBufferSize() const
The btOptimizedBvh extends the btQuantizedBvh to create AABB tree for triangle meshes, through the btStridingMeshInterface.
btQuantizedBvhDoubleData * m_quantizedDoubleBvh
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:83
#define ATTRIBUTE_ALIGNED16(a)
Definition: btScalar.h:82
The btStridingMeshInterface is the interface class for high performance generic access to triangle me...
virtual const char * getName() const
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
#define BT_DECLARE_ALIGNED_ALLOCATOR()
Definition: btScalar.h:403
void setTriangleInfoMap(btTriangleInfoMap *triangleInfoMap)
The btTriangleInfoMap stores edge angle information for some triangles. You can compute this informat...
btQuantizedBvhFloatData * m_quantizedFloatBvh
btOptimizedBvh * getOptimizedBvh()
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
btTriangleInfoMap * getTriangleInfoMap()