From Laura Cerritelli, "I modified TXPPagedLOD::traverse to prevent the terrain from inappropriately unloading the higher level of detail tiles. It wasn?t updating the frame number of the tile or the range it was traversing, causing PagedLOD::removeExpiredChildren to always consider the range expired."

This commit is contained in:
Robert Osfield 2010-09-15 11:36:45 +00:00
parent 6ac8b63419
commit 65e49cf9db

View File

@ -30,6 +30,15 @@ void TXPPagedLOD::traverse(osg::NodeVisitor& nv)
double timeStamp = nv.getFrameStamp()?nv.getFrameStamp()->getReferenceTime():0.0; double timeStamp = nv.getFrameStamp()?nv.getFrameStamp()->getReferenceTime():0.0;
bool updateTimeStamp = nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR; bool updateTimeStamp = nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR;
int frameNumber = nv.getFrameStamp()?nv.getFrameStamp()->getFrameNumber():0;
// set the frame number of the traversal so that external nodes can find out how active this
// node is.
if (nv.getFrameStamp() &&
nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR)
{
setFrameNumberOfLastTraversal(nv.getFrameStamp()->getFrameNumber());
}
switch(nv.getTraversalMode()) switch(nv.getTraversalMode())
{ {
@ -55,7 +64,10 @@ void TXPPagedLOD::traverse(osg::NodeVisitor& nv)
if (i<_children.size()) if (i<_children.size())
{ {
if (updateTimeStamp) if (updateTimeStamp)
{
_perRangeDataList[i]._timeStamp=timeStamp; _perRangeDataList[i]._timeStamp=timeStamp;
_perRangeDataList[i]._frameNumber=frameNumber;
}
_children[i]->accept(nv); _children[i]->accept(nv);
lastChildTraversed = (int)i; lastChildTraversed = (int)i;