14 #include <osg/MatrixTransform>
15 #include <osgDB/Options>
17 #include <boost/signals.hpp>
18 #include <boost/unordered_map.hpp>
24 #define DTHIERARCHICALPAGEDLOD_LOGGING 0
28 class DtOsgCullVisitor;
29 class DtOsgArticulatedModel;
30 class DtModelDefinition;
44 float distanceNear,
float distanceFar,
float tileRadius,
45 float childTileRadius,
const osg::Vec3d& fileCenter,
46 const osg::Vec3d& childrenCenter,
bool sparseChildren,
47 bool substitutiveChildren,
const osg::Matrixd& fileTranslation,
48 osgDB::Options* options);
53 virtual const char*
className()
const {
return "DtHierarchicalPagedLod"; }
62 virtual void traverse(osg::NodeVisitor& nv);
65 virtual void traverseAll(osg::NodeVisitor& nv);
68 virtual void traverseActive(osg::NodeVisitor& nv);
72 virtual void cullActive(osg::NodeVisitor& nv);
78 void cullActive3D(osg::NodeVisitor& nv);
81 virtual osg::BoundingSphere computeBound()
const;
85 virtual void traverseFile(osg::NodeVisitor& nv,
float distance);
89 virtual void traverseChildren(osg::NodeVisitor& nv);
92 virtual bool fileInRange(
float distance)
const;
95 virtual float fileRangeDistance(osg::NodeVisitor& nv)
const;
98 virtual float childRangeDistance(osg::NodeVisitor& nv)
const;
101 void pageInFile(osg::NodeVisitor& nv,
float distance);
105 void pageOutFile(
int lastCullTime, osg::NodeList& toRemove);
109 bool fileNotLoaded()
const;
112 bool fileIsPaging()
const;
115 bool fileIsLoaded()
const;
118 virtual bool fileInChildRange(
float distance)
const;
121 void pageInChildren(osg::NodeVisitor& nv,
float distance);
124 void pageOutChildren(
int lastCullTime, osg::NodeList& toRemove);
127 bool childrenLoaded()
const;
131 osg::ref_ptr<osg::Node> fileNode();
134 virtual bool addPagedInChild(
Node* child);
140 void increaseCountUpToParents();
143 void decreaseCountUpToParents(
int amount);
146 virtual void adjustLOD(
Node* child);
152 bool fileInRange2D(
float distance,
float cull);
158 bool fileInChildRange2D(
float cull,
float lod);
161 void setThreadSafeRefUnref(
bool threadSafe);
164 virtual void resizeGLObjectBuffers(
unsigned int maxSize);
169 virtual void releaseGLObjects(osg::State* state)
const;
172 virtual std::string fileName()
const;
175 virtual const std::vector<osg::ref_ptr<DtHierarchicalPagedLod> >& children()
const;
179 virtual const osg::Matrix& fileTranslation()
const;
216 _parents.push_back(&parent);
220 virtual bool addChild(
Node *child)
222 return myParent.addPagedInChild(child);
241 std::vector<osg::ref_ptr<DtHierarchicalPagedLod> >
myChildren;
261 #if DTHIERARCHICALPAGEDLOD_LOGGING
262 static int myHPLODRefCount;