21 #include <osg/MatrixTransform>
23 #include <osgDB/Options>
25 #include <unordered_map>
27 #define DTHIERARCHICALPAGEDLOD_LOGGING 0
31 class DtOsgCullVisitor;
32 class DtOsgArticulatedModel;
33 class DtModelDefinition;
47 float distanceNear,
float distanceFar,
float tileRadius,
48 float childTileRadius,
const osg::Vec3d& fileCenter,
49 const osg::Vec3d& childrenCenter,
bool sparseChildren,
50 bool substitutiveChildren,
const osg::Matrixd& fileTranslation,
51 osgDB::Options* options, osg::Node* parentMetaflightGroup);
56 virtual const char*
className()
const {
return "DtHierarchicalPagedLod"; }
65 virtual void traverse(osg::NodeVisitor& nv);
68 virtual void traverseAll(osg::NodeVisitor& nv);
71 virtual void traverseActive(osg::NodeVisitor& nv);
75 virtual void cullActive(osg::NodeVisitor& nv);
81 void cullActive3D(osg::NodeVisitor& nv);
84 virtual osg::BoundingSphere computeBound()
const;
88 virtual void traverseFile(osg::NodeVisitor& nv,
float distance);
92 virtual void traverseChildren(osg::NodeVisitor& nv);
95 virtual bool fileInRange(
float distance)
const;
98 virtual float fileRangeDistance(osg::NodeVisitor& nv)
const;
101 virtual float childRangeDistance(osg::NodeVisitor& nv)
const;
104 void pageInFile(osg::NodeVisitor& nv,
float distance);
108 void pageOutFile(
int lastCullTime, osg::NodeList& toRemove);
112 bool fileNotLoaded()
const;
115 bool fileIsPaging()
const;
118 bool fileIsLoaded()
const;
121 virtual bool fileInChildRange(
float distance)
const;
124 void pageInChildren(osg::NodeVisitor& nv,
float distance);
127 void pageOutChildren(
int lastCullTime, osg::NodeList& toRemove);
130 bool childrenLoaded()
const;
141 virtual bool addPagedInChild(Node* child);
147 void increaseCountUpToParents();
150 void decreaseCountUpToParents(
int amount);
153 virtual void adjustLOD(Node* child);
159 bool fileInRange2D(
float distance,
float cull);
165 bool fileInChildRange2D(
float cull,
float lod);
168 void setThreadSafeRefUnref(
bool threadSafe);
171 virtual void resizeGLObjectBuffers(
unsigned int maxSize);
176 virtual void releaseGLObjects(osg::State* state)
const;
179 virtual std::string fileName()
const;
182 virtual const std::vector<osg::ref_ptr<DtHierarchicalPagedLod> >& children()
const;
186 virtual const osg::Matrix& fileTranslation()
const;
214 virtual bool addChild(Node* child);
216 virtual const char* className()
const;
220 virtual osg::Node* parentMetaflightGroup()
const;
253 std::vector<osg::ref_ptr<DtHierarchicalPagedLod> >
myChildren;
273 #if DTHIERARCHICALPAGEDLOD_LOGGING
274 static int myHPLODRefCount;
volatile int myCullTracking
Definition: DtHierarchicalPagedLod.h:248
int myPagedInCount
Definition: DtHierarchicalPagedLod.h:263
osg::Vec3d myChildrenCenter
Definition: DtHierarchicalPagedLod.h:239
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
boost::signalslib::signal< void(osg::Group *page, osg::Node *child)> signal_childAboutToPageOut
signal when a child is about to be paged out (i.e. data corresponding to it unloaded and the child re...
Definition: DtHierarchicalPagedLod.h:203
Contains makVrv::DtFastGroup class.
const float myRangeFar
Definition: DtHierarchicalPagedLod.h:242
int getNumChildrenPagedIn()
If we page in tiles, increase the paged-in count with parents.
Definition: DtHierarchicalPagedLod.h:144
DtOsgCullVisitor will inspect the camera to see which visual mode is active. If the visual mode is a ...
Definition: DtOsgCullVisitor.h:27
float getTileRadius()
Get tile radius (has 20% padding so bounds are not too tight)
Definition: DtHierarchicalPagedLod.h:189
FileState
Definition: DtHierarchicalPagedLod.h:231
std::vector< osg::ref_ptr< DtHierarchicalPagedLod > > myChildren
Definition: DtHierarchicalPagedLod.h:253
std::string myFileName
Definition: DtHierarchicalPagedLod.h:249
DT_DLL_VRVCORE double distance(const makVrv::DtCoordinateSystem &, const DtVector &from, const DtVector &to)
Returns the distance from the two points. Coordinates are in local database coordinates The coordinat...
boost::signalslib::signal< void(osg::Group *page, osg::Node *child)> signal_childPagedIn
signal when a child of 'page' is paged in (i.e. added to the scenegraph) 'child' can be other pages o...
Definition: DtHierarchicalPagedLod.h:199
SceneObjectMap mySceneObjs
Definition: DtHierarchicalPagedLod.h:271
DtHierarchicalPagedLod & myParent
Definition: DtHierarchicalPagedLod.h:223
osg::ref_ptr< PagedFileRoot > myFileRoot
Definition: DtHierarchicalPagedLod.h:251
DtDe & myDe
Definition: DtHierarchicalPagedLod.h:265
A Hierarchical paged LOD is a paged LOD which pages in a single file when the cull visitor is with-in...
Definition: DtHierarchicalPagedLod.h:39
const float myRangeNear
Definition: DtHierarchicalPagedLod.h:241
osg::Vec3d myFileCenter
Definition: DtHierarchicalPagedLod.h:238
const float myTileRadius
Definition: DtHierarchicalPagedLod.h:243
osg::Group with optimized removeChildren function
Definition: DtFastGroup.h:22
Definition: DtHierarchicalPagedLod.h:234
Base class to provide boost signal/slot management.
FileState myFileState
Definition: DtHierarchicalPagedLod.h:250
osg::ref_ptr< osg::Referenced > myPageRef
Definition: DtHierarchicalPagedLod.h:254
Contains makVrv::DtUniqueID type.
Contains DLL export macros.
std::unordered_map< DtUniqueID, DtSceneObject * > SceneObjectMap
Definition: DtHierarchicalPagedLod.h:43
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:72
const float myChildTileRadius
Definition: DtHierarchicalPagedLod.h:244
virtual const char * className() const
Definition: DtHierarchicalPagedLod.h:56
osg::ref_ptr< osgDB::Options > myOptions
Definition: DtHierarchicalPagedLod.h:255
const bool myChildrenAreSparse
Definition: DtHierarchicalPagedLod.h:245
Paged file root node, used to change the file state when the file is paged-in.
Definition: DtHierarchicalPagedLod.h:208
osg::Node * myParentMetaflightGroup
Definition: DtHierarchicalPagedLod.h:224
const bool myChildrenAreSubstitutive
Definition: DtHierarchicalPagedLod.h:246