VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
osgToBullet.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
13 
16 #include <btBulletCollisionCommon.h>
17 #include <btBulletDynamicsCommon.h>
18 #include <memory>
20 #include <vlutil/vlSmartPointers.h>
21 #include <vlutil/vlFilename.h>
22 #include <geometry/surface.h>
23 
25 #include <osg/Matrix>
26 #include <osg/NodeVisitor>
27 #include <vrvOsg/DtOsgRenderer.h>
29 #include <vrvOsg/DtSceneRoot.h>
32 
34 #include <vlutil/vlSmartPointers.h>
35 
37 #include <memory>
38 
39 #include <boost/shared_ptr.hpp>
40 
41 class btTriangleMesh;
42 class Coordinate_System;
44 
45 namespace osg
46 {
47  class Node;
48  class LOD;
49 }
50 
51 typedef std::list< boost::shared_ptr<btCollisionObject> > DtCollisionObjectList;
52 
54 
56 //This should move to surface.h
58 
59 
62 {
63 public:
64  DtTriangleMeshWithSoil (bool use32bitIndices=true, bool use4componentVertices=true);
65  virtual ~DtTriangleMeshWithSoil();
66 
67  bool valid(const btVector3& vertex0,const btVector3& vertex1,const btVector3& vertex2) const;
68  bool valid(const btVector3& vertex) const;
69  bool valid(const btScalar& val) const;
70 
71  bool checkAddTriangle(const btVector3& vertex0,const btVector3& vertex1,const btVector3& vertex2,
72  bool removeDuplicateVertices = false);
73 
74  void addTriangle(const btVector3& vertex0,const btVector3& vertex1,const btVector3& vertex2,
75  bool removeDuplicateVertices = false);
76 
77  void addTriangleWithSurface(const btVector3& vertex0,const btVector3& vertex1,const btVector3& vertex2,
78  const DtSurface& surface, bool removeDuplicateVertices=false);
79 
80  DtSurface triangleSurface(unsigned int triangleIndex) const;
81 
82  const btVector3& max() const;
83  const btVector3& min() const;
84 
85  bool isAabbValid() const;
86 
87 protected:
88  void updateBounds(const btVector3& val);
89 
92  void initializeSurfaceArray();
93 
96  void syncSurfaceArray();
97 
103  btAlignedObjectArray<DtSurface> mySurfaceTypes;
104  btVector3 myMin;
105  btVector3 myMax;
106 };
107 
109 {
110 public:
111  typedef std::vector< boost::shared_ptr<makVrv::DtDynamicTerrainFeature> > DynamicFeatures;
112 
114  virtual ~DtCollisionObjectInterface();
115 
118  virtual bool buildBvh() = 0;
119 
121  virtual bool enabled() const = 0;
122 
124  virtual unsigned int numberOfTriangles() const = 0;
125 
127  virtual DtSurface triangleSurface(unsigned int triangleIndex) const = 0;
128 
130  virtual DynamicFeatures dynamicFeatures() const = 0;
131 };
132 
133 
135 {
136 public:
138  static std::auto_ptr<DtVrfSimTerrainProcessor> Create();
139 
140  static std::auto_ptr<DtVrfSimTerrainProcessor> Create(DtVantageTerrainEngine&);
141 
143  virtual ~DtVrfSimTerrainProcessor();
144 
145  virtual unsigned int numberOfTriangles() const = 0;
146 
147  virtual void setDefaultSurface(const DtSurface&) = 0;
148  virtual void setMatrix(const osg::Matrix&) = 0;
149  virtual void setTraversalMode(osg::NodeVisitor::TraversalMode) = 0;
150  virtual void setSurfaceCharacteristicsFile(const DtFilename&) = 0;
151  virtual void setSurfacesToIgnore(const std::vector<std::string>&) = 0;
152 
153  virtual void setTreatPagedLODAsLOD(bool) = 0;
154  virtual void setCheckGeodesForSurfaces(bool) = 0;
155  virtual void setUseQuantization(bool) = 0;
156  virtual void setBuildBvhNow(bool) = 0;
157  virtual void setFilterTransparentPolygons(bool) = 0;
158 
159  virtual makVrv::DtDynamicTerrainWorld::FeatureHandle createTerrainObjects(osg::Node*) = 0;
160 
161  virtual void getCollisionObjects(DtCollisionObjectList& objs) = 0;
162 
163 protected:
165 
167 };

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)