Reorginized the TerrainTile/TerrainTechnique dirty mechanism so that TerrainTile

now holds the dirty flag and enables/disables event traversal in response dirty
being set/unset.  This allows terrain to be automatically updated in response
to Terrain scale and sample ratio changes.
This commit is contained in:
Robert Osfield
2008-05-27 15:30:20 +00:00
parent aee0e8dc37
commit 4d60d73eca
7 changed files with 59 additions and 53 deletions

View File

@@ -101,7 +101,7 @@ void GeometryTechnique::setFilterMatrixAs(FilterType filterType)
void GeometryTechnique::init()
{
// osg::notify(osg::NOTICE)<<"Doing GeometryTechnique::init()"<<std::endl;
osg::notify(osg::INFO)<<"Doing GeometryTechnique::init()"<<std::endl;
if (!_terrainTile) return;
@@ -120,8 +120,6 @@ void GeometryTechnique::init()
if (buffer._transform.valid()) buffer._transform->setThreadSafeRefUnref(true);
_dirty = false;
swapBuffers();
}
@@ -777,7 +775,7 @@ void GeometryTechnique::traverse(osg::NodeVisitor& nv)
// if app traversal update the frame count.
if (nv.getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR)
{
if (_dirty) _terrainTile->init();
if (_terrainTile->getDirty()) _terrainTile->init();
osgUtil::UpdateVisitor* uv = dynamic_cast<osgUtil::UpdateVisitor*>(&nv);
if (uv)
@@ -798,7 +796,7 @@ void GeometryTechnique::traverse(osg::NodeVisitor& nv)
}
if (_dirty)
if (_terrainTile->getDirty())
{
osg::notify(osg::INFO)<<"******* Doing init ***********"<<std::endl;
_terrainTile->init();
@@ -813,8 +811,3 @@ void GeometryTechnique::cleanSceneGraph()
{
}
void GeometryTechnique::dirty()
{
TerrainTechnique::dirty();
}