btBvhTriangleMeshShape.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef BVH_TRIANGLE_MESH_SHAPE_H
00017 #define BVH_TRIANGLE_MESH_SHAPE_H
00018
00019 #include "btTriangleMeshShape.h"
00020 #include "btOptimizedBvh.h"
00021 #include "LinearMath/btAlignedAllocator.h"
00022
00023
00028 class btBvhTriangleMeshShape : public btTriangleMeshShape
00029 {
00030
00031 btOptimizedBvh* m_bvh;
00032 bool m_useQuantizedAabbCompression;
00033 bool m_ownsBvh;
00034 bool m_pad[11];
00035
00036 public:
00037
00038 BT_DECLARE_ALIGNED_ALLOCATOR();
00039
00040 btBvhTriangleMeshShape() : btTriangleMeshShape(0),m_bvh(0),m_ownsBvh(false) {m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;};
00041 btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh = true);
00042
00044 btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btVector3& bvhAabbMax, bool buildBvh = true);
00045
00046 virtual ~btBvhTriangleMeshShape();
00047
00048 bool getOwnsBvh () const
00049 {
00050 return m_ownsBvh;
00051 }
00052
00053
00054
00055 void performRaycast (btTriangleCallback* callback, const btVector3& raySource, const btVector3& rayTarget);
00056 void performConvexcast (btTriangleCallback* callback, const btVector3& boxSource, const btVector3& boxTarget, const btVector3& boxMin, const btVector3& boxMax);
00057
00058 virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
00059
00060 void refitTree(const btVector3& aabbMin,const btVector3& aabbMax);
00061
00063 void partialRefitTree(const btVector3& aabbMin,const btVector3& aabbMax);
00064
00065
00066 virtual const char* getName()const {return "BVHTRIANGLEMESH";}
00067
00068
00069 virtual void setLocalScaling(const btVector3& scaling);
00070
00071 btOptimizedBvh* getOptimizedBvh()
00072 {
00073 return m_bvh;
00074 }
00075
00076
00077 void setOptimizedBvh(btOptimizedBvh* bvh, const btVector3& localScaling=btVector3(1,1,1));
00078
00079 void buildOptimizedBvh();
00080
00081 bool usesQuantizedAabbCompression() const
00082 {
00083 return m_useQuantizedAabbCompression;
00084 }
00085
00086
00087
00089
00090
00091
00092 };
00093
00094 #if 0
00095 struct btBvhTriangleMeshShapeData
00096 {
00097
00098 btTriangleMeshShapeData m_trimeshData;
00099
00100
00101
00102 char m_useQuantizedAabbCompression;
00103 char m_ownsBvh;
00104
00105 };
00106
00107 SIMD_FORCE_INLINE int btBvhTriangleMeshShape::calculateSerializeBufferSize()
00108 {
00109 return sizeof(btBvhTriangleMeshShapeData);
00110 }
00111
00112 #endif
00113
00114 #endif //BVH_TRIANGLE_MESH_SHAPE_H