13 #include <BulletCollision/CollisionDispatch/btCollisionObject.h>
14 #include <BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h>
15 #include <BulletCollision/CollisionShapes/btTriangleMesh.h>
20 #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 std::enable_shared_from_this<DtBvhTriangleMeshShape>
83 using Ptr = std::shared_ptr<DtBvhTriangleMeshShape>;
86 bool filterTransparentPolygons =
false);
93 bool isBvhBuilt()
const;
96 int getNumTriangles()
const;
119 virtual void setCollisionShape(btCollisionShape* shape)
override;
122 virtual bool enabled()
const override;
128 virtual double radius()
const override;
142 void operator() (
const osg::Vec3& vec1,
const osg::Vec3& vec2,
const osg::Vec3&
vec3,
bool)
const;
149 void operator() (
const osg::Vec3& vec1,
const osg::Vec3& vec2,
const osg::Vec3&
vec3)
const;
std::vector< std::shared_ptr< makVrv::DtDynamicTerrainFeature > > DynamicFeatures
Definition: bulletUtil.h:53
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:153
tbb::spin_mutex Mutex
Definition: bvhTriangleMeshShape.h:102
Definition: bvhTriangleMeshShape.h:147
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 std::shared_ptr< btCollisionShape > bulletCollisionShape() const =0
Access the underlying bullet collision shape.
virtual bool enabled() const =0
Intersections will ignore this object if this returns false.
Definition: surface.h:181
unsigned int DtTerrainGeometryId
Unique ID numbers that reference a specific geometry (or set of triangles) in the terrain...
Definition: terrainProcessPolygonsBox.h:38
DtBvhTriangleMeshShape::Ptr myShape
Definition: bvhTriangleMeshShape.h:136
Definition: bvhTriangleMeshShape.h:78
std::atomic< bool > myIsBvhBuilt
Definition: bvhTriangleMeshShape.h:108
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:144
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:152
btVector3 myMin
Definition: bvhTriangleMeshShape.h:73
int myTrianglesCount
Definition: bvhTriangleMeshShape.h:107
btVector3 myMax
Definition: bvhTriangleMeshShape.h:74
#define vec3
Definition: DtGlslToDtDefines.h:12
Definition: bvhTriangleMeshShape.h:112
Mutex myMutex
Definition: bvhTriangleMeshShape.h:104
DtTerrainGeometryId DtCollisionShapeId
Definition: bvhTriangleMeshShape.h:25
void operator()(const osg::Vec3 &vec1, const osg::Vec3 &vec2, const osg::Vec3 &vec3) const
Definition: bulletUtil.h:49
virtual DynamicFeatures dynamicFeatures() const =0
Return all the dynamic features which contain this object.
#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:151
std::shared_ptr< DtBvhTriangleMeshShape > Ptr
Definition: bvhTriangleMeshShape.h:83
DtTriangleMeshWithSoil * myMesh
Definition: bvhTriangleMeshShape.h:105
virtual const btTransform & worldTransform() const =0
Access the world transform of the collision object.
btAlignedObjectArray< DtSurface > mySurfaceTypes
Definition: bvhTriangleMeshShape.h:72
Definition: bvhTriangleMeshShape.h:139