18 #include <btBulletCollisionCommon.h>
19 #include <btBulletDynamicsCommon.h>
22 #include <vlutil/vlSmartPointers.h>
23 #include <vlutil/vlFilename.h>
28 #include <osg/NodeVisitor>
29 #include <osg/TextureBuffer>
32 #include <osgEarth/DrawInstanced>
41 #include <osgEarth/MetadataNode>
44 #include <vlutil/vlSmartPointers.h>
49 #include <boost/shared_ptr.hpp>
50 #include <boost/regex.hpp>
68 :
public osg::NodeVisitor
83 osg::NodeVisitor::VisitorType visitorType = NodeVisitor::INTERSECTION_VISITOR,
84 osg::NodeVisitor::TraversalMode traverseMode = TRAVERSE_ALL_CHILDREN);
95 const osg::Matrix&
matrix()
const;
117 void addDynamicFeature(
const boost::shared_ptr<makVrv::DtDynamicTerrainFeature>& feature);
131 static boost::shared_ptr<DtSwitchableCollisionObject>
Create();
132 static boost::shared_ptr<DtSwitchableCollisionObject>
Create(
long long fid);
135 void hide(
bool value);
148 typedef std::list<NodeId>
List;
149 explicit NodeId(
size_t hash);
168 virtual void apply(osg::Geode& geode)
override;
169 virtual void apply(osg::Drawable& drawable)
override;
170 virtual void apply(osg::Geometry& geometry)
override;
171 virtual void apply(osg::LOD& node)
override;
172 virtual void apply(osg::PagedLOD& node)
override;
173 virtual void apply(osg::Group& node)
override;
174 virtual void apply(osg::Sequence& node)
override;
175 virtual void apply(osg::Transform& node)
override;
176 virtual void apply(osg::MatrixTransform& node)
override;
177 virtual void apply(osg::Node& node)
override;
183 void setFeature(
const boost::shared_ptr<makVrv::DtDynamicTerrainFeature>&
feature);
186 virtual void setState(
unsigned int index);
187 virtual unsigned int getState()
const;
212 typedef std::list<DtBvhTriangleMeshShape::Ptr>
ShapeList;
257 osg::observer_ptr< osg::TextureBuffer >
myTbo;
276 static std::auto_ptr<DtVrfSimTerrainProcessor> Create();
283 virtual unsigned int numberOfTriangles()
const = 0;
285 virtual void setDefaultSurface(
const DtSurface&) = 0;
286 virtual void setMatrix(
const osg::Matrix&) = 0;
287 virtual void setTraversalMode(osg::NodeVisitor::TraversalMode) = 0;
288 virtual void setVisitorType(osg::NodeVisitor::VisitorType) = 0;
290 virtual void setSurfacesToIgnore(
const std::vector<std::string>&) = 0;
292 virtual void setTreatPagedLODAsLOD(
bool) = 0;
293 virtual void setCheckGeodesForSurfaces(
bool) = 0;
294 virtual void setUseQuantization(
bool) = 0;
295 virtual void setBuildBvhNow(
bool) = 0;
296 virtual void setFilterTransparentPolygons(
bool) = 0;
List myChildNodes
Definition: osgToBullet.h:157
void setConversionFlags(ConvertToBulletVisitor::ConvertToBulletFlags f)
int myNumBulletObjects
Definition: osgToBullet.h:263
makVrf::DtSurfaceCharacteristicMapConstPtr mySurfaceCharacteristicMap
Definition: osgToBullet.h:220
long long myFid
Definition: osgToBullet.h:141
ParentStackGuard(osg::Node &node, ConvertToBulletVisitor &visitor)
void createMeshFromDrawables(osg::Geode &geode, DtSurface surface, bool hasValidSurface)
bool myLoadOnlyActiveSwitchState
Definition: osgToBullet.h:230
std::list< NodeId > List
Definition: osgToBullet.h:148
bool ignoreDrawable(osg::Drawable *drawable) const
MatrixStack myMatrixStack
Definition: osgToBullet.h:223
bool enabled() const
Intersections will ignore this object if this returns false.
Definition: osgToBullet.h:179
virtual DtSurface convertImageToSurfaceType(osg::StateSet *stateSet, bool &hasValidSurface, bool &ignored)
DtVantageTerrainEngine * myTerrainEngine
Definition: osgToBullet.h:305
HashToNodeIdMap myHashToNodeIdMap
Definition: osgToBullet.h:249
DtSurface myCurrentSurface
Definition: osgToBullet.h:219
std::vector< CollisionObjectVector > CollisionObjectSets
Definition: osgToBullet.h:193
ConvertToBulletFlags myFlags
Definition: osgToBullet.h:228
Definition: osgToBullet.h:78
boost::unordered_map< size_t, NodeId * > HashToNodeIdMap
Definition: osgToBullet.h:248
makVrv::DtDynamicTerrainSwitch * createSwitch(const osg::ref_ptr< osgSim::MultiSwitch > &mswitch)
Create a DtDynamicTerrainSwitch which manipulates the supplied multiswitch.
btVector3 point3
Definition: osgToBullet.h:110
Definition: osgToBullet.h:74
unsigned myNumGeodeParents
Definition: osgToBullet.h:229
DynamicFeatureVector myFeatures
Definition: osgToBullet.h:122
std::vector< osg::Drawable * > DrawablesList
Definition: osgToBullet.h:62
size_t getScaleHash(const osg::Vec3d &scale) const
NodeId myRootNodeId
Definition: osgToBullet.h:245
ConvertToBulletVisitor::ConvertToBulletFlags conversionFlags() const
osg::Matrix myMatrix
Definition: osgToBullet.h:221
virtual void apply(osg::Geode &geode) override
Apply.
virtual unsigned int getPreviousState() const
Get the previous state of the switch. Return default (0) if the switch state has never been changed...
void setFeature(const boost::shared_ptr< makVrv::DtDynamicTerrainFeature > &feature)
ConvertToBulletVisitor(DtVantageTerrainEngine *terrainEngine, osg::NodeVisitor::VisitorType visitorType=NodeVisitor::INTERSECTION_VISITOR, osg::NodeVisitor::TraversalMode traverseMode=TRAVERSE_ALL_CHILDREN)
NodeToShapeMap myNodeToShapeMap
Definition: osgToBullet.h:218
Definition: osgToBullet.h:79
void setIgnoreSurfacesMatching(const std::vector< std::string > &ignoreSurfacesMatching)
DtSurface convertFilenameToSurface(const std::string &fname, int &position, int &matchClass, bool &ignored)
virtual boost::shared_ptr< DtDynamicTerrainFeature > feature() const
void createCollisionObjectFromMesh(std::auto_ptr< DtTriangleMeshWithSoil > &mesh, osg::Node &node, long long fid)
Definition: osgToBullet.h:145
Definition: surface.h:181
virtual bool createGeometryFromCache(osg::Node &node)
void collectInstanceTriangles(osgEarth::DrawInstanced::InstanceGeometry *instancedGeometry, Fid2BttriangleMap &geometryMap)
State switch. This is an interface for manipulating a switch. A switch in this context is defined as ...
Definition: DtDynamicTerrainStateManipulatorFactory.h:110
osgEarth::MetadataNode * myMetadataNode
Store the metadata node currently visiting.
Definition: osgToBullet.h:255
void incrementDisabledCounter()
std::vector< boost::shared_ptr< DtSwitchableCollisionObject > > CollisionObjectVector
Definition: osgToBullet.h:192
std::vector< boost::shared_ptr< makVrv::DtDynamicTerrainFeature > > DynamicFeatures
Definition: bulletUtil.h:55
DtBoost::shared_ptr< const DtSurfaceCharacteristicMap > DtSurfaceCharacteristicMapConstPtr
Definition: surfaceCharacteristicsMap.h:31
NodeToNodeIdMap myNodeToNodeIdMap
Definition: osgToBullet.h:252
ConvertToBulletVisitor & myVisitor
Definition: osgToBullet.h:239
btVector3 point1
Definition: osgToBullet.h:108
Contains makVrv::DtDynamicTerrainStateManipulatorFactory class.
btVector3 point2
Definition: osgToBullet.h:109
bool myHidden
Definition: osgToBullet.h:142
std::map< size_t, ShapeList > ScaledInstanceShapeMap
Definition: osgToBullet.h:213
Definition: coordSystem.h:54
Definition: osgToBullet.h:232
virtual DtSurface getCurrentSurfaceFromSMCFID(osg::Node &node, bool &hasValidSurface)
Definition: osgToBullet.h:125
DtCollisionObjectList myObjects
Definition: osgToBullet.h:156
NodeId * addChild(size_t hash)
std::multimap< long long, BtTriangle > Fid2BttriangleMap
Definition: osgToBullet.h:112
Definition: osgToBullet.h:77
Factory for creating objects which implement some kind of manipulation of the state of dynamically ch...
Definition: DtDynamicTerrainStateManipulatorFactory.h:67
CollisionObjectSets myObjects
Definition: osgToBullet.h:195
std::unordered_map< osg::Node *, ScaledInstanceShapeMap > NodeToShapeMap
Definition: osgToBullet.h:214
int myNumTriangles
Definition: osgToBullet.h:261
DtVantageTerrainEngine * myTerrainEngine
Definition: osgToBullet.h:216
void popMatrix()
Definition: osgToBullet.h:225
DynamicFeatures dynamicFeatures() const
Return all the dynamic features which contain this object.
const List & children() const
static boost::shared_ptr< DtSwitchableCollisionObject > Create()
int myNumScaledGeometries
Definition: osgToBullet.h:264
void getCollisionObjects(DtCollisionObjectList &objs)
void addObjectsToStateState(unsigned int index, DtCollisionObjectList &objects)
std::list< DtBvhTriangleMeshShape::Ptr > ShapeList
Definition: osgToBullet.h:212
Definition: bvhTriangleMeshShape.h:110
int myNumDrawables
Definition: osgToBullet.h:260
void setFlagsFor(ConvertToBulletFlags flags, bool val)
virtual void getCurrentSurface(osg::Group &node)
~ConvertToBulletVisitor()
Bullet triangle.
Definition: osgToBullet.h:106
tbb::atomic< unsigned int > myDisabledCounter
Definition: osgToBullet.h:140
NodeId * myCurrentParentNodeId
Definition: osgToBullet.h:246
void addCollisionObject(const boost::shared_ptr< btCollisionObject > &obj)
std::vector< boost::weak_ptr< makVrv::DtDynamicTerrainFeature > > DynamicFeatureVector
Definition: osgToBullet.h:121
virtual void setState(unsigned int index)
Set the current state of the switch (0 indexed).
void setSurfaceCharMap(makVrf::DtSurfaceCharacteristicMapConstPtr surfCharMap)
ConvertToBulletFlags
Definition: osgToBullet.h:72
Contains makVrv::DtSceneRoot class.
virtual unsigned int numStates() const
void setLoadOnlyActiveSwitchState(bool value)
DtSwitchableCollisionObject()
#define DT_DLL_vantageTerrainImplementation
This file is used to determine how to build.
Definition: vantageTerrainImplementationDefines.h:28
void addDynamicFeature(const boost::shared_ptr< makVrv::DtDynamicTerrainFeature > &feature)
Contains makVrv::DtDynamicTerrainWorld class.
Note: The implementation of this processor class can be found in osgToBullet.cxx (class called DtVrfS...
Definition: osgToBullet.h:272
void addObjectToStateState(unsigned int index, const boost::shared_ptr< btCollisionObject > &obj)
Feature Insertion/Removal/Paging Features represent parts of the terrain which are individually ident...
Definition: DtDynamicTerrainWorld.h:99
virtual unsigned int getState() const
Get the current state of the switch.
void createMeshForDrawables(const DtSurface &surface, const DrawablesList &drawables, osg::Node &node)
int myNumBulletShapes
Definition: osgToBullet.h:262
This class wraps the VR-Vantage Display Engine, and uses as a terrain loader and intersector. This is the terrain engine that powers the DtVantageTerrainImplementation. The DtVantageTerrainEngine runs the DtDe it its own thread, and processes commands thought the command queue.
Definition: vantageTerrainEngine.h:109
Definition: osgToBullet.h:75
const osg::Matrix & matrix() const
size_t myHash
Definition: osgToBullet.h:158
std::vector< boost::regex > myIgnoreRegexSurfacesMatching
Definition: osgToBullet.h:227
int myCurrentState
Definition: osgToBullet.h:196
Contains makVrv::DtOsgRenderer class.
ConvertToBulletVisitor.
Definition: osgToBullet.h:67
void setDefaultSurface(const DtSurface &surface)
void setMatrix(const osg::Matrix &matrix)
std::list< boost::shared_ptr< btCollisionObject > > DtCollisionObjectList
Definition: bulletUtil.h:49
unsigned int myPreviousState
Definition: osgToBullet.h:197
void getAllCollisionObjects(DtCollisionObjectList &objs) const
void pushMatrix(osg::Matrix &matrix)
Definition: osgToBullet.h:224
Definition: osgToBullet.h:76
Definition: osgToBullet.h:114
std::vector< osg::Matrix > MatrixStack
Definition: osgToBullet.h:205
osg::observer_ptr< osg::TextureBuffer > myTbo
TBO to look up instance ids.
Definition: osgToBullet.h:257
bool loadOnlyActiveSwitchState() const
boost::unordered_map< osg::Node *, NodeId * > NodeToNodeIdMap
Definition: osgToBullet.h:251
void decrementDisabledCounter()
void processModelsEncodedInUserdata(osg::Node &node)
NodeId * mySavedParentId
Definition: osgToBullet.h:240
bool hasFlags(ConvertToBulletFlags flags) const