Index: trunk/VUT/GtpVisibility/include/DummyPreprocessingManager.h
===================================================================
--- trunk/VUT/GtpVisibility/include/DummyPreprocessingManager.h	(revision 65)
+++ trunk/VUT/GtpVisibility/include/DummyPreprocessingManager.h	(revision 316)
@@ -52,6 +52,6 @@
   */
   virtual int AddViewCellPVS(const int cellID,
-			     InfoContainer<NodeInfo> *visibleNodes,
-			     InfoContainer<MeshInfo> *visibleMeshes );
+			     NodeInfoContainer *visibleNodes,
+			     MeshInfoContainer *visibleMeshes);
 
 };
Index: trunk/VUT/GtpVisibility/include/DistanceQueue.h
===================================================================
--- trunk/VUT/GtpVisibility/include/DistanceQueue.h	(revision 87)
+++ trunk/VUT/GtpVisibility/include/DistanceQueue.h	(revision 316)
@@ -17,8 +17,8 @@
 	a greater distance has a lower priority in the queue.
 */
-template <typename T> class GreaterDistance
+template <typename T> class GtDistance
 {
 public:
-	GreaterDistance(HierarchyInterface *hierarchyInterface): mHierarchyInterface(hierarchyInterface)
+	GtDistance(HierarchyInterface *hierarchyInterface): mHierarchyInterface(hierarchyInterface)
 	{}
 	
@@ -34,5 +34,5 @@
 /** A priority queue where closer hierarchy nodes are given a higher priority.
 */
-typedef std::priority_queue<HierarchyNode *, std::vector<HierarchyNode *>, GreaterDistance<std::vector<HierarchyNode *>::value_type> > DistanceQueue;
+typedef std::priority_queue<HierarchyNode *, std::vector<HierarchyNode *>, GtDistance<std::vector<HierarchyNode *>::value_type> > DistanceQueue;
 
 } // namespace GtpVisibility
Index: trunk/VUT/GtpVisibility/include/QueryManager.h
===================================================================
--- trunk/VUT/GtpVisibility/include/QueryManager.h	(revision 174)
+++ trunk/VUT/GtpVisibility/include/QueryManager.h	(revision 316)
@@ -49,7 +49,7 @@
     virtual void
     ComputeCameraVisibility(const Camera &camera,
-			    InfoContainer<NodeInfo> *visibleNodes,
-			    InfoContainer<MeshInfo> *visibleGeometry,
-				InfoContainer<GtpVisibility::PatchInfo> *visiblePatches,
+			    NodeInfoContainer *visibleNodes,
+			    MeshInfoContainer *visibleGeometry,
+				PatchInfoContainer *visiblePatches,
 			    bool relativeVisibility = false
 			    ) = 0;
@@ -61,7 +61,7 @@
     virtual void
     ComputeFromPointVisibility(const Vector3 &point,
-			       InfoContainer<NodeInfo> *visibleNodes,
-			       InfoContainer<MeshInfo> *visibleGeometry,
-				   InfoContainer<GtpVisibility::PatchInfo> *visiblePatches,
+			       NodeInfoContainer *visibleNodes,
+			       MeshInfoContainer *visibleGeometry,
+				   PatchInfoContainer *visiblePatches,
 			       bool relativeVisibility = false
 			       ) = 0;
Index: trunk/VUT/GtpVisibility/include/VisibilityInfo.h
===================================================================
--- trunk/VUT/GtpVisibility/include/VisibilityInfo.h	(revision 159)
+++ trunk/VUT/GtpVisibility/include/VisibilityInfo.h	(revision 316)
@@ -8,11 +8,19 @@
 
 namespace GtpVisibility {
-  
+ 
 /** Class storing visibility information.
 */
+template<typename T>
 class VisibilityInfo
 {
 public:
-	VisibilityInfo(const int visiblePixels, const int projectedPixels);
+	VisibilityInfo(T source, const int visiblePixels, const int projectedPixels);
+
+	/** set source of the info. 
+	*/
+	void SetSource(T source);
+	/** get source of the info. 
+	*/
+	T GetSource() const;
 
 	int GetVisiblePixels() const;
@@ -27,8 +35,8 @@
 	/** Adds visibility to current visibility information.
 	*/
-	void AddVisibility(const VisibilityInfo &info);
+	void AddVisibility(const VisibilityInfo<T> &info);
 	/** Adds visibility to current visibility information.
 	*/
-	void AddVisibility(const int visiblePixels, const int vrojectedPixels);
+	void AddVisibility(const int visiblePixels, const int projectedPixels);
 
 protected:
@@ -39,66 +47,94 @@
 	*/
 	int mProjectedPixels;
-};
-/** Class storing the visibility information of a hierarchy node. 
-*/
-class NodeInfo: public VisibilityInfo
-{
-public:
-    NodeInfo(HierarchyNode *node, const int visiblePixels, const int projectedPixels);
 
-	void SetNode(HierarchyNode *node);
-	HierarchyNode *GetNode() const;
-	//bool operator<(const NodeInfo& rhs) const {return mNode < rhs.mNode;}
-
-protected:
-
-    /** Pointer to the hierarchy nnode.
-	*/
-    HierarchyNode *mNode;
-};
-  
-/** Class storing the visibility information of a mesh.
-*/
-class MeshInfo: public VisibilityInfo
-{
-public:
-	MeshInfo(Mesh *mesh, const int visiblePixels, const int projectedPixels);
-
-	Mesh *GetMesh() const;
-	void SetMesh(Mesh *mesh);
-
-	//bool operator<(const MeshInfo& rhs) const {return mMesh < rhs.mMesh;}
-	//bool operator==(const MeshInfo& rhs) const {return mMesh == rhs.mMesh;}
-	
-protected:
-
-    /** Pointer to the mesh.
-	*/
-    Mesh *mMesh;
+	T mSource;
 };
 
-/** Class storing the visibility information of a patch, i.e., parts of meshes having the same material
-	properties.
-*/
-class PatchInfo: public VisibilityInfo
+//-----------------------------------------------------------------------
+template <typename T>
+T VisibilityInfo<T>::GetSource() const
 {
-public:
-	PatchInfo(Patch *Patch, const int visiblePixels, const int projectedPixels);
+	return mSource;
+}
 
-	Patch *GetPatch() const;
-	void SetPatch(Patch *patch);
-	
-protected:
+//-----------------------------------------------------------------------
+template <typename T>
+void VisibilityInfo<T>::SetSource(T source)
+{
+	return mSource;
+}
 
-    /** Pointer to the patch.
-	*/
-    Patch *mPatch;
+//-----------------------------------------------------------------------
+template <typename T>
+VisibilityInfo<T>::VisibilityInfo(T source, const int visiblePixels, const int projectedPixels): 
+mSource(source), mProjectedPixels(projectedPixels), mVisiblePixels(visiblePixels) 
+{
+}
+
+//-----------------------------------------------------------------------
+template <typename T>
+int VisibilityInfo<T>::GetVisiblePixels() const 
+{
+	return mVisiblePixels;
+}
+//-----------------------------------------------------------------------
+template <typename T>
+int VisibilityInfo<T>::GetProjectedPixels() const 
+{
+	return mProjectedPixels;
+}
+//-----------------------------------------------------------------------
+template <typename T>
+void VisibilityInfo<T>::SetVisiblePixels(int vis) 
+{
+	mVisiblePixels = vis;
+}
+//-----------------------------------------------------------------------
+template <typename T>
+void VisibilityInfo<T>::SetProjectedPixels(int vis) 
+{
+	mProjectedPixels = vis;
+}
+//-----------------------------------------------------------------------
+template <typename T>
+float VisibilityInfo<T>::ComputeRelativeVisibility() 
+{ 
+	if (!mProjectedPixels) 
+		return 0;
+
+	return (float)mVisiblePixels / (float)mProjectedPixels; 
+}
+//-----------------------------------------------------------------------
+template <typename T>
+void VisibilityInfo<T>::AddVisibility(const VisibilityInfo<T> &info)
+{
+	mVisiblePixels += info.GetVisiblePixels();
+	mProjectedPixels += info.GetProjectedPixels();
+}
+
+//-----------------------------------------------------------------------
+template <typename T>
+void VisibilityInfo<T>::AddVisibility(const int visiblePixels, const int projectedPixels)
+{
+	mVisiblePixels += visiblePixels;
+	mProjectedPixels += projectedPixels;
+}
+
+typedef VisibilityInfo<Patch *> PatchInfo;
+typedef VisibilityInfo<Mesh *> MeshInfo;
+typedef VisibilityInfo<HierarchyNode *> NodeInfo;
+
+
+template<class T>
+struct InfoContainer
+{
+	typedef std::vector<VisibilityInfo<T> > Type;
 };
 
-//TODO: this define shall be replaced by template typedef
-#define InfoContainer std::vector
-//#define InfoContainer std::set
-};
+typedef std::vector<PatchInfo> PatchInfoContainer;
+typedef std::vector<MeshInfo> MeshInfoContainer;
+typedef std::vector<NodeInfo> NodeInfoContainer;
 
+} // namespace GtpVisibility
 
 #endif
Index: trunk/VUT/GtpVisibility/include/DummyQueryManager.h
===================================================================
--- trunk/VUT/GtpVisibility/include/DummyQueryManager.h	(revision 174)
+++ trunk/VUT/GtpVisibility/include/DummyQueryManager.h	(revision 316)
@@ -23,7 +23,7 @@
     virtual void
     ComputeCameraVisibility(const Camera &camera,
-			    InfoContainer<NodeInfo> *visibleNodes,
-			    InfoContainer<MeshInfo> *visibleGeometry,
-				InfoContainer<GtpVisibility::PatchInfo> *visiblePatches,
+			    NodeInfoContainer *visibleNodes,
+			    MeshInfoContainer *visibleGeometry,
+				PatchInfoContainer *visiblePatches,
 			    bool relativeVisibility = false );
     
@@ -33,7 +33,7 @@
     virtual void
     ComputeFromPointVisibility(const Vector3 &point,
-			       InfoContainer<NodeInfo> *visibleNodes,
-			       InfoContainer<MeshInfo> *visibleGeometry,
-				   	InfoContainer<GtpVisibility::PatchInfo> *visiblePatches,
+			       NodeInfoContainer *visibleNodes,
+			       MeshInfoContainer *visibleGeometry,
+				   PatchInfoContainer *visiblePatches,
 			       bool relativeVisibility = false
 			       );
Index: trunk/VUT/GtpVisibility/include/PreprocessingManager.h
===================================================================
--- trunk/VUT/GtpVisibility/include/PreprocessingManager.h	(revision 113)
+++ trunk/VUT/GtpVisibility/include/PreprocessingManager.h	(revision 316)
@@ -82,6 +82,6 @@
     virtual bool GetPVS(const Vector3 &point,
 			const float radius,
-			InfoContainer<NodeInfo> *visibleNodes,
-			InfoContainer<MeshInfo> *visibleMeshes );
+			NodeInfoContainer *visibleNodes,
+			MeshInfoContainer *visibleMeshes);
     
     
@@ -125,6 +125,6 @@
     */
     virtual int AddViewCellPVS(const int cellID,
-			       InfoContainer<NodeInfo> *visibleNodes,
-			       InfoContainer<MeshInfo> *visibleMeshes ) = 0;
+							   NodeInfoContainer *visibleNodes,
+							   MeshInfoContainer *visibleMeshes ) = 0;
     
     HierarchyInterface *mSceneTraverser;
Index: trunk/VUT/GtpVisibility/scripts/GtpVisibility.vcproj
===================================================================
--- trunk/VUT/GtpVisibility/scripts/GtpVisibility.vcproj	(revision 144)
+++ trunk/VUT/GtpVisibility/scripts/GtpVisibility.vcproj	(revision 316)
@@ -112,7 +112,4 @@
 			</File>
 			<File
-				RelativePath="..\src\DummyQueryManager.cpp">
-			</File>
-			<File
 				RelativePath="..\src\FrustumCullingManager.cpp">
 			</File>
@@ -133,7 +130,4 @@
 			</File>
 			<File
-				RelativePath="..\src\VisibilityInfo.cpp">
-			</File>
-			<File
 				RelativePath="..\src\VisibilityManager.cpp">
 			</File>
@@ -151,4 +145,7 @@
 			<File
 				RelativePath="..\include\DistanceQueue.h">
+			</File>
+			<File
+				RelativePath="..\include\DummyPreprocessingManager.h">
 			</File>
 			<File
Index: trunk/VUT/GtpVisibility/src/PreprocessingManager.cpp
===================================================================
--- trunk/VUT/GtpVisibility/src/PreprocessingManager.cpp	(revision 71)
+++ trunk/VUT/GtpVisibility/src/PreprocessingManager.cpp	(revision 316)
@@ -13,6 +13,6 @@
 bool PreprocessingManager::GetPVS(const Vector3 &center,
 								  const float radius,
-								  InfoContainer<NodeInfo> *visibleNodes,
-								  InfoContainer<MeshInfo> *visibleMeshes)
+								  NodeInfoContainer *visibleNodes,
+								  MeshInfoContainer *visibleMeshes)
 {
     vector<int> viewCellIds;
Index: trunk/VUT/GtpVisibility/src/HierarchyInterface.cpp
===================================================================
--- trunk/VUT/GtpVisibility/src/HierarchyInterface.cpp	(revision 174)
+++ trunk/VUT/GtpVisibility/src/HierarchyInterface.cpp	(revision 316)
@@ -10,5 +10,5 @@
 mSavedNode(NULL), mCurrentTestIdx(0), mTestGeometryForVisibleLeaves(false)
 {	
-	mDistanceQueue = new DistanceQueue(GreaterDistance<HierarchyNode *>(this));
+	mDistanceQueue = new DistanceQueue(GtDistance<HierarchyNode *>(this));
 }
 //-----------------------------------------------------------------------
Index: trunk/VUT/GtpVisibility/src/DummyPreprocessingManager.cpp
===================================================================
--- trunk/VUT/GtpVisibility/src/DummyPreprocessingManager.cpp	(revision 74)
+++ trunk/VUT/GtpVisibility/src/DummyPreprocessingManager.cpp	(revision 316)
@@ -40,6 +40,6 @@
 */
 int DummyPreprocessingManager::AddViewCellPVS(const int cellID,
-					  InfoContainer<NodeInfo> *visibleNodes,
-					  InfoContainer<MeshInfo> *visibleMeshes )
+					  NodeInfoContainer *visibleNodes,
+					  MeshInfoContainer *visibleMeshes )
 {
   // return the root of the hierarchyInterface regardless of the cellId
Index: trunk/VUT/GtpVisibility/src/DummyQueryManager.cpp
===================================================================
--- trunk/VUT/GtpVisibility/src/DummyQueryManager.cpp	(revision 159)
+++ trunk/VUT/GtpVisibility/src/DummyQueryManager.cpp	(revision 316)
@@ -9,10 +9,10 @@
   void
   DummyQueryManager::ComputeCameraVisibility(const Camera &camera,
-					     InfoContainer<NodeInfo> *visibleNodes,
-					     InfoContainer<MeshInfo> *visibleGeometry,
-						 InfoContainer<GtpVisibility::PatchInfo> *visiblePatches,
+					     NodeInfoContainer *visibleNodes,
+					     MeshInfoContainer *visibleGeometry,
+						 PatchInfoContainer *visiblePatches,
 					     bool relativeVisibility)
   {
-	  visibleNodes->push_back(NodeInfo(mHierarchyInterface->GetHierarchyRoot(), 0, 0));
+	  visibleNodes->Type.push_back(NodeInfo(mHierarchyInterface->GetHierarchyRoot(), 0, 0));
     
 //      HierarchyInterface::MeshIterator *mi =
@@ -28,10 +28,10 @@
   void
   DummyQueryManager::ComputeFromPointVisibility(const Vector3 &point,
-						InfoContainer<NodeInfo> *visibleNodes,
-						InfoContainer<MeshInfo> *visibleGeometry,
-						InfoContainer<GtpVisibility::PatchInfo> *visiblePatches,
+						NodeInfoContainer *visibleNodes,
+						MeshInfoContainer *visibleGeometry,
+						PatchInfoContainer *visiblePatches,
 						bool relativeVisibility)
   {
-	  visibleNodes->push_back(NodeInfo(mHierarchyInterface->GetHierarchyRoot(), 0, 0));
+	  visibleNodes->Type.push_back(NodeInfo(mHierarchyInterface->GetHierarchyRoot(), 0, 0));
     
 //      HierarchyInterface::MeshIterator *mi =
Index: trunk/VUT/GtpVisibility/src/VisibilityInfo.cpp
===================================================================
--- trunk/VUT/GtpVisibility/src/VisibilityInfo.cpp	(revision 171)
+++ 	(revision )
@@ -1,108 +1,0 @@
-#include "VisibilityInfo.h"
-#include <OgreLogManager.h>
-
-namespace GtpVisibility {
-/****************************************************/
-/*           VisibilityInfo implementation          */
-/****************************************************/
-VisibilityInfo::VisibilityInfo(const int visiblePixels, const int projectedPixels): 
-mProjectedPixels(projectedPixels), mVisiblePixels(visiblePixels) 
-{
-}
-
-//-----------------------------------------------------------------------
-int VisibilityInfo::GetVisiblePixels() const 
-{
-	return mVisiblePixels;
-}
-//-----------------------------------------------------------------------
-int VisibilityInfo::GetProjectedPixels() const 
-{
-	return mProjectedPixels;
-}
-//-----------------------------------------------------------------------
-void VisibilityInfo::SetVisiblePixels(int vis) 
-{
-	mVisiblePixels = vis;
-}
-//-----------------------------------------------------------------------
-void VisibilityInfo::SetProjectedPixels(int vis) 
-{
-	mProjectedPixels = vis;
-}
-//-----------------------------------------------------------------------
-float VisibilityInfo::ComputeRelativeVisibility() 
-{ 
-	if (!mProjectedPixels) 
-		return 0;
-
-	return (float)mVisiblePixels / (float)mProjectedPixels; 
-}
-//-----------------------------------------------------------------------
-void VisibilityInfo::AddVisibility(const VisibilityInfo &info)
-{
-	mVisiblePixels += info.GetVisiblePixels();
-	mProjectedPixels += info.GetProjectedPixels();
-}
-//-----------------------------------------------------------------------
-void VisibilityInfo::AddVisibility(const int visiblePixels, const int projectedPixels)
-{
-	mVisiblePixels += visiblePixels;
-	mProjectedPixels += projectedPixels;
-}
-
-/****************************************************/
-/*              NodeInfo implementation             */
-/****************************************************/
-
-
-//-----------------------------------------------------------------------
-NodeInfo::NodeInfo(HierarchyNode *node, const int visiblePixels, const int projectedPixels): 
-VisibilityInfo(visiblePixels, projectedPixels), mNode(node) 
-{}
-//-----------------------------------------------------------------------
-void NodeInfo::SetNode(HierarchyNode *node) 
-{
-	mNode = node;
-}
-//-----------------------------------------------------------------------	
-HierarchyNode *NodeInfo::GetNode() const 
-{
-	return mNode;
-}
-/****************************************************/
-/*              MeshInfo implementation             */
-/****************************************************/
-//-----------------------------------------------------------------------
-MeshInfo::MeshInfo(Mesh *mesh, const int visiblePixels, const int projectedPixels): 
-VisibilityInfo(visiblePixels, projectedPixels), mMesh(mesh) 
-{}
-//-----------------------------------------------------------------------
-void MeshInfo::SetMesh(Mesh *mesh) 
-{
-	mMesh = mesh;
-}
-//-----------------------------------------------------------------------	
-Mesh *MeshInfo::GetMesh() const 
-{
-	return mMesh;
-}
-
-/****************************************************/
-/*              PatchInfo implementation             */
-/****************************************************/
-//-----------------------------------------------------------------------
-PatchInfo::PatchInfo(Patch *patch, const int visiblePixels, const int projectedPixels): 
-VisibilityInfo(visiblePixels, projectedPixels), mPatch(patch) 
-{}
-//-----------------------------------------------------------------------
-void PatchInfo::SetPatch(Patch *patch) 
-{
-	mPatch = patch;
-}
-//-----------------------------------------------------------------------	
-Patch *PatchInfo::GetPatch() const 
-{
-	return mPatch;
-}
-}// namespace GtpVisibility
Index: trunk/VUT/work/README_ONLINE.txt
===================================================================
--- trunk/VUT/work/README_ONLINE.txt	(revision 227)
+++ trunk/VUT/work/README_ONLINE.txt	(revision 316)
@@ -24,5 +24,7 @@
    RenderSystem_Direct7
    OgreMain
-   example projects
+   GuiRenderer
+   
+   Also add the flag to the example projects you want to use
 
 5) Add following resources to OGRE_PATH\Samples\Common\bin\Release\resource.cfg:
Index: trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
===================================================================
--- trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp	(revision 259)
+++ trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp	(revision 316)
@@ -450,7 +450,7 @@
 	sm->GetVisibilityManager()->SetQueryManager(mQueryManager);
 
-	InfoContainer<GtpVisibility::NodeInfo> visibleNodes;
-	InfoContainer<GtpVisibility::MeshInfo> visibleGeometry;
-	InfoContainer<GtpVisibility::PatchInfo> visiblePatches;
+	GtpVisibility::NodeInfoContainer visibleNodes;
+	GtpVisibility::MeshInfoContainer visibleGeometry;
+	GtpVisibility::PatchInfoContainer visiblePatches;
 
 
@@ -478,5 +478,5 @@
 	int geomSize = 0, nodesSize = 0, patchSize = 0;
 
-	InfoContainer<GtpVisibility::MeshInfo>::iterator geomIt, geomIt_end = visibleGeometry.end();
+	GtpVisibility::MeshInfoContainer::iterator geomIt, geomIt_end = visibleGeometry.end();
 
 	for (geomIt = visibleGeometry.begin(); geomIt != geomIt_end; ++geomIt)
@@ -492,5 +492,5 @@
 			
 			std::stringstream d; 
-			d << "Geometry " << geomSize << " id: " << (*geomIt).GetMesh()->getSubEntity(0)->getId() 
+			d << "Geometry " << geomSize << " id: " << (*geomIt).GetSource()->getSubEntity(0)->getId() 
 			  << " visibility: "  << (*geomIt).GetVisiblePixels() << ", " << (*geomIt).GetProjectedPixels();
 			LogManager::getSingleton().logMessage(d.str());
@@ -498,5 +498,5 @@
 	}
 
-	InfoContainer<GtpVisibility::NodeInfo>::iterator nodesIt, nodesIt_end = visibleNodes.end();
+	GtpVisibility::NodeInfoContainer::iterator nodesIt, nodesIt_end = visibleNodes.end();
 
 	for (nodesIt = visibleNodes.begin(); nodesIt != nodesIt_end; ++nodesIt)
@@ -516,5 +516,5 @@
 	}
 
-	InfoContainer<GtpVisibility::PatchInfo>::iterator patchIt, patchIt_end = visiblePatches.end();
+	GtpVisibility::PatchInfoContainer::iterator patchIt, patchIt_end = visiblePatches.end();
 
 	for (patchIt = visiblePatches.begin(); patchIt != patchIt_end; ++ patchIt)
Index: trunk/VUT/work/ogre_changes/OgreMain/include/OgreRenderSystem.h
===================================================================
--- trunk/VUT/work/ogre_changes/OgreMain/include/OgreRenderSystem.h	(revision 193)
+++ trunk/VUT/work/ogre_changes/OgreMain/include/OgreRenderSystem.h	(revision 316)
@@ -947,10 +947,4 @@
         virtual Real getMaximumDepthInputValue(void) = 0;
 
-#ifdef GTP_VISIBILITY_MODIFIED_OGRE
-		/** sets colour.
-		*/
-		void setColour(int r, int g, int b, int a);
-#endif // GTP_VISIBILITY_MODIFIED_OGRE
-
     protected:
 
@@ -990,8 +984,4 @@
 
         bool mInvertVertexWinding;
-
-#ifdef GTP_VISIBILITY_MODIFIED_OGRE
-		int mColour[4];
-#endif // GTP_VISIBILITY_MODIFIED_OGRE
     };
 }
Index: trunk/VUT/work/ogre_changes/OgreMain/include/OgreSceneManager.h
===================================================================
--- trunk/VUT/work/ogre_changes/OgreMain/include/OgreSceneManager.h	(revision 183)
+++ trunk/VUT/work/ogre_changes/OgreMain/include/OgreSceneManager.h	(revision 316)
@@ -136,10 +136,10 @@
 		*/
 		void _deleteRenderedQueueGroups(int leavePassesInQueue = 0);
-		/** Internal method used by _renderVisibleObjects to deal with renderables
+		/** Wrapper for useRenderableViewProjMde with is an 
+			Internal method used by _renderVisibleObjects to deal with renderables
             which override the camera's own view / projection materices. 
-			@remark made public by matt 
-		*/
-        void useRenderableViewProjMode(Renderable* pRend);
-		/** Method for setting up the renderstate for a rendering pass.
+		*/
+        void useRenderableViewProjModeWrapper(Renderable* pRend); // HACK
+		/** HACK: A public wrapper method for setting up the renderstate for a rendering pass.
             @param
                 pass The Pass details to set.
@@ -149,5 +149,5 @@
 			@remark made public by matt
         */
-        virtual Pass* setPass(Pass* pass);
+        virtual Pass* setPassWrapper(Pass* pass);
 
 		/** Renders an Ogre Entity.
@@ -273,5 +273,5 @@
         /** Retrieves the internal render queue. */
         virtual RenderQueue* getRenderQueue(void);
-#ifndef GTP_VISIBILITY_MODIFIED_OGRE // made public, is found in the modfified section
+
         /** Internal method for setting up the renderstate for a rendering pass.
             @param
@@ -282,5 +282,5 @@
         */
         virtual Pass* setPass(Pass* pass);
-#endif
+
         /// A pass designed to let us render shadow colour on white for texture shadows
         Pass* mShadowCasterPlainBlackPass;
@@ -357,9 +357,9 @@
         AnimationList mAnimationsList;
         AnimationStateSet mAnimationStates;
-#ifndef GTP_VISIBILITY_MODIFIED_OGRE // made public, is found in the modfified section
+
         /** Internal method used by _renderVisibleObjects to deal with renderables
             which override the camera's own view / projection materices. */
         void useRenderableViewProjMode(Renderable* pRend);
-#endif
+
         /// Controller flag for determining if we need to set view/proj matrices
         bool mCamChanged;
Index: trunk/VUT/work/ogre_changes/OgreMain/src/OgreRenderSystem.cpp
===================================================================
--- trunk/VUT/work/ogre_changes/OgreMain/src/OgreRenderSystem.cpp	(revision 150)
+++ trunk/VUT/work/ogre_changes/OgreMain/src/OgreRenderSystem.cpp	(revision 316)
@@ -63,8 +63,4 @@
         // instanciate RenderSystemCapabilities
         mCapabilities = new RenderSystemCapabilities();
-
-#ifdef GTP_VISIBILITY_MODIFIED_OGRE
-		mColour[0] = mColour[1] = mColour[2] = mColour[3] = 255;
-#endif // GTP_VISIBILITY_MODIFIED_OGRE
     }
 
@@ -420,14 +416,4 @@
         }
     }
-#ifdef GTP_VISIBILITY_MODIFIED_OGRE
-	// ------------------------------------------------------------------
-	void RenderSystem::setColour(int r, int g, int b, int a)
-	{
-		mColour[0] = r;
-		mColour[1] = g;
-		mColour[2] = b;
-		mColour[3] = a;
-	}
-#endif //  GTP_VISIBILITY_MODIFIED_OGRE
 }
 
Index: trunk/VUT/work/ogre_changes/OgreMain/src/OgreSceneManager.cpp
===================================================================
--- trunk/VUT/work/ogre_changes/OgreMain/src/OgreSceneManager.cpp	(revision 193)
+++ trunk/VUT/work/ogre_changes/OgreMain/src/OgreSceneManager.cpp	(revision 316)
@@ -4200,4 +4200,9 @@
 #ifdef GTP_VISIBILITY_MODIFIED_OGRE
 //-----------------------------------------------------------------------
+Pass* SceneManager::setPassWrapper(Pass* pass)
+{
+	return setPass(pass);
+}
+//-----------------------------------------------------------------------
 void SceneManager::_renderSceneNode(Camera *cam, SceneNode *node, const int leavePassesInQueue)
 {
@@ -4259,4 +4264,9 @@
 	renderSingleObject(rend, pass, false);
 }
+//-----------------------------------------------------------------------
+void SceneManager::useRenderableViewProjModeWrapper(Renderable* pRend)
+{
+	useRenderableViewProjMode(pRend);
+}
 #endif //GTP_VISIBILITY_MODIFIED_OGRE
 }
Index: trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctree.h
===================================================================
--- trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctree.h	(revision 193)
+++ trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctree.h	(revision 316)
@@ -208,5 +208,4 @@
 	int mDepth;
 	
-
 #endif // GTP_VISIBILITY_MODIFIED_OGRE
 };
Index: trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreTerrainRenderable.h
===================================================================
--- trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreTerrainRenderable.h	(revision 193)
+++ trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreTerrainRenderable.h	(revision 316)
@@ -49,5 +49,5 @@
 
 #ifdef GTP_VISIBILITY_MODIFIED_OGRE
-#define MAX_RENDERLEVEL_INDEX 15
+#define MAX_RENDERLEVEL_INDEX 15 // maximal different number of render levels, e.g., used for chc
 #endif // GTP_VISIBILITY_MODIFIED_OGRE
 
Index: trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctreeSceneManager.h
===================================================================
--- trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctreeSceneManager.h	(revision 193)
+++ trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctreeSceneManager.h	(revision 316)
@@ -261,8 +261,8 @@
 
 #ifdef GTP_VISIBILITY_MODIFIED_OGRE
-	/* the number of nodes in the octree. do not confuse this with the OctreeNode
-	class with is derived from SceneNode.
+	/** The number of nodes in the octree.
+		@remark counts the octree hierarchy nodes in the tree.
 	*/
-	int mNumOctreeNodes;
+	int mNumOctants;
 #endif // GTP_VISIBILITY_MODIFIED_OGRE
 
Index: trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctree.cpp
===================================================================
--- trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctree.cpp	(revision 193)
+++ trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctree.cpp	(revision 316)
@@ -108,6 +108,7 @@
 	else
 		mDepth = 0;
-
+	// update bounds because we want tight octree
 	_updateBounds();
+	
 #endif //GTP_VISIBILITY_MODIFIED_OGRE
     mNumNodes = 0;
@@ -133,4 +134,5 @@
 
     mParent = 0;
+
 }
 
Index: trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctreeSceneManager.cpp
===================================================================
--- trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctreeSceneManager.cpp	(revision 158)
+++ trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctreeSceneManager.cpp	(revision 316)
@@ -318,5 +318,5 @@
 
 #ifdef GTP_VISIBILITY_MODIFIED_OGRE
-	mNumOctreeNodes = 1; // count number of octants
+	mNumOctants = 1; // initialise number of octants in tree
 #endif // GTP_VISIBILITY_MODIFIED_OGRE
 
@@ -470,5 +470,5 @@
             octant -> mChildren[ x ][ y ][ z ] = new Octree( octant );
 #ifdef GTP_VISIBILITY_MODIFIED_OGRE
-	++ mNumOctreeNodes;
+			++ mNumOctants;
 #endif // GTP_VISIBILITY_MODIFIED_OGRE
 
Index: trunk/VUT/work/ogre_changes/RenderSystems/GL/src/OgreGLRenderSystem.cpp
===================================================================
--- trunk/VUT/work/ogre_changes/RenderSystems/GL/src/OgreGLRenderSystem.cpp	(revision 193)
+++ trunk/VUT/work/ogre_changes/RenderSystems/GL/src/OgreGLRenderSystem.cpp	(revision 316)
@@ -2328,9 +2328,4 @@
             glDisableVertexAttribArrayARB_ptr(1); // disable weights
         }
-#ifndef GTP_VISIBILITY_MODIFIED_OGRE
-        glColor4f(1,1,1,1);
-#else
-		glColor4ub(mColour[0], mColour[1], mColour[2], mColour[3]);
-#endif  // GTP_VISIBILITY_MODIFIED_OGRE
 
         glSecondaryColor3fEXT_ptr(0.0f, 0.0f, 0.0f);
Index: trunk/VUT/work/iv/IVFrameListener.cpp
===================================================================
--- trunk/VUT/work/iv/IVFrameListener.cpp	(revision 259)
+++ trunk/VUT/work/iv/IVFrameListener.cpp	(revision 316)
@@ -436,5 +436,5 @@
 		  << "worst frame time: " << mWindow->getWorstFrameTime() << "\n"
 		  << "avg. #triangles: " << avgTris << " M\n"
-		  << "#frames: " << mFrameCount < "\n";
+		  << "#frames: " << mFrameCount << "\n";
 
 		LogManager::getSingleton().logMessage(d.str());
Index: trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp	(revision 313)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp	(revision 316)
@@ -689,5 +689,5 @@
 			else
 			{
-				Debug << "polygon not valid: " << *planePoly << " size: " << planePoly->mVertices.size() << endl;
+				Debug << "polygon not valid: " << *planePoly << " size: " << (int)planePoly->mVertices.size() << endl;
 				DEL_PTR(planePoly);
 			}
Index: trunk/VUT/GtpVisibilityPreprocessor/src/default.env
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/default.env	(revision 311)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/default.env	(revision 316)
@@ -9,7 +9,7 @@
 #	filename vienna.x3d
 #	filename ../data/vienna/vienna-simple.x3d
-	filename ../data/vienna/vienna-buildings.x3d
+#	filename ../data/vienna/vienna-buildings.x3d
 #	filename ../data/vienna/viewcells-25-sel.x3d
-#	filename ../data/atlanta/atlanta2.x3d
+	filename ../data/atlanta/atlanta2.x3d
 #	filename ../data/soda/soda.dat
 #	filename ../data/soda/soda5.dat
@@ -56,15 +56,16 @@
 
 Sampling {
-	totalSamples	1000000
-	samplesPerPass  5
+	totalSamples	200000
+	samplesPerPass  10
 }
 
 ViewCells {
 	hierarchyType bspTree
+	height 7.0
+	maxViewCells 20
 	#hierarchyType kdTree
 	#hierarchyType sceneDependent
-#	filename ../data/atlanta/atlanta_viewcells_large.x3d
-#	filename ../data/atlanta/atlanta_viewcells_large2.x3d
-	filename ../data/vienna/viewcells-25-sel.x3d
+	filename ../data/atlanta/atlanta_viewcells_large.x3d
+#	filename ../data/vienna/viewcells-25-sel.x3d
 #	filename ../data/vienna/viewcells-25.x3d
 #	filename ../data/vienna/viewcells-large-sel.x3d
@@ -101,5 +102,5 @@
 	
 	maxCandidates 50
-	maxViewCells 999999
+	
 	Termination {
 		maxPolysForAxisAligned 100
Index: trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp	(revision 315)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp	(revision 316)
@@ -465,5 +465,5 @@
 			   exporter->ExportViewCell(vc);
 
-			   Debug << "pvs size: " << (int)vc->GetPvs().GetSize() << " of " << objects.size();
+			   Debug << "pvs size: " << (int)vc->GetPvs().GetSize() << " of " << (int)objects.size();
 			   Debug << " exporting rays: " << (int)vcRays[j].size() << endl;
 
Index: trunk/VUT/Ogre/include/OgreOcclusionQueriesQueryManager.h
===================================================================
--- trunk/VUT/Ogre/include/OgreOcclusionQueriesQueryManager.h	(revision 174)
+++ trunk/VUT/Ogre/include/OgreOcclusionQueriesQueryManager.h	(revision 316)
@@ -19,7 +19,7 @@
     
     void ComputeCameraVisibility(const Camera &camera,
-			    InfoContainer<GtpVisibility::NodeInfo> *visibleNodes,
-			    InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
-				InfoContainer<GtpVisibility::PatchInfo> *visiblePatches,
+			    GtpVisibility::NodeInfoContainer *visibleNodes,
+			    GtpVisibility::MeshInfoContainer *visibleGeometry,
+				GtpVisibility::PatchInfoContainer *visiblePatches,
 			    bool relativeVisibility = false);
     
@@ -29,7 +29,7 @@
     */
     void ComputeFromPointVisibility(const Vector3 &point,
-			       InfoContainer<GtpVisibility::NodeInfo> *visibleNodes,
-			       InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
-				   InfoContainer<GtpVisibility::PatchInfo> *visiblePatches,
+			       GtpVisibility::NodeInfoContainer *visibleNodes,
+			       GtpVisibility::MeshInfoContainer *visibleGeometry,
+				   GtpVisibility::PatchInfoContainer *visiblePatches,
 			       bool relativeVisibility = false);
     
@@ -40,5 +40,5 @@
 								   GtpVisibility::QueryList::iterator &projQueryIt,
 								   GtpVisibility::GeometryList *geometryList, 
-								   InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
+								   GtpVisibility::MeshInfoContainer *visibleGeometry,
 								   bool relativeVisibility);
 
@@ -46,25 +46,25 @@
 							   GtpVisibility::QueryList::iterator &projQueryIt,
 							   GtpVisibility::HierarchyNodeList *nodeList, 
-							   InfoContainer<GtpVisibility::NodeInfo> *visibleNodes,
+							   GtpVisibility::NodeInfoContainer *visibleNodes,
 							   bool relativeVisibility);
 
 	void CollectRelativeGeometryVisibilityForItemBuffer(GtpVisibility::QueryList::iterator &projQueryIt,
 												GtpVisibility::GeometryList *geometryList, 
-												InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry);
+												GtpVisibility::MeshInfoContainer *visibleGeometry);
 
 	void CollectRelativePatchVisibilityForItemBuffer(
 									GtpVisibility::QueryList::iterator &projQueryIt,
 									GtpVisibility::PatchList *patchList, 
-									InfoContainer<GtpVisibility::PatchInfo> *visiblePatches);
+									GtpVisibility::PatchInfoContainer *visiblePatches);
 
 	void CollectPatchVisibility(GtpVisibility::QueryList::iterator &visQueryIt, 
 								GtpVisibility::QueryList::iterator &projQueryIt,
 								GtpVisibility::PatchList *patchList, 
-								InfoContainer<GtpVisibility::PatchInfo> *visiblePatches,
+								GtpVisibility::PatchInfoContainer *visiblePatches,
 								bool relativeVisibility);
 
-	void RemoveDuplicateNodes(InfoContainer<GtpVisibility::NodeInfo> *visibleNodes);
-	void RemoveDuplicateGeometry(InfoContainer<GtpVisibility::MeshInfo> *visibleMesh);
-	void RemoveDuplicatePatches(InfoContainer<GtpVisibility::PatchInfo> *visiblePatches);
+	void RemoveDuplicateNodes(GtpVisibility::NodeInfoContainer *visibleNodes);
+	void RemoveDuplicateGeometry(GtpVisibility::MeshInfoContainer *visibleMesh);
+	void RemoveDuplicatePatches(GtpVisibility::PatchInfoContainer *visiblePatches);
 
 	/** Returns the patches of the geometry of a given node. 
Index: trunk/VUT/Ogre/include/OgrePlatformQueryManager.h
===================================================================
--- trunk/VUT/Ogre/include/OgrePlatformQueryManager.h	(revision 174)
+++ trunk/VUT/Ogre/include/OgrePlatformQueryManager.h	(revision 316)
@@ -25,13 +25,13 @@
     */
     void ComputeFromPointVisibility(const Vector3 &point,
-			       InfoContainer<GtpVisibility::NodeInfo> *visibleNodes,
-			       InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
-				   InfoContainer<GtpVisibility::PatchInfo> *visiblePatches,
+			       GtpVisibility::NodeInfoContainer *visibleNodes,
+			       GtpVisibility::MeshInfoContainer *visibleGeometry,
+				   GtpVisibility::PatchInfoContainer *visiblePatches,
 			       bool relativeVisibility = false);
   
 	void ComputeCameraVisibility(const Camera &camera,
-			       InfoContainer<GtpVisibility::NodeInfo> *visibleNodes,
-			       InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
-				   InfoContainer<GtpVisibility::PatchInfo> *visiblePatches,
+			       GtpVisibility::NodeInfoContainer *visibleNodes,
+			       GtpVisibility::MeshInfoContainer *visibleGeometry,
+				   GtpVisibility::PatchInfoContainer *visiblePatches,
 			       bool relativeVisibility = false);
   
@@ -45,9 +45,9 @@
 
 	void CollectItemBufferResults(
-				InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
-				InfoContainer<GtpVisibility::PatchInfo> *visiblePatches);
+				GtpVisibility::MeshInfoContainer *visibleGeometry,
+				GtpVisibility::PatchInfoContainer *visiblePatches);
 
-	void InitItemBuffer(InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
-						InfoContainer<GtpVisibility::PatchInfo> *visiblePatches);
+	void InitItemBuffer(GtpVisibility::MeshInfoContainer *visibleGeometry,
+						GtpVisibility::PatchInfoContainer *visiblePatches);
 
 	Viewport *mViewport;
Index: trunk/VUT/Ogre/scripts/Plugin_VisibilitySceneManager.vcproj
===================================================================
--- trunk/VUT/Ogre/scripts/Plugin_VisibilitySceneManager.vcproj	(revision 171)
+++ trunk/VUT/Ogre/scripts/Plugin_VisibilitySceneManager.vcproj	(revision 316)
@@ -150,7 +150,4 @@
 				Filter="">
 				<File
-					RelativePath="..\include\OgreBspHierarchyInterface.h">
-				</File>
-				<File
 					RelativePath="..\include\OgreOctreeHierarchyInterface.h">
 				</File>
@@ -191,4 +188,7 @@
 				Name="Header Files"
 				Filter="h;hpp;hxx;hm;inl;inc">
+				<File
+					RelativePath="..\include\OgreBspHierarchyInterface.h">
+				</File>
 				<File
 					RelativePath="..\include\OgreOcclusionQueriesQueryManager.h">
Index: trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp	(revision 187)
+++ trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp	(revision 316)
@@ -87,8 +87,8 @@
 	
 	mRenderSystem->_setWorldMatrix(Ogre::Matrix4::IDENTITY);
-	mSceneManager->useRenderableViewProjMode(solidBox);
+	mSceneManager->useRenderableViewProjModeWrapper(solidBox);
 	
 	// set no depth write, no color, no lighting material
-	mSceneManager->setPass(solidBox->getTechnique()->getPass(0));
+	mSceneManager->setPassWrapper(solidBox->getTechnique()->getPass(0)); // HACK! (mySetPass should be setPass)
 	//SetOcclusionPass();
 
Index: trunk/VUT/Ogre/src/OgrePlatformQueryManager.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgrePlatformQueryManager.cpp	(revision 174)
+++ trunk/VUT/Ogre/src/OgrePlatformQueryManager.cpp	(revision 316)
@@ -26,7 +26,7 @@
 //-----------------------------------------------------------------------
 void PlatformQueryManager::ComputeFromPointVisibility(const Vector3 &point,
-			       InfoContainer<GtpVisibility::NodeInfo> *visibleNodes,
-			       InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
-				   InfoContainer<GtpVisibility::PatchInfo> *visiblePatches,
+			       GtpVisibility::NodeInfoContainer *visibleNodes,
+			       GtpVisibility::MeshInfoContainer *visibleGeometry,
+				   GtpVisibility::PatchInfoContainer *visiblePatches,
 			       bool relativeVisibility)
 {
@@ -86,7 +86,7 @@
 //-----------------------------------------------------------------------
 void PlatformQueryManager::ComputeCameraVisibility(const Camera &camera,
-			    InfoContainer<GtpVisibility::NodeInfo> *visibleNodes,
-			    InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
-				InfoContainer<GtpVisibility::PatchInfo> *visiblePatches,
+			    GtpVisibility::NodeInfoContainer *visibleNodes,
+			    GtpVisibility::MeshInfoContainer *visibleGeometry,
+				GtpVisibility::PatchInfoContainer *visiblePatches,
 			    bool relativeVisibility)
 {
@@ -137,6 +137,6 @@
 //-----------------------------------------------------------------------
 void PlatformQueryManager::CollectItemBufferResults(
-				InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
-				InfoContainer<GtpVisibility::PatchInfo> *visiblePatches)
+				GtpVisibility::MeshInfoContainer *visibleGeometry,
+				GtpVisibility::PatchInfoContainer *visiblePatches)
 {
 	int dimx = 0;
@@ -180,6 +180,6 @@
 //-----------------------------------------------------------------------
 void PlatformQueryManager::InitItemBuffer(
-				InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
-				InfoContainer<GtpVisibility::PatchInfo> *visiblePatches)
+				GtpVisibility::MeshInfoContainer *visibleGeometry,
+				GtpVisibility::PatchInfoContainer *visiblePatches)
 {
 	if (mWasInitialised)
Index: trunk/VUT/Ogre/src/OgreOcclusionQueriesQueryManager.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreOcclusionQueriesQueryManager.cpp	(revision 175)
+++ trunk/VUT/Ogre/src/OgreOcclusionQueriesQueryManager.cpp	(revision 316)
@@ -8,38 +8,29 @@
 namespace Ogre {
 
-/**
-   These functions necessary to enable sorting of node / mesh / patch info.
-*/
-//-----------------------------------------------------------------------
-inline bool nodeinfo_eq(const GtpVisibility::NodeInfo &info1, const GtpVisibility::NodeInfo &info2) 
-{ 
-	return info1.GetNode() == info2.GetNode(); 
-}
-//-----------------------------------------------------------------------
-inline bool meshinfo_eq(const GtpVisibility::MeshInfo &info1, const GtpVisibility::MeshInfo &info2) 
-{ 
-	return info1.GetMesh() == info2.GetMesh(); 
-}
-//-----------------------------------------------------------------------
-inline bool patchinfo_eq(const GtpVisibility::PatchInfo &info1, const GtpVisibility::PatchInfo &info2) 
-{ 
-	return info1.GetPatch() == info2.GetPatch(); 
-}
-//-----------------------------------------------------------------------
-inline bool nodeinfo_lower(const GtpVisibility::NodeInfo &info1, const GtpVisibility::NodeInfo &info2) 
-{ 
-	return info1.GetNode() < info2.GetNode(); 
-}
-//-----------------------------------------------------------------------
-inline bool meshinfo_lower(const GtpVisibility::MeshInfo &info1, const GtpVisibility::MeshInfo &info2) 
-{ 
-	return info1.GetMesh() < info2.GetMesh(); 
-}
-//-----------------------------------------------------------------------
-inline bool patchinfo_lower(const GtpVisibility::PatchInfo &info1, const GtpVisibility::PatchInfo &info2) 
-{ 
-	return info1.GetPatch() < info2.GetPatch(); 
-}
-
+//-----------------------------------------------------------------------
+bool nodeinfo_eq(const GtpVisibility::NodeInfo &a, const GtpVisibility::NodeInfo &b)
+{
+	return a.GetSource() == b.GetSource();
+} 
+bool nodeinfo_lt(const GtpVisibility::NodeInfo &a, const GtpVisibility::NodeInfo &b)
+{
+	return a.GetSource() < b.GetSource();
+}
+bool meshinfo_eq(const GtpVisibility::MeshInfo &a, const GtpVisibility::MeshInfo &b)
+{
+	return a.GetSource() == b.GetSource();
+} 
+bool meshinfo_lt(const GtpVisibility::MeshInfo &a, const GtpVisibility::MeshInfo &b)
+{	
+	return a.GetSource() < b.GetSource();
+}
+bool patchinfo_eq(const GtpVisibility::PatchInfo &a, const GtpVisibility::PatchInfo &b)
+{
+	return a.GetSource() == b.GetSource();
+} 
+bool patchinfo_lt(const GtpVisibility::PatchInfo &a, const GtpVisibility::PatchInfo &b)
+{
+	return a.GetSource() < b.GetSource();
+}
 
 //----------------------------------------------------------------------- 
@@ -55,7 +46,7 @@
 //-----------------------------------------------------------------------
 void OcclusionQueriesQueryManager::ComputeCameraVisibility(const Camera &camera,
-			    InfoContainer<GtpVisibility::NodeInfo> *visibleNodes,
-			    InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
-				InfoContainer<GtpVisibility::PatchInfo> *visiblePatches,
+			    GtpVisibility::NodeInfoContainer *visibleNodes,
+			    GtpVisibility::MeshInfoContainer *visibleGeometry,
+				GtpVisibility::PatchInfoContainer *visiblePatches,
 			    bool relativeVisibility)
 {
@@ -238,7 +229,7 @@
 //-----------------------------------------------------------------------
 void OcclusionQueriesQueryManager::ComputeFromPointVisibility(const Vector3 &point,
-			       InfoContainer<GtpVisibility::NodeInfo> *visibleNodes,
-			       InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
-				   InfoContainer<GtpVisibility::PatchInfo> *visiblePatches,
+			       GtpVisibility::NodeInfoContainer *visibleNodes,
+			       GtpVisibility::MeshInfoContainer *visibleGeometry,
+				   GtpVisibility::PatchInfoContainer *visiblePatches,
 			       bool relativeVisibility)
 {
@@ -265,5 +256,5 @@
 						GtpVisibility::QueryList::iterator &projQueryIt,
 						GtpVisibility::HierarchyNodeList *nodeList,  
-						InfoContainer<GtpVisibility::NodeInfo> *visibleNodes,
+						GtpVisibility::NodeInfoContainer *visibleNodes,
 						bool relativeVisibility)
 {
@@ -299,5 +290,5 @@
 									GtpVisibility::QueryList::iterator &projQueryIt,
 									GtpVisibility::GeometryList *geometryList, 
-									InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry)
+									GtpVisibility::MeshInfoContainer *visibleGeometry)
 {
 	GtpVisibility::GeometryList::iterator geometryIt;
@@ -323,5 +314,5 @@
 									GtpVisibility::QueryList::iterator &projQueryIt,
 									GtpVisibility::PatchList *patchList, 
-									InfoContainer<GtpVisibility::PatchInfo> *visiblePatches)
+									GtpVisibility::PatchInfoContainer *visiblePatches)
 {
 	GtpVisibility::PatchList::iterator patchIt;
@@ -348,5 +339,5 @@
 							GtpVisibility::QueryList::iterator &projQueryIt,
 							GtpVisibility::GeometryList *geometryList, 
-							InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
+							GtpVisibility::MeshInfoContainer *visibleGeometry,
 							bool relativeVisibility)
 {
@@ -383,5 +374,5 @@
 							GtpVisibility::QueryList::iterator &projQueryIt,
 							GtpVisibility::PatchList *patchList, 
-							InfoContainer<GtpVisibility::PatchInfo> *visiblePatches,
+							GtpVisibility::PatchInfoContainer *visiblePatches,
 							bool relativeVisibility)
 {
@@ -415,8 +406,9 @@
 //-----------------------------------------------------------------------
 void  OcclusionQueriesQueryManager::RemoveDuplicateNodes(
-					InfoContainer<GtpVisibility::NodeInfo> *visibleNodes)
-{
-	sort(visibleNodes->begin(), visibleNodes->end(), nodeinfo_lower);
-	InfoContainer<GtpVisibility::NodeInfo>::iterator visibleNodesIt,
+					GtpVisibility::NodeInfoContainer *visibleNodes)
+{
+	sort(visibleNodes->begin(), visibleNodes->end(), nodeinfo_lt);
+
+	GtpVisibility::NodeInfoContainer::iterator visibleNodesIt,
 		visibleNodesIt_end = visibleNodes->end();
 	
@@ -426,5 +418,5 @@
 		++visibleNodesIt)
 	{
-		if (!nodeInfo || (nodeInfo->GetNode() != (*visibleNodesIt).GetNode()))
+		if (!nodeInfo || (nodeInfo->GetSource() != (*visibleNodesIt).GetSource()))
 		{
 			nodeInfo = &(*visibleNodesIt);
@@ -437,14 +429,14 @@
 	
 	// physically delete duplicates
-	visibleNodes->erase( std::unique(visibleNodes->begin(), 
-		visibleNodes->end(), nodeinfo_eq), visibleNodes->end());
+	visibleNodes->erase(std::unique(visibleNodes->begin(), visibleNodes->end(), nodeinfo_eq),
+						visibleNodes->end());
 }
 //-----------------------------------------------------------------------
 void  OcclusionQueriesQueryManager::RemoveDuplicateGeometry(
-				InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry)
-{
-	sort(visibleGeometry->begin(), visibleGeometry->end(), meshinfo_lower);
-	
-	InfoContainer<GtpVisibility::MeshInfo>::iterator visibleGeomIt,
+				GtpVisibility::MeshInfoContainer *visibleGeometry)
+{
+	sort(visibleGeometry->begin(), visibleGeometry->end(), meshinfo_lt);
+	
+	GtpVisibility::MeshInfoContainer::iterator visibleGeomIt,
 			visibleGeomIt_end = visibleGeometry->end();
 
@@ -454,5 +446,5 @@
 		++visibleGeomIt)
 	{
-		if (!geomInfo || (geomInfo->GetMesh() != (*visibleGeomIt).GetMesh()))
+		if (!geomInfo || (geomInfo->GetSource() != (*visibleGeomIt).GetSource()))
 		{
 			geomInfo = &(*visibleGeomIt);
@@ -465,14 +457,14 @@
 
 	// physically delete duplicates
-	visibleGeometry->erase(std::unique(visibleGeometry->begin(), visibleGeometry->end(), 
-		meshinfo_eq), visibleGeometry->end());
+	visibleGeometry->erase(std::unique(visibleGeometry->begin(), visibleGeometry->end(), meshinfo_eq), 
+						   visibleGeometry->end());
 }
 //-----------------------------------------------------------------------
 void  OcclusionQueriesQueryManager::RemoveDuplicatePatches(
-				InfoContainer<GtpVisibility::PatchInfo> *visiblePatches)
-{
-	sort(visiblePatches->begin(), visiblePatches->end(), patchinfo_lower);
-	
-	InfoContainer<GtpVisibility::PatchInfo>::iterator visiblePatchIt,
+				GtpVisibility::PatchInfoContainer *visiblePatches)
+{
+	sort(visiblePatches->begin(), visiblePatches->end(), patchinfo_lt);
+	
+	GtpVisibility::PatchInfoContainer::iterator visiblePatchIt,
 			visiblePatchIt_end = visiblePatches->end();
 
@@ -482,5 +474,5 @@
 		++visiblePatchIt)
 	{
-		if (!patchInfo || (patchInfo->GetPatch() != (*visiblePatchIt).GetPatch()))
+		if (!patchInfo || (patchInfo->GetSource() != (*visiblePatchIt).GetSource()))
 		{
 			patchInfo = &(*visiblePatchIt);
@@ -493,6 +485,6 @@
 
 	// physically delete duplicates
-	visiblePatches->erase(std::unique(visiblePatches->begin(), visiblePatches->end(), 
-		patchinfo_eq), visiblePatches->end());
+	visiblePatches->erase(std::unique(visiblePatches->begin(), visiblePatches->end(), patchinfo_eq), 
+						  visiblePatches->end());
 }
 //-----------------------------------------------------------------------
