Addition of the following methods:

/** Set the object-space reference radius of the volume enclosed by the PagedLOD.
          * Used to detmine the bounding sphere of the PagedLOD in the absense of any children.*/
        inline void setRadius(float radius) { _radius = radius; }

        /** Get the object-space radius of the volume enclosed by the PagedLOD.*/
        inline float getRadius() const { return _radius; }


        /** Set the number of children that the PagedLOD must keep around, even if thay are older than their expiry time.*/
        inline void setNumChildrenThatCannotBeExpired(unsigned int num) { _numChildrenThatCannotBeExpired = num; }

        /** Get the number of children that the PagedLOD must keep around, even if thay are older than their expiry time.*/
        unsigned int getNumChildrenThatCannotBeExpired() const { return _numChildrenThatCannotBeExpired; }
This commit is contained in:
Robert Osfield
2003-12-09 12:08:27 +00:00
parent f5a79aec4e
commit 1baffa3a77
2 changed files with 44 additions and 2 deletions

View File

@@ -5,13 +5,20 @@ using namespace osg;
PagedLOD::PagedLOD()
{
_centerMode = USER_DEFINED_CENTER;
_radius = -1;
_numChildrenThatCannotBeExpired = 0;
}
PagedLOD::PagedLOD(const PagedLOD& plod,const CopyOp& copyop):
LOD(plod,copyop)
LOD(plod,copyop),
_radius(plod._radius),
_numChildrenThatCannotBeExpired(plod._numChildrenThatCannotBeExpired),
_fileNameList(plod._fileNameList),
_timeStampList(plod._timeStampList)
{
}
void PagedLOD::traverse(NodeVisitor& nv)
{
@@ -73,6 +80,22 @@ void PagedLOD::traverse(NodeVisitor& nv)
}
}
bool PagedLOD::computeBound() const
{
if (_centerMode==USER_DEFINED_CENTER && _radius>=0.0f)
{
_bsphere._center = _userDefinedCenter;
_bsphere._radius = _radius;
_bsphere_computed = true;
return true;
}
else
{
return LOD::computeBound();
}
}
bool PagedLOD::addChild( Node *child )
{
if (LOD::addChild(child))
@@ -138,7 +161,7 @@ void PagedLOD::setTimeStamp(unsigned int childNo, double timeStamp)
void PagedLOD::removeExpiredChildren(double expiryTime,NodeList& removedChildren)
{
for(unsigned int i=_children.size();i>0;)
for(unsigned int i=_children.size();i>_numChildrenThatCannotBeExpired;)
{
--i;
if (!_fileNameList[i].empty() && _timeStampList[i]<expiryTime)