Index: trunk/VUT/GtpVisibility/include/HierarchyInterface.h
===================================================================
--- trunk/VUT/GtpVisibility/include/HierarchyInterface.h	(revision 175)
+++ trunk/VUT/GtpVisibility/include/HierarchyInterface.h	(revision 345)
@@ -42,5 +42,5 @@
 		@param node the current node 
 	*/
-	virtual void PullUpVisibility(HierarchyNode *node) = 0;
+	virtual void PullUpVisibility(HierarchyNode *node) const = 0;
 	/** Issue a occlusion query for this node. 
 		@param node the current hierarchy node
@@ -96,5 +96,5 @@
 		@param visible the visible flag
 	*/
-	virtual void SetNodeVisible(HierarchyNode *node, const bool visible) = 0;
+	virtual void SetNodeVisible(HierarchyNode *node, const bool visible) const = 0;
 	/** Returns true if node has the visible flag set. See set
 	*/
@@ -105,5 +105,5 @@
 	*/
 	virtual void SetLastVisited(HierarchyNode *node, 
-								const unsigned int frameId) = 0;
+								const unsigned int frameId) const = 0;
 	/** Returns frame id when this node was last visited by the traverser. See set
 	*/
@@ -122,5 +122,5 @@
 	*/
 	virtual void VisualizeCulledNode(HierarchyNode *node, 
-		CullingType type) = NULL;
+		CullingType type) const = 0;
 
 	/** Returns vector of visible hierarchy nodes from previous render.
Index: trunk/VUT/GtpVisibility/include/CoherentHierarchicalCullingManager.h
===================================================================
--- trunk/VUT/GtpVisibility/include/CoherentHierarchicalCullingManager.h	(revision 155)
+++ trunk/VUT/GtpVisibility/include/CoherentHierarchicalCullingManager.h	(revision 345)
@@ -27,5 +27,5 @@
 		if 0, the visibility is tested deterministically for each frame.
 	*/
-	void SetAssumedVisibility(unsigned int assumedVisibility);
+	void SetAssumedVisibility(const unsigned int assumedVisibility);
 
 protected:
@@ -40,5 +40,5 @@
 	/** Skip query for this node.
 	*/
-	void SkipQuery(HierarchyNode *node);
+	void SkipQuery(HierarchyNode *node) const;
 
 
Index: trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp
===================================================================
--- trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp	(revision 343)
+++ trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp	(revision 345)
@@ -25,5 +25,5 @@
 	unsigned int visiblePixels = 0;
 	bool isAvailable = false;
-	//Ogre::LogManager::getSingleton().logMessage("Coherent Hierarchical Culling");
+	Ogre::LogManager::getSingleton().logMessage("Coherent Hierarchical Culling\n");
 
 	//-- PART 1: process finished occlusion queries
@@ -37,4 +37,7 @@
 			
 			queryQueue.pop();
+
+			std::stringstream d2; d2 << "fetch node from query queue " << node;
+			Ogre::LogManager::getSingleton().logMessage(d2.str());
 
 			if (visiblePixels > mVisibilityThreshold)
@@ -60,4 +63,7 @@
 			mHierarchyInterface->GetQueue()->pop();
 				
+			std::stringstream d2; d2 << "fetch node from hierarchy queue " << node;
+			Ogre::LogManager::getSingleton().logMessage(d2.str());
+
 			bool intersects = false;
 
@@ -81,5 +87,11 @@
 				bool wasVisible = mHierarchyInterface->IsNodeVisible(node) && 
 					(mHierarchyInterface->LastVisited(node) == mHierarchyInterface->GetFrameId() - 1);
-					
+				if (mHierarchyInterface->LastVisited(node) == mHierarchyInterface->GetFrameId())
+				{
+				std::stringstream d2; d2 << "!!!!lastVisited: " << mHierarchyInterface->LastVisited(node) << " " << node;
+				Ogre::LogManager::getSingleton().logMessage(d2.str());
+				std::stringstream d; d << "!!!!!frameid: " << mHierarchyInterface->GetFrameId() << " " << node << "\n";
+				Ogre::LogManager::getSingleton().logMessage(d.str());
+				}
 				// if we assume node to be visible in this frame => skip query 
 				// TODO: check this (not the expected speed up)
@@ -93,6 +105,7 @@
                 // identify nodes that we cannot skip queries for
 				// geometry not only in leaves => test for renderable geometry
-				bool issueQuery = !wasVisible || mHierarchyInterface->HasGeometry(node);
-								
+				bool issueQuery = (mHierarchyInterface->LastVisited(node) != mHierarchyInterface->GetFrameId())
+						&& (!wasVisible || mHierarchyInterface->HasGeometry(node));
+							
 				// reset node's visibility classification
 				mHierarchyInterface->SetNodeVisible(node, false);
@@ -100,5 +113,8 @@
 				// update node's visited flag
 				mHierarchyInterface->SetLastVisited(node, mHierarchyInterface->GetFrameId());
-			
+
+				std::stringstream d2; d2 << "lastVisited: " << mHierarchyInterface->LastVisited(node) << " " << node;
+				Ogre::LogManager::getSingleton().logMessage(d2.str());
+
 				// skip testing previously visible nodes without geometry
 				if (issueQuery)
@@ -113,4 +129,6 @@
 				if (wasVisible)
 				{
+						std::stringstream d2; d2 << "traversing node " << node;
+					Ogre::LogManager::getSingleton().logMessage(d2.str());
 					mHierarchyInterface->TraverseNode(node);
 				}
@@ -120,5 +138,5 @@
 }
 //-----------------------------------------------------------------------
-void CoherentHierarchicalCullingManager::SetAssumedVisibility(unsigned int assumedVisibility)
+void CoherentHierarchicalCullingManager::SetAssumedVisibility(const unsigned int assumedVisibility)
 {
 	mAssumedVisibility = assumedVisibility;
@@ -133,17 +151,20 @@
 }
 //-----------------------------------------------------------------------
-bool CoherentHierarchicalCullingManager::DecideVisible(HierarchyNode *node) const
+inline bool CoherentHierarchicalCullingManager::DecideVisible(HierarchyNode *node) const
 {
-	/*bool result = rand() < mThreshold; std::stringstream d; d << "Assumed vis: " << mAssumedVisibility << ", result: " << result;
-	Ogre::LogManager::getSingleton().logMessage(d.str()); return result;*/
+	//bool result = rand() < mThreshold; std::stringstream d; d << "Assumed vis: " << mAssumedVisibility << ", result: " << result;
+	//Ogre::LogManager::getSingleton().logMessage(d.str()); return result;
 	
 	return rand() < mThreshold;
 }
 //-----------------------------------------------------------------------
-void CoherentHierarchicalCullingManager::SkipQuery(HierarchyNode *node)
+inline void CoherentHierarchicalCullingManager::SkipQuery(HierarchyNode *node) const
 {
 	// -- set node to be visible in this frame, then traverse it
+	std::stringstream d2; d2 << "skipping node " << node;
+					Ogre::LogManager::getSingleton().logMessage(d2.str());
 	mHierarchyInterface->SetLastVisited(node, mHierarchyInterface->GetFrameId());
-
+	
+	mHierarchyInterface->SetNodeVisible(node, true);
 	mHierarchyInterface->PullUpVisibility(node);			
 	mHierarchyInterface->TraverseNode(node);
Index: trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp
===================================================================
--- trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp	(revision 259)
+++ trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp	(revision 345)
@@ -18,5 +18,11 @@
 
 		bool intersects = false;
-
+	
+		//if (mHierarchyInterface->HasGeometry(node) && (!mHierarchyInterface->IsLeaf(node))) ++ mNumFrustumCulledNodes;
+				//	Ogre::LogManager::getSingleton().logMessage("no geometry");
+			//else if (!mHierarchyInterface->IsLeaf(node)) ++ mNumQueriesIssued;//	Ogre::LogManager::getSingleton().logMessage("has geometry");
+/*if (!mHierarchyInterface->HasGeometry(node))
+					Ogre::LogManager::getSingleton().logMessage("no geometry");
+				else 	Ogre::LogManager::getSingleton().logMessage("has geometry");*/
 		if (!mHierarchyInterface->CheckFrustumVisible(node, intersects))
 		{
@@ -36,5 +42,4 @@
 		else
 		{
-
 			++ mNumQueriesIssued;
 
