21 #include <osg/MatrixTransform>
23 #include <osgDB/Options>
25 #include <boost/unordered_map.hpp>
27 #define DTHIERARCHICALPAGEDLOD_LOGGING 0
31 class DtOsgCullVisitor;
32 class DtOsgArticulatedModel;
33 class DtModelDefinition;
34 class DtOsgOcclusionQueryNode;
48 float distanceNear,
float distanceFar,
float tileRadius,
49 float childTileRadius,
const osg::Vec3d& fileCenter,
50 const osg::Vec3d& childrenCenter,
bool sparseChildren,
51 bool substitutiveChildren,
const osg::Matrixd& fileTranslation,
52 osgDB::Options* options, osg::Node* parentMetaflightGroup);
57 virtual const char*
className()
const {
return "DtHierarchicalPagedLod"; }
66 virtual void traverse(osg::NodeVisitor& nv);
69 virtual void traverseAll(osg::NodeVisitor& nv);
72 virtual void traverseActive(osg::NodeVisitor& nv);
76 virtual void cullActive(osg::NodeVisitor& nv);
82 void cullActive3D(osg::NodeVisitor& nv);
85 virtual osg::BoundingSphere computeBound()
const;
89 virtual void traverseFile(osg::NodeVisitor& nv,
float distance);
93 virtual void traverseChildren(osg::NodeVisitor& nv);
96 virtual bool fileInRange(
float distance)
const;
99 virtual float fileRangeDistance(osg::NodeVisitor& nv)
const;
102 virtual float childRangeDistance(osg::NodeVisitor& nv)
const;
105 void pageInFile(osg::NodeVisitor& nv,
float distance);
109 void pageOutFile(
int lastCullTime, osg::NodeList& toRemove);
113 bool fileNotLoaded()
const;
116 bool fileIsPaging()
const;
119 bool fileIsLoaded()
const;
122 virtual bool fileInChildRange(
float distance)
const;
125 void pageInChildren(osg::NodeVisitor& nv,
float distance);
128 void pageOutChildren(
int lastCullTime, osg::NodeList& toRemove);
131 bool childrenLoaded()
const;
142 virtual bool addPagedInChild(Node* child);
148 void increaseCountUpToParents();
151 void decreaseCountUpToParents(
int amount);
154 virtual void adjustLOD(Node* child);
160 bool fileInRange2D(
float distance,
float cull);
166 bool fileInChildRange2D(
float cull,
float lod);
169 void setThreadSafeRefUnref(
bool threadSafe);
172 virtual void resizeGLObjectBuffers(
unsigned int maxSize);
177 virtual void releaseGLObjects(osg::State* state)
const;
180 virtual std::string fileName()
const;
183 virtual const std::vector<osg::ref_ptr<DtHierarchicalPagedLod> >& children()
const;
187 virtual const osg::Matrix& fileTranslation()
const;
215 virtual bool addChild(Node* child);
217 virtual const char* className()
const;
221 virtual osg::Node* parentMetaflightGroup()
const;
254 std::vector<osg::ref_ptr<DtHierarchicalPagedLod> >
myChildren;
276 #if DTHIERARCHICALPAGEDLOD_LOGGING
277 static int myHPLODRefCount;
volatile int myCullTracking
Definition: DtHierarchicalPagedLod.h:249
int myPagedInCount
Definition: DtHierarchicalPagedLod.h:264
osg::Vec3d myChildrenCenter
Definition: DtHierarchicalPagedLod.h:240
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
boost::unordered_map< DtUniqueID, DtSceneObject * > SceneObjectMap
Definition: DtHierarchicalPagedLod.h:44
boost::signalslib::signal< void(osg::Group *page, osg::Node *child)> signal_childAboutToPageOut
signal when a child is about to be paged out (i.e.
Definition: DtHierarchicalPagedLod.h:204
Contains makVrv::DtFastGroup class.
const float myRangeFar
Definition: DtHierarchicalPagedLod.h:243
int getNumChildrenPagedIn()
If we page in tiles, increase the paged-in count with parents.
Definition: DtHierarchicalPagedLod.h:145
DtOsgCullVisitor will inspect the camera to see which visual mode is active.
Definition: DtOsgCullVisitor.h:25
float getTileRadius()
Get tile radius (has 20% padding so bounds are not too tight)
Definition: DtHierarchicalPagedLod.h:190
FileState
Definition: DtHierarchicalPagedLod.h:232
std::vector< osg::ref_ptr< DtHierarchicalPagedLod > > myChildren
Definition: DtHierarchicalPagedLod.h:254
std::string myFileName
Definition: DtHierarchicalPagedLod.h:250
DT_DLL_VRVCORE double distance(const makVrv::DtCoordinateSystem &, const DtVector &from, const DtVector &to)
Returns the distance from the two points.
boost::signalslib::signal< void(osg::Group *page, osg::Node *child)> signal_childPagedIn
signal when a child of 'page' is paged in (i.e.
Definition: DtHierarchicalPagedLod.h:200
SceneObjectMap mySceneObjs
Definition: DtHierarchicalPagedLod.h:272
DtHierarchicalPagedLod & myParent
Definition: DtHierarchicalPagedLod.h:224
osg::ref_ptr< PagedFileRoot > myFileRoot
Definition: DtHierarchicalPagedLod.h:252
DtDe & myDe
Definition: DtHierarchicalPagedLod.h:266
A Hierarchical paged LOD is a paged LOD which pages in a single file when the cull visitor is with-in...
Definition: DtHierarchicalPagedLod.h:40
const float myRangeNear
Definition: DtHierarchicalPagedLod.h:242
osg::Vec3d myFileCenter
Definition: DtHierarchicalPagedLod.h:239
const float myTileRadius
Definition: DtHierarchicalPagedLod.h:244
osg::Group with optimized removeChildren function
Definition: DtFastGroup.h:22
osg::ref_ptr< DtOsgOcclusionQueryNode > myOcclusionNode
Definition: DtHierarchicalPagedLod.h:274
Definition: DtHierarchicalPagedLod.h:235
Base class to provide boost signal/slot management.
FileState myFileState
Definition: DtHierarchicalPagedLod.h:251
osg::ref_ptr< osg::Referenced > myPageRef
Definition: DtHierarchicalPagedLod.h:255
Contains makVrv::DtUniqueID type.
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
const float myChildTileRadius
Definition: DtHierarchicalPagedLod.h:245
virtual const char * className() const
Definition: DtHierarchicalPagedLod.h:57
osg::ref_ptr< osgDB::Options > myOptions
Definition: DtHierarchicalPagedLod.h:256
const bool myChildrenAreSparse
Definition: DtHierarchicalPagedLod.h:246
Paged file root node, used to change the file state when the file is paged-in.
Definition: DtHierarchicalPagedLod.h:209
osg::Node * myParentMetaflightGroup
Definition: DtHierarchicalPagedLod.h:225
const bool myChildrenAreSubstitutive
Definition: DtHierarchicalPagedLod.h:247