From Lionel Lagarde, "the attachment contains a correction of the Optimizer::MergeGeometryVisitor.
When 2 geometries are merged, the primitive sets of the second geometry
are copied to the first geometry.
The primitive sets were copied with a std::insert into the first geometry
primitive set vector. It doesn't work when the geometry is using VBOs (because
the element buffer object of the primitive set is not updated).
The correction replaces
lhs.getPrimitiveSetList().insert( lhs.getPrimitiveSetList().end(),
rhs.getPrimitiveSetList().begin(),
rhs.getPrimitiveSetList().end() );
by
for( primItr=rhs.getPrimitiveSetList().begin();
primItr!=rhs.getPrimitiveSetList().end();
++primItr )
{
lhs.addPrimitiveSet(primItr->get());
}
"
This commit is contained in:
@@ -2415,11 +2415,11 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom
|
||||
|
||||
|
||||
// shift the indices of the incoming primitives to account for the pre existing geometry.
|
||||
for(osg::Geometry::PrimitiveSetList::iterator primItr=rhs.getPrimitiveSetList().begin();
|
||||
primItr!=rhs.getPrimitiveSetList().end();
|
||||
++primItr)
|
||||
osg::Geometry::PrimitiveSetList::iterator primItr;
|
||||
for(primItr=rhs.getPrimitiveSetList().begin(); primItr!=rhs.getPrimitiveSetList().end(); ++primItr)
|
||||
{
|
||||
osg::PrimitiveSet* primitive = primItr->get();
|
||||
|
||||
switch(primitive->getType())
|
||||
{
|
||||
case(osg::PrimitiveSet::DrawElementsUBytePrimitiveType):
|
||||
@@ -2486,12 +2486,12 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom
|
||||
primitive->offsetIndices(base);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
lhs.getPrimitiveSetList().insert(lhs.getPrimitiveSetList().end(),
|
||||
rhs.getPrimitiveSetList().begin(),rhs.getPrimitiveSetList().end());
|
||||
for(primItr=rhs.getPrimitiveSetList().begin(); primItr!=rhs.getPrimitiveSetList().end(); ++primItr)
|
||||
{
|
||||
lhs.addPrimitiveSet(primItr->get());
|
||||
}
|
||||
|
||||
lhs.dirtyBound();
|
||||
lhs.dirtyDisplayList();
|
||||
|
||||
Reference in New Issue
Block a user