Improve SharedArrayOptimizer

When an array is shared within and outside a geometry, it's still worth it and safe
to recreate the reference within each individual geometry.
This commit is contained in:
Marc Helbling
2017-12-01 12:26:00 +01:00
parent 2366305e83
commit 75af025c55

View File

@@ -1207,8 +1207,8 @@ void SharedArrayOptimizer::findDuplicatedUVs(const osg::Geometry& geometry)
for(unsigned int id = 0 ; id != geometry.getNumTexCoordArrays() ; ++ id)
{
const osg::Array* channel = geometry.getTexCoordArray(id);
// test if array is shared outside the geometry
if(channel && static_cast<unsigned int>(channel->referenceCount()) == arrayPointerCounter[channel])
// test if array is shared inside the geometry
if(channel && arrayPointerCounter[channel] > 1)
{
std::map<const osg::Array*, unsigned int>::const_iterator reference = references.find(channel);
if(reference == references.end())