14 #include <osg/MatrixTransform>
15 #include <osgDB/Options>
17 #include <boost/signals.hpp>
21 #define DTHIERARCHICALPAGEDLOD_LOGGING 0
25 class DtOsgCullVisitor;
37 float distanceNear,
float distanceFar,
float tileRadius,
38 float childTileRadius,
const osg::Vec3d& fileCenter,
39 const osg::Vec3d& childrenCenter,
bool sparseChildren,
40 bool substitutiveChildren,
const osg::Matrixd& fileTranslation,
41 osgDB::Options* options);
46 virtual const char*
className()
const {
return "DtHierarchicalPagedLod"; }
55 virtual void traverse(osg::NodeVisitor& nv);
58 virtual void traverseAll(osg::NodeVisitor& nv);
61 virtual void traverseActive(osg::NodeVisitor& nv);
65 virtual void cullActive(osg::NodeVisitor& nv);
71 void cullActive3D(osg::NodeVisitor& nv);
74 virtual osg::BoundingSphere computeBound()
const;
78 virtual void traverseFile(osg::NodeVisitor& nv,
float distance );
82 virtual void traverseChildren(osg::NodeVisitor& nv);
85 virtual bool fileInRange(
float distance)
const;
88 virtual float fileRangeDistance(osg::NodeVisitor& nv)
const;
91 virtual float childRangeDistance( osg::NodeVisitor& nv )
const;
94 void pageInFile(osg::NodeVisitor& nv,
float distance);
98 void pageOutFile(
int lastCullTime, osg::NodeList& toRemove);
102 bool fileNotLoaded()
const;
105 bool fileIsPaging()
const;
108 bool fileIsLoaded()
const;
111 virtual bool fileInChildRange(
float distance)
const;
114 void pageInChildren(osg::NodeVisitor& nv,
float distance);
117 void pageOutChildren(
int lastCullTime, osg::NodeList& toRemove);
120 bool childrenLoaded()
const;
124 osg::ref_ptr<osg::Node> fileNode();
127 virtual bool addPagedInChild(
Node* child);
130 virtual void adjustLOD(
Node* child);
136 bool fileInRange2D(
float distance,
float cull);
142 bool fileInChildRange2D(
float cull,
float lod );
145 void setThreadSafeRefUnref(
bool threadSafe);
148 virtual void resizeGLObjectBuffers(
unsigned int maxSize);
153 virtual void releaseGLObjects(osg::State* state)
const;
156 virtual std::string fileName()
const;
159 virtual const std::vector<osg::ref_ptr<DtHierarchicalPagedLod> >& children()
const;
163 virtual const osg::Matrix& fileTranslation()
const;
196 _parents.push_back(&parent);
200 virtual bool addChild(
Node *child )
202 return myParent.addPagedInChild(child);
221 std::vector<osg::ref_ptr<DtHierarchicalPagedLod> >
myChildren;
225 #if DTHIERARCHICALPAGEDLOD_LOGGING
226 static int myHPLODRefCount;