From a2db511c9905561a1c899790b1a0986b8317b438 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 25 Jun 2014 15:47:59 +0000 Subject: [PATCH] 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 --- src/osg/CollectOccludersVisitor.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/osg/CollectOccludersVisitor.cpp b/src/osg/CollectOccludersVisitor.cpp index 3fe2bf2f1..951fa5143 100644 --- a/src/osg/CollectOccludersVisitor.cpp +++ b/src/osg/CollectOccludersVisitor.cpp @@ -225,21 +225,26 @@ void CollectOccludersVisitor::removeOccludedOccluders() break; } - // now check all the holes in the occludee against the occluder, - // do so in reverse order so that the iterators remain valid. - for(ShadowVolumeOccluder::HoleList::reverse_iterator holeItr=holeList.rbegin(); - holeItr!=holeList.rend(); - ) + // now check all the holes in the occludee against the occluder, and remove the ones that won't be valid + unsigned int previous_valid_hole_i = 0; + for(unsigned int i=0; icontains((*holeItr).getReferenceVertexList())) + if (!occluder->contains(holeList[i].getReferenceVertexList())) { - holeList.erase((++holeItr).base()); - } - else - { - ++holeItr; - } + if (previous_valid_hole_i