18 #include <btBulletCollisionCommon.h>
19 #include <btBulletDynamicsCommon.h>
22 #include <vlutil/vlSmartPointers.h>
23 #include <vlutil/vlFilename.h>
29 #include <osg/NodeVisitor>
30 #include <osg/TextureBuffer>
33 #include <osgEarth/DrawInstanced>
42 #include <osgEarth/MetadataNode>
45 #include <vlutil/vlSmartPointers.h>
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);
96 const osg::Matrix&
matrix()
const;
120 void addDynamicFeature(
const std::shared_ptr<makVrv::DtDynamicTerrainFeature>& feature);
138 static std::shared_ptr<DtSwitchableCollisionObject>
Create();
139 static std::shared_ptr<DtSwitchableCollisionObject>
Create(
long long fid);
141 virtual bool enabled()
const override;
142 void hide(
bool value);
155 typedef std::list<NodeId>
List;
156 explicit NodeId(
size_t hash);
175 virtual void apply(osg::Geode& geode)
override;
176 virtual void apply(osg::Drawable& drawable)
override;
177 virtual void apply(osg::Geometry& geometry)
override;
178 virtual void apply(osg::LOD& node)
override;
179 virtual void apply(osg::PagedLOD& node)
override;
180 virtual void apply(osg::Group& node)
override;
181 virtual void apply(osg::Sequence& node)
override;
182 virtual void apply(osg::Transform& node)
override;
183 virtual void apply(osg::MatrixTransform& node)
override;
184 virtual void apply(osg::Node& node)
override;
190 virtual void setFeature(
const std::shared_ptr<makVrv::DtDynamicTerrainFeature>&
feature)
override;
193 virtual void setState(
unsigned int index)
override;
194 virtual unsigned int getState()
const override;
220 typedef std::list<DtBvhTriangleMeshShape::Ptr>
ShapeList;
266 osg::observer_ptr< osg::TextureBuffer >
myTbo;
285 static std::unique_ptr<DtVrfSimTerrainProcessor> Create();
292 virtual unsigned int numberOfTriangles()
const = 0;
294 virtual void setDefaultSurface(
const DtSurface&) = 0;
295 virtual void setMatrix(
const osg::Matrix&) = 0;
296 virtual void setTraversalMode(osg::NodeVisitor::TraversalMode) = 0;
297 virtual void setVisitorType(osg::NodeVisitor::VisitorType) = 0;
299 virtual void setSurfacesToIgnore(
const std::vector<std::string>&) = 0;
301 virtual void setTreatPagedLODAsLOD(
bool) = 0;
302 virtual void setCheckGeodesForSurfaces(
bool) = 0;
303 virtual void setUseQuantization(
bool) = 0;
304 virtual void setBuildBvhNow(
bool) = 0;
305 virtual void setFilterTransparentPolygons(
bool) = 0;
308 osg::Node*,
const std::string& defaultSoiltype,
bool LoadOnlyActiveSwitchState =
false) = 0;
List myChildNodes
Definition: osgToBullet.h:164
void setConversionFlags(ConvertToBulletVisitor::ConvertToBulletFlags f)
int myNumBulletObjects
Definition: osgToBullet.h:272
std::vector< std::shared_ptr< makVrv::DtDynamicTerrainFeature > > DynamicFeatures
Definition: bulletUtil.h:53
virtual unsigned int getState() const override
Get the current state of the switch.
makVrf::DtSurfaceCharacteristicMapConstPtr mySurfaceCharacteristicMap
Definition: osgToBullet.h:228
long long myFid
Definition: osgToBullet.h:148
std::shared_ptr< const DtSurfaceCharacteristicMap > DtSurfaceCharacteristicMapConstPtr
Definition: surfaceCharacteristicsMap.h:36
ParentStackGuard(osg::Node &node, ConvertToBulletVisitor &visitor)
void createMeshFromDrawables(osg::Geode &geode, DtSurface surface, bool hasValidSurface)
bool myLoadOnlyActiveSwitchState
Definition: osgToBullet.h:238
std::list< NodeId > List
Definition: osgToBullet.h:155
bool ignoreDrawable(osg::Drawable *drawable) const
MatrixStack myMatrixStack
Definition: osgToBullet.h:231
Definition: osgToBullet.h:186
virtual DtSurface convertImageToSurfaceType(osg::StateSet *stateSet, bool &hasValidSurface, bool &ignored)
DtVantageTerrainEngine * myTerrainEngine
Definition: osgToBullet.h:315
HashToNodeIdMap myHashToNodeIdMap
Definition: osgToBullet.h:258
DtSurface myCurrentSurface
Definition: osgToBullet.h:227
std::vector< CollisionObjectVector > CollisionObjectSets
Definition: osgToBullet.h:200
ConvertToBulletFlags myFlags
Definition: osgToBullet.h:236
Definition: osgToBullet.h:78
boost::unordered_map< size_t, NodeId * > HashToNodeIdMap
Definition: osgToBullet.h:257
btVector3 point3
Definition: osgToBullet.h:111
Definition: osgToBullet.h:74
virtual unsigned int getPreviousState() const override
Get the previous state of the switch. Return default (0) if the switch state has never been changed...
unsigned myNumGeodeParents
Definition: osgToBullet.h:237
DynamicFeatureVector myFeatures
Definition: osgToBullet.h:128
std::vector< osg::Drawable * > DrawablesList
Definition: osgToBullet.h:62
size_t getScaleHash(const osg::Vec3d &scale) const
NodeId myRootNodeId
Definition: osgToBullet.h:254
unsigned int DtTerrainInstanceId
Unique ID numbers that reference a specific instance of a set of geometry in the terrain. Each terrain instance references a specific terrain geometry by id, and multiple objects may share the same geometry.
Definition: terrainProcessPolygonsBox.h:41
ConvertToBulletVisitor::ConvertToBulletFlags conversionFlags() const
osg::Matrix myMatrix
Definition: osgToBullet.h:229
void createCollisionObjectFromMesh(std::unique_ptr< DtTriangleMeshWithSoil > &mesh, osg::Node &node, long long fid)
virtual void apply(osg::Geode &geode) override
Apply.
std::vector< std::weak_ptr< makVrv::DtDynamicTerrainFeature > > DynamicFeatureVector
Definition: osgToBullet.h:127
ConvertToBulletVisitor(DtVantageTerrainEngine *terrainEngine, osg::NodeVisitor::VisitorType visitorType=NodeVisitor::INTERSECTION_VISITOR, osg::NodeVisitor::TraversalMode traverseMode=TRAVERSE_ALL_CHILDREN)
NodeToShapeMap myNodeToShapeMap
Definition: osgToBullet.h:226
Definition: osgToBullet.h:79
void setIgnoreSurfacesMatching(const std::vector< std::string > &ignoreSurfacesMatching)
DtSurface convertFilenameToSurface(const std::string &fname, int &position, int &matchClass, bool &ignored)
Definition: osgToBullet.h:152
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:107
osgEarth::MetadataNode * myMetadataNode
Store the metadata node currently visiting.
Definition: osgToBullet.h:264
void incrementDisabledCounter()
virtual std::shared_ptr< DtDynamicTerrainFeature > feature() const
virtual ~ConvertToBulletVisitor() override
NodeToNodeIdMap myNodeToNodeIdMap
Definition: osgToBullet.h:261
ConvertToBulletVisitor & myVisitor
Definition: osgToBullet.h:248
btVector3 point1
Definition: osgToBullet.h:109
Contains makVrv::DtDynamicTerrainStateManipulatorFactory class.
btVector3 point2
Definition: osgToBullet.h:110
bool myHidden
Definition: osgToBullet.h:149
std::map< size_t, ShapeList > ScaledInstanceShapeMap
Definition: osgToBullet.h:221
Definition: coordSystem.h:54
void addCollisionObject(const std::shared_ptr< btCollisionObject > &obj)
virtual void setFeature(const std::shared_ptr< makVrv::DtDynamicTerrainFeature > &feature) override
Definition: osgToBullet.h:241
void addObjectToStateState(unsigned int index, const std::shared_ptr< btCollisionObject > &obj)
virtual DtSurface getCurrentSurfaceFromSMCFID(osg::Node &node, bool &hasValidSurface)
void setDefaultSoiltype(const std::string &defaultSoiltype)
Definition: osgToBullet.h:132
DtCollisionObjectList myObjects
Definition: osgToBullet.h:163
NodeId * addChild(size_t hash)
std::multimap< long long, BtTriangle > Fid2BttriangleMap
Definition: osgToBullet.h:113
Definition: osgToBullet.h:77
Factory for creating objects which implement some kind of manipulation of the state of dynamically ch...
Definition: DtDynamicTerrainStateManipulatorFactory.h:64
CollisionObjectSets myObjects
Definition: osgToBullet.h:202
DtTerrainInstanceId myObjectId
Definition: osgToBullet.h:129
std::unordered_map< osg::Node *, ScaledInstanceShapeMap > NodeToShapeMap
Definition: osgToBullet.h:222
DtTerrainInstanceId objectId() const
int myNumTriangles
Definition: osgToBullet.h:270
DtVantageTerrainEngine * myTerrainEngine
Definition: osgToBullet.h:224
void popMatrix()
Definition: osgToBullet.h:233
const List & children() const
int myNumScaledGeometries
Definition: osgToBullet.h:273
void getCollisionObjects(DtCollisionObjectList &objs)
void addObjectsToStateState(unsigned int index, DtCollisionObjectList &objects)
std::list< DtBvhTriangleMeshShape::Ptr > ShapeList
Definition: osgToBullet.h:220
Definition: bvhTriangleMeshShape.h:112
int myNumDrawables
Definition: osgToBullet.h:269
void setFlagsFor(ConvertToBulletFlags flags, bool val)
virtual void getCurrentSurface(osg::Group &node)
Bullet triangle.
Definition: osgToBullet.h:107
NodeId * myCurrentParentNodeId
Definition: osgToBullet.h:255
virtual makVrv::DtDynamicTerrainSwitch * createSwitch(const osg::ref_ptr< osgSim::MultiSwitch > &mswitch) override
Create a DtDynamicTerrainSwitch which manipulates the supplied multiswitch.
virtual DynamicFeatures dynamicFeatures() const override
Return all the dynamic features which contain this object.
void setSurfaceCharMap(makVrf::DtSurfaceCharacteristicMapConstPtr surfCharMap)
ConvertToBulletFlags
Definition: osgToBullet.h:72
Contains makVrv::DtSceneRoot class.
virtual unsigned int numStates() const
void setLoadOnlyActiveSwitchState(bool value)
DtSwitchableCollisionObject()
static std::atomic< unsigned int > theLastId
Definition: osgToBullet.h:125
std::list< std::shared_ptr< btCollisionObject > > DtCollisionObjectList
Definition: bulletUtil.h:47
#define DT_DLL_vantageTerrainImplementation
This file is used to determine how to build.
Definition: vantageTerrainImplementationDefines.h:28
Contains makVrv::DtDynamicTerrainWorld class.
std::vector< std::shared_ptr< DtSwitchableCollisionObject > > CollisionObjectVector
Definition: osgToBullet.h:199
Note: The implementation of this processor class can be found in osgToBullet.cxx (class called DtVrfS...
Definition: osgToBullet.h:281
void addDynamicFeature(const std::shared_ptr< makVrv::DtDynamicTerrainFeature > &feature)
Feature Insertion/Removal/Paging Features represent parts of the terrain which are individually ident...
Definition: DtDynamicTerrainWorld.h:97
std::atomic< unsigned int > myDisabledCounter
Definition: osgToBullet.h:147
void createMeshForDrawables(const DtSurface &surface, const DrawablesList &drawables, osg::Node &node)
int myNumBulletShapes
Definition: osgToBullet.h:271
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:112
Definition: osgToBullet.h:75
const osg::Matrix & matrix() const
virtual bool enabled() const override
Intersections will ignore this object if this returns false.
size_t myHash
Definition: osgToBullet.h:165
std::vector< boost::regex > myIgnoreRegexSurfacesMatching
Definition: osgToBullet.h:235
int myCurrentState
Definition: osgToBullet.h:203
Contains makVrv::DtOsgRenderer class.
ConvertToBulletVisitor.
Definition: osgToBullet.h:67
virtual void setState(unsigned int index) override
Set the current state of the switch (0 indexed).
void setDefaultSurface(const DtSurface &surface)
void setMatrix(const osg::Matrix &matrix)
unsigned int myPreviousState
Definition: osgToBullet.h:204
std::string myDefaultSoiltype
Definition: osgToBullet.h:239
void getAllCollisionObjects(DtCollisionObjectList &objs) const
void pushMatrix(osg::Matrix &matrix)
Definition: osgToBullet.h:232
Definition: osgToBullet.h:76
static std::shared_ptr< DtSwitchableCollisionObject > Create()
Definition: osgToBullet.h:115
std::vector< osg::Matrix > MatrixStack
Definition: osgToBullet.h:213
osg::observer_ptr< osg::TextureBuffer > myTbo
TBO to look up instance ids.
Definition: osgToBullet.h:266
bool loadOnlyActiveSwitchState() const
boost::unordered_map< osg::Node *, NodeId * > NodeToNodeIdMap
Definition: osgToBullet.h:260
void decrementDisabledCounter()
void processModelsEncodedInUserdata(osg::Node &node)
NodeId * mySavedParentId
Definition: osgToBullet.h:249
bool hasFlags(ConvertToBulletFlags flags) const