13 #include <BulletCollision/CollisionDispatch/btCollisionObject.h>
14 #include <BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h>
15 #include <BulletCollision/CollisionShapes/btTriangleMesh.h>
17 #include <boost/shared_ptr.hpp>
18 #include <boost/enable_shared_from_this.hpp>
22 #include <tbb/spin_mutex.h>
34 bool valid(
const btVector3& vertex0,
const btVector3& vertex1,
const btVector3& vertex2)
const;
35 bool valid(
const btVector3& vertex)
const;
36 bool valid(
const btScalar& val)
const;
38 bool checkAddTriangle(
const btVector3& vertex0,
const btVector3& vertex1,
const btVector3& vertex2,
39 bool removeDuplicateVertices =
false);
41 void addTriangle(
const btVector3& vertex0,
const btVector3& vertex1,
const btVector3& vertex2,
42 bool removeDuplicateVertices =
false);
44 void addTriangleWithSurface(
const btVector3& vertex0,
const btVector3& vertex1,
const btVector3& vertex2,
45 const DtSurface& surface,
bool removeDuplicateVertices =
false);
47 DtSurface triangleSurface(
unsigned int triangleIndex)
const;
49 const btVector3& max()
const;
50 const btVector3& min()
const;
52 bool isAabbValid()
const;
54 double maxDistance()
const;
57 void updateBounds(
const btVector3& val);
61 void initializeSurfaceArray();
65 void syncSurfaceArray();
80 ,
public boost::enable_shared_from_this<DtBvhTriangleMeshShape>
83 using Ptr = boost::shared_ptr<DtBvhTriangleMeshShape>;
87 bool useQuantization =
true,
bool buildBvhNow =
false,
88 bool filterTransparentPolygons =
false);
95 bool isBvhBuilt()
const;
98 int getNumTriangles()
const;
117 void setCollisionShape(btCollisionShape* shape)
override;
126 double radius()
const override;
140 void operator() (
const osg::Vec3& vec1,
const osg::Vec3& vec2,
const osg::Vec3&
vec3,
bool)
const;
147 void operator() (
const osg::Vec3& vec1,
const osg::Vec3& vec2,
const osg::Vec3&
vec3)
const;
virtual double radius() const =0
Returns the maximum distance of all points from the origin of this object.
bool myUseSurfaceArray
When this is false, mySurfaceTypes is empty, and all triangles are considered to have "Unspecified" a...
Definition: bvhTriangleMeshShape.h:71
bool myIsScale
Definition: bvhTriangleMeshShape.h:151
tbb::spin_mutex Mutex
Definition: bvhTriangleMeshShape.h:101
Definition: bvhTriangleMeshShape.h:145
virtual DtSurface triangleSurface(unsigned int triangleIndex) const =0
Return the surface of a triangle at a given index.
A version of btTriangleMesh that also holds soil type for each polygon.
Definition: bvhTriangleMeshShape.h:28
virtual bool enabled() const =0
Intersections will ignore this object if this returns false.
Definition: surface.h:181
DtBvhTriangleMeshShape::Ptr myShape
Definition: bvhTriangleMeshShape.h:134
Definition: bvhTriangleMeshShape.h:78
std::vector< boost::shared_ptr< makVrv::DtDynamicTerrainFeature > > DynamicFeatures
Definition: bulletUtil.h:55
virtual bool isBvhBuilt() const =0
virtual bool buildBvh()=0
Build the bvh with mutex locked. Call as many times as you like, will only build once.
DtTriangleMeshWithSoil * myTriMesh
Definition: bvhTriangleMeshShape.h:142
double myMaxPointDistanceSq
Definition: bvhTriangleMeshShape.h:75
virtual unsigned int numberOfTriangles() const =0
Return number of triangles in this object (ignores instancing).
osg::Vec3d myScale
Definition: bvhTriangleMeshShape.h:150
btVector3 myMin
Definition: bvhTriangleMeshShape.h:73
int myTrianglesCount
Definition: bvhTriangleMeshShape.h:106
btVector3 myMax
Definition: bvhTriangleMeshShape.h:74
#define vec3
Definition: DtGlslToDtDefines.h:12
Definition: bvhTriangleMeshShape.h:110
virtual boost::shared_ptr< btCollisionShape > bulletCollisionShape() const =0
Access the underlying bullet collision shape.
Mutex myMutex
Definition: bvhTriangleMeshShape.h:103
void operator()(const osg::Vec3 &vec1, const osg::Vec3 &vec2, const osg::Vec3 &vec3) const
Definition: bulletUtil.h:51
virtual DynamicFeatures dynamicFeatures() const =0
Return all the dynamic features which contain this object.
tbb::atomic< bool > myIsBvhBuilt
Definition: bvhTriangleMeshShape.h:107
#define DT_DLL_vantageTerrainImplementation
This file is used to determine how to build.
Definition: vantageTerrainImplementationDefines.h:28
void operator()(const osg::Vec3 &vec1, const osg::Vec3 &vec2, const osg::Vec3 &vec3, bool) const
DtSurface mySurface
Definition: bvhTriangleMeshShape.h:149
DtTriangleMeshWithSoil * myMesh
Definition: bvhTriangleMeshShape.h:104
virtual const btTransform & worldTransform() const =0
Access the world transform of the collision object.
btAlignedObjectArray< DtSurface > mySurfaceTypes
Definition: bvhTriangleMeshShape.h:72
Definition: bvhTriangleMeshShape.h:137
boost::shared_ptr< DtBvhTriangleMeshShape > Ptr
Definition: bvhTriangleMeshShape.h:83