VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
bvhTriangleMeshShape.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2017 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
13 #include <BulletCollision/CollisionDispatch/btCollisionObject.h>
14 #include <BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h>
15 #include <BulletCollision/CollisionShapes/btTriangleMesh.h>
16 
17 #include <boost/shared_ptr.hpp>
18 #include <boost/enable_shared_from_this.hpp>
19 
20 #include <tbb/spin_mutex.h>
21 
22 class DtSurface;
23 class btVector3;
24 
27 {
28 public:
29  DtTriangleMeshWithSoil(bool use32bitIndices = true, bool use4componentVertices = true);
30  virtual ~DtTriangleMeshWithSoil();
31 
32  bool valid(const btVector3& vertex0, const btVector3& vertex1, const btVector3& vertex2) const;
33  bool valid(const btVector3& vertex) const;
34  bool valid(const btScalar& val) const;
35 
36  bool checkAddTriangle(const btVector3& vertex0, const btVector3& vertex1, const btVector3& vertex2,
37  bool removeDuplicateVertices = false);
38 
39  void addTriangle(const btVector3& vertex0, const btVector3& vertex1, const btVector3& vertex2,
40  bool removeDuplicateVertices = false);
41 
42  void addTriangleWithSurface(const btVector3& vertex0, const btVector3& vertex1, const btVector3& vertex2,
43  const DtSurface& surface, bool removeDuplicateVertices = false);
44 
45  DtSurface triangleSurface(unsigned int triangleIndex) const;
46 
47  const btVector3& max() const;
48  const btVector3& min() const;
49 
50  bool isAabbValid() const;
51 
52  double maxDistance() const;
53 
54 protected:
55  void updateBounds(const btVector3& val);
56 
59  void initializeSurfaceArray();
60 
63  void syncSurfaceArray();
64 
70  btAlignedObjectArray<DtSurface> mySurfaceTypes;
71  btVector3 myMin;
72  btVector3 myMax;
74 };
75 
77  : public btBvhTriangleMeshShape
78  , public boost::enable_shared_from_this<DtBvhTriangleMeshShape>
79 {
80 public:
81  typedef boost::shared_ptr<DtBvhTriangleMeshShape> Ptr;
82 
85  bool useQuantization = true, bool buildBvhNow = false,
86  bool filterTransparentPolygons = false);
87 
89 
92  bool buildBvh();
93 
94 private:
95  typedef tbb::spin_mutex Mutex;
96 
97  mutable Mutex myMutex;
99 };
100 
102  : public btCollisionObject
104 {
105 public:
107 
108  void setCollisionShape(btCollisionShape* shape);
109 
110  bool buildBvh();
111  bool enabled() const;
112 
113  boost::shared_ptr<btCollisionShape> bulletCollisionShape() const;
114 
115  unsigned int numberOfTriangles() const;
116  double radius() const;
117  DtSurface triangleSurface(unsigned int triangleIndex) const;
118 
120 
121 protected:
123 };

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)