First step of refactoring the osg::Program management in osgTerrain::GeometryPool for better performance by placing default osg::Program and shader defines on a single StateSet below the osgTerrain::Terrain

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14704 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2015-02-20 15:02:43 +00:00
parent 5c023d1f76
commit afbf20eba9
6 changed files with 106 additions and 78 deletions

View File

@@ -123,6 +123,19 @@ void Terrain::traverse(osg::NodeVisitor& nv)
}
}
if (nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR)
{
osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(&nv);
osg::StateSet* ss = _geometryPool.valid() ? _geometryPool->getRootStateSetForTerrain(this) : 0;
if (cv && ss)
{
cv->pushStateSet(ss);
Group::traverse(nv);
cv->popStateSet();
return;
}
}
Group::traverse(nv);
}