Index: trunk/VUT/work/ogre_changes/OgreMain/src/OgreRenderQueueSortingGrouping.cpp
===================================================================
--- trunk/VUT/work/ogre_changes/OgreMain/src/OgreRenderQueueSortingGrouping.cpp	(revision 139)
+++ trunk/VUT/work/ogre_changes/OgreMain/src/OgreRenderQueueSortingGrouping.cpp	(revision 343)
@@ -278,45 +278,7 @@
 #ifdef GTP_VISIBILITY_MODIFIED_OGRE	
 	//-----------------------------------------------------------------------
-    void RenderPriorityGroup::clearSolids(void)
-    {
-        /*SolidRenderablePassMap::iterator i, iend;
-        // Delete queue groups which are using passes which are to be
-        // deleted, we won't need these any more and they clutter up 
-        // the list and can cause problems with future clones
-        const Pass::PassSet& graveyardList = Pass::getPassGraveyard();
-        Pass::PassSet::const_iterator gi, giend;
-        giend = graveyardList.end();
-        for (gi = graveyardList.begin(); gi != giend; ++gi)
-        {
-            removeSolidPassEntry(*gi);
-        }
-
-        // Now remove any dirty passes, these will have their hashes recalculated
-        // by the parent queue after all groups have been processed
-        // If we don't do this, the std::map will become inconsistent for new insterts
-        const Pass::PassSet& dirtyList = Pass::getDirtyHashList();
-        Pass::PassSet::const_iterator di, diend;
-        diend = dirtyList.end();
-        for (di = dirtyList.begin(); di != diend; ++di)
-        {
-            removeSolidPassEntry(*di);
-        }*/
-        // NB we do NOT clear the graveyard or the dirty list here, because 
-        // it needs to be acted on for all groups, the parent queue takes 
-        // care of this afterwards
-
-        // We do not clear the unchanged solid pass maps, only the contents of each list
-        // This is because we assume passes are reused a lot and it saves resorting
-        clearSolidPassMap(mSolidPasses);
-        clearSolidPassMap(mSolidPassesDecal);
-        clearSolidPassMap(mSolidPassesDiffuseSpecular);
-        clearSolidPassMap(mSolidPassesNoShadow);
-    }
-	//-----------------------------------------------------------------------
     void RenderPriorityGroup::clear(const int leavePassesInQueue)
     {
-		SolidRenderablePassMap::iterator i, iend;
-       
-		// -- standard method if no passes are left in queue
+		//-- standard method if no passes are left in queue
 		if (leavePassesInQueue == 0)
 		{
@@ -328,15 +290,47 @@
         // This is because we assume passes are reused a lot and it saves resorting
 		if (!(leavePassesInQueue & SOLID_PASSES))
-			clearSolidPassMap(mSolidPasses);
+			destroySolidPassMap(mSolidPasses);
 		if (!(leavePassesInQueue & SOLID_PASSES_DECAL))
-			clearSolidPassMap(mSolidPassesDecal);
+			destroySolidPassMap(mSolidPassesDecal);
 		if (!(leavePassesInQueue & SOLID_PASSES_DIFFUSE_SPECULAR))
-			clearSolidPassMap(mSolidPassesDiffuseSpecular);
+			destroySolidPassMap(mSolidPassesDiffuseSpecular);
 		if (!(leavePassesInQueue & SOLID_PASSES_NOSHADOW))
-			clearSolidPassMap(mSolidPassesNoShadow);
+			destroySolidPassMap(mSolidPassesNoShadow);
 
         if (!(leavePassesInQueue & TRANSPARENT_PASSES))
 			mTransparentPasses.clear();
     }
+	//-----------------------------------------------------------------------
+    void RenderPriorityGroup::destroyPassMaps(const int leavePassesInQueue)
+    {
+		/*    
+        const Pass::PassSet& graveyardList = Pass::getPassGraveyard();
+        Pass::PassSet::const_iterator gi, giend;
+        giend = graveyardList.end();
+        for (gi = graveyardList.begin(); gi != giend; ++gi)
+        {
+            removeSolidPassEntry(*gi);
+        }
+
+        const Pass::PassSet& dirtyList = Pass::getDirtyHashList();
+        Pass::PassSet::const_iterator di, diend;
+        diend = dirtyList.end();
+        for (di = dirtyList.begin(); di != diend; ++di)
+        {
+            removeSolidPassEntry(*di);
+		}
+		*/
+
+        // We do not clear the unchanged solid pass maps, only the contents of each list
+        // This is because we assume passes are reused a lot and it saves resorting
+		if (!(leavePassesInQueue & SOLID_PASSES))
+			destroySolidPassMap(mSolidPasses);
+		if (!(leavePassesInQueue & SOLID_PASSES_DECAL))
+			destroySolidPassMap(mSolidPassesDecal);
+		if (!(leavePassesInQueue & SOLID_PASSES_DIFFUSE_SPECULAR))
+			destroySolidPassMap(mSolidPassesDiffuseSpecular);
+		if (!(leavePassesInQueue & SOLID_PASSES_NOSHADOW))
+			destroySolidPassMap(mSolidPassesNoShadow);
+    }
 #endif // GTP_VISIBILITY_MODIFIED_OGRE		
 //-----------------------------------------------------------------------
