Fixed the osgUtil::Optimizer::FlattenStaticTransformVisitor so that it

does not flatten drawables which have double references to them, but only
one reference with a static transform on it.  This case can't be flattened
but this wasn't picked up.  The code now detects the case correctly.
This commit is contained in:
Robert Osfield
2002-02-09 22:29:40 +00:00
parent 6ccb4b20c5
commit 634ef7e3a6

View File

@@ -17,7 +17,7 @@ using namespace osgUtil;
void Optimizer::optimize(osg::Node* node, unsigned int options)
{
if (options & COMBINE_ADJACENT_LODS)
{
CombineLODsVisitor clv;
@@ -289,14 +289,16 @@ void Optimizer::StateVisitor::optimize()
void Optimizer::FlattenStaticTransformsVisitor::apply(osg::Geode& geode)
{
if (!_matrixStack.empty())
osg::Matrix matrix;
if (!_matrixStack.empty()) matrix = _matrixStack.back();
for(int i=0;i<geode.getNumDrawables();++i)
{
for(int i=0;i<geode.getNumDrawables();++i)
{
// register each drawable with the objectMap.
_objectMap[geode.getDrawable(i)].add(_transformStack,_matrixStack.back());
}
// register each drawable with the objectMap.
_objectMap[geode.getDrawable(i)].add(_transformStack,matrix);
}
}
void Optimizer::FlattenStaticTransformsVisitor::apply(osg::Billboard& billboard)