Changeset 9902

Show
Ignore:
Timestamp:
03/11/09 13:08:24 (6 years ago)
Author:
robert
Message:

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());

}"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgUtil/Optimizer.cpp

    r9886 r9902  
    24462446 
    24472447    // shift the indices of the incoming primitives to account for the pre existing geometry. 
    2448     for(osg::Geometry::PrimitiveSetList::iterator primItr=rhs.getPrimitiveSetList().begin(); 
    2449         primItr!=rhs.getPrimitiveSetList().end(); 
    2450         ++primItr) 
     2448    osg::Geometry::PrimitiveSetList::iterator primItr; 
     2449    for(primItr=rhs.getPrimitiveSetList().begin(); primItr!=rhs.getPrimitiveSetList().end(); ++primItr) 
    24512450    { 
    24522451        osg::PrimitiveSet* primitive = primItr->get(); 
     2452         
    24532453        switch(primitive->getType()) 
    24542454        { 
     
    25172517            break; 
    25182518        } 
    2519  
    2520          
    2521     } 
    2522      
    2523     lhs.getPrimitiveSetList().insert(lhs.getPrimitiveSetList().end(), 
    2524                                      rhs.getPrimitiveSetList().begin(),rhs.getPrimitiveSetList().end()); 
     2519    } 
     2520     
     2521    for(primItr=rhs.getPrimitiveSetList().begin(); primItr!=rhs.getPrimitiveSetList().end(); ++primItr) 
     2522    { 
     2523        lhs.addPrimitiveSet(primItr->get()); 
     2524    } 
    25252525 
    25262526    lhs.dirtyBound();