From Glenn Waldron, "Attached is a patch for osgUtil::Optimizer. If you run the SpatializeGroupsVisitor on a scene graph containing Geodes, StateSets attached to Geodes can be lost.

The problem is in SpatializeGroupsVisitor::divide(osg::Geode*, unsigned int) where the code creates a new Group and divides up the input Geode into one Geode per Drawable.

I fixed the problem by assigning the Geode's stateset to the new parent group.

To replicate the bug, see attached osg/dds files:

osgviewer b.osg -- model renders correctly
set OSG_OPTIMIZER="SPATIALIZE_GROUPS"
osgviewer b.osg -- textures are missing."
This commit is contained in:
Robert Osfield 2009-04-08 10:48:22 +00:00
parent d2a0e7884d
commit 009ddf1b1e

View File

@ -2822,6 +2822,8 @@ bool Optimizer::SpatializeGroupsVisitor::divide(osg::Geode* geode, unsigned int
}
osg::ref_ptr<osg::Group> group = new osg::Group;
group->setName(geode->getName());
group->setStateSet(geode->getStateSet());
for(i=0; i<geode->getNumDrawables(); ++i)
{
osg::Geode* newGeode = new osg::Geode;