Blender V4.3
btBvhTriangleMeshShape.h
Go to the documentation of this file.
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2009 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_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
36{
37 btOptimizedBvh* m_bvh;
39
42#ifdef __clang__
43 bool m_pad[11] __attribute__((unused));
44#else
45 bool m_pad[11];
46#endif
47
48public:
50
51 btBvhTriangleMeshShape(btStridingMeshInterface * meshInterface, bool useQuantizedAabbCompression, bool buildBvh = true);
52
54 btBvhTriangleMeshShape(btStridingMeshInterface * meshInterface, bool useQuantizedAabbCompression, const btVector3& bvhAabbMin, const btVector3& bvhAabbMax, bool buildBvh = true);
55
57
58 bool getOwnsBvh() const
59 {
60 return m_ownsBvh;
61 }
62
63 void performRaycast(btTriangleCallback * callback, const btVector3& raySource, const btVector3& rayTarget);
64 void performConvexcast(btTriangleCallback * callback, const btVector3& boxSource, const btVector3& boxTarget, const btVector3& boxMin, const btVector3& boxMax);
65
66 virtual void processAllTriangles(btTriangleCallback * callback, const btVector3& aabbMin, const btVector3& aabbMax) const;
67
68 void refitTree(const btVector3& aabbMin, const btVector3& aabbMax);
69
71 void partialRefitTree(const btVector3& aabbMin, const btVector3& aabbMax);
72
73 //debugging
74 virtual const char* getName() const { return "BVHTRIANGLEMESH"; }
75
76 virtual void setLocalScaling(const btVector3& scaling);
77
79 {
80 return m_bvh;
81 }
82
83 void setOptimizedBvh(btOptimizedBvh * bvh, const btVector3& localScaling = btVector3(1, 1, 1));
84
85 void buildOptimizedBvh();
86
91
92 void setTriangleInfoMap(btTriangleInfoMap * triangleInfoMap)
93 {
94 m_triangleInfoMap = triangleInfoMap;
95 }
96
98 {
99 return m_triangleInfoMap;
100 }
101
103 {
104 return m_triangleInfoMap;
105 }
106
107 virtual int calculateSerializeBufferSize() const;
108
110 virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
111
112 virtual void serializeSingleBvh(btSerializer * serializer) const;
113
114 virtual void serializeSingleTriangleInfoMap(btSerializer * serializer) const;
115};
116
117// clang-format off
118
136
137// clang-format on
138
139SIMD_FORCE_INLINE int btBvhTriangleMeshShape::calculateSerializeBufferSize() const
140{
141 return sizeof(btTriangleMeshShapeData);
142}
143
144#endif //BT_BVH_TRIANGLE_MESH_SHAPE_H
virtual void serializeSingleBvh(btSerializer *serializer) const
virtual void setLocalScaling(const btVector3 &scaling)
BT_DECLARE_ALIGNED_ALLOCATOR()
void setTriangleInfoMap(btTriangleInfoMap *triangleInfoMap)
void refitTree(const btVector3 &aabbMin, const btVector3 &aabbMax)
bool m_ownsBvh
void buildOptimizedBvh()
virtual ~btBvhTriangleMeshShape()
virtual int calculateSerializeBufferSize() const
void setOptimizedBvh(btOptimizedBvh *bvh, const btVector3 &localScaling=btVector3(1, 1, 1))
void performRaycast(btTriangleCallback *callback, const btVector3 &raySource, const btVector3 &rayTarget)
const btTriangleInfoMap * getTriangleInfoMap() const
bool usesQuantizedAabbCompression() const
void partialRefitTree(const btVector3 &aabbMin, const btVector3 &aabbMax)
for a fast incremental refit of parts of the tree. Note: the entire AABB of the tree will become more...
virtual const char * getName() const
void performConvexcast(btTriangleCallback *callback, const btVector3 &boxSource, const btVector3 &boxTarget, const btVector3 &boxMin, const btVector3 &boxMax)
btOptimizedBvh * getOptimizedBvh()
virtual void processAllTriangles(btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
virtual void serializeSingleTriangleInfoMap(btSerializer *serializer) const
bool m_pad[11]
btTriangleInfoMap * m_triangleInfoMap
bool m_useQuantizedAabbCompression
virtual const char * serialize(void *dataBuffer, btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
bool getOwnsBvh() const
btBvhTriangleMeshShape(btStridingMeshInterface *meshInterface, bool useQuantizedAabbCompression, bool buildBvh=true)
btOptimizedBvh()
#define ATTRIBUTE_ALIGNED16(a)
Definition btScalar.h:285
#define SIMD_FORCE_INLINE
Definition btScalar.h:280
btStridingMeshInterface
btTriangleMeshShape(btStridingMeshInterface *meshInterface)
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
Definition btVector3.h:82
static __attribute__((constructor)) void cpu_check()
Definition cpu_check.cc:94
DEGForeachIDComponentCallback callback
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
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
btCollisionShapeData m_collisionShapeData
btTriangleInfoMapData * m_triangleInfoMap