Refactored the way that hole are pruned from the occluder hole list.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14282 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
parent
1674692840
commit
a2db511c99
@ -225,21 +225,26 @@ void CollectOccludersVisitor::removeOccludedOccluders()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// now check all the holes in the occludee against the occluder,
|
// now check all the holes in the occludee against the occluder, and remove the ones that won't be valid
|
||||||
// do so in reverse order so that the iterators remain valid.
|
unsigned int previous_valid_hole_i = 0;
|
||||||
for(ShadowVolumeOccluder::HoleList::reverse_iterator holeItr=holeList.rbegin();
|
for(unsigned int i=0; i<holeList.size(); ++i)
|
||||||
holeItr!=holeList.rend();
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (occluder->contains((*holeItr).getReferenceVertexList()))
|
if (!occluder->contains(holeList[i].getReferenceVertexList()))
|
||||||
{
|
{
|
||||||
holeList.erase((++holeItr).base());
|
if (previous_valid_hole_i<i)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
++holeItr;
|
// copy valid holes into gaps left by invalid ones
|
||||||
|
holeList[previous_valid_hole_i] = holeList[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
previous_valid_hole_i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove the tail of the holeList if holes have been removed.
|
||||||
|
if (previous_valid_hole_i<holeList.size())
|
||||||
|
{
|
||||||
|
holeList.erase(holeList.begin()+previous_valid_hole_i,holeList.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user