Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/include/HierarchyInterface.h
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/include/HierarchyInterface.h	(revision 2543)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/include/HierarchyInterface.h	(revision 2555)
@@ -164,4 +164,10 @@
 	*/
 	virtual void DecNodeAssumedVisible(HierarchyNode *node) = 0;
+	
+	virtual void AddToQueue(GtpVisibility::HierarchyNode *node) = 0;
+
+	virtual void RenderQueue() = 0;
+
+	virtual void TraverseNode2(GtpVisibility::HierarchyNode *node) = 0;
 
 protected:
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/include/VisibilityEnvironment.h
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/include/VisibilityEnvironment.h	(revision 2289)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/include/VisibilityEnvironment.h	(revision 2555)
@@ -22,8 +22,8 @@
 	*/
 	enum CullingManagerType {COHERENT_HIERARCHICAL_CULLING, 
+							 COHERENT_HIERARCHICAL_CULLING_PLUSPLUS,
+							 STOP_AND_WAIT_CULLING, 
 							 FRUSTUM_CULLING, 
-							 RANDOM_UPDATE_CULLING,
-							 STOP_AND_WAIT_CULLING, 
-							 NUM_CULLING_MANAGERS};
+                             NUM_CULLING_MANAGERS};
 
 	
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/include/CoherentHierarchicalCullingManager.h
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/include/CoherentHierarchicalCullingManager.h	(revision 2455)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/include/CoherentHierarchicalCullingManager.h	(revision 2555)
@@ -70,4 +70,6 @@
 
 	bool mTestGeometryForVisibleLeaves;
+
+	QueryQueue mQueryQueue;
 };
 
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/include/CoherentHierarchicalCullingPlusPlusManager.h
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/include/CoherentHierarchicalCullingPlusPlusManager.h	(revision 2553)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/include/CoherentHierarchicalCullingPlusPlusManager.h	(revision 2555)
@@ -1,6 +1,6 @@
-#ifndef _BatchedQueriesCullingManager_H__
-#define _BatchedQueriesCullingManager_H__
+#ifndef _CoherentHierarchicalCullingPlusPlusManager_H__
+#define _CoherentHierarchicalCullingPlusPlusManager_H__
 
-#include "CoherentHierarchicalCullingManager.h"
+#include "CullingManager.h"
 #include "HierarchyInterface.h"
 
@@ -11,27 +11,77 @@
 /** Renders the scene with the coherent hierarchical culling algorithm. 
 */
-class BatchedQueriesCullingManager : public CoherentHierarchicalCullingManager
+class CoherentHierarchicalCullingPlusPlusManager: public CullingManager
 {
 public:
-	BatchedQueriesCullingManager();
+	CoherentHierarchicalCullingPlusPlusManager();
 	/** Constructor taking the assumed visibility into account, i.e., the estimation
 		for how many frames the current visibility is considered to be valid
 	*/
-	BatchedQueriesCullingManager(const unsigned int assumedVisibility);
+	CoherentHierarchicalCullingPlusPlusManager(const unsigned int assumedVisibility);
 
 	void RenderScene();
 	
-	void SetMaxPending(int maxPending);
+	/** Sets assumed visibility (i.e., an estimation for 
+		how many frames the visibility is considered to be valid).
+		@param assumedVisibility indicates for how many frames the 
+		same visibility is be assumed.
+		if 0, the visibility is tested deterministically for each frame.
+	*/
+	void SetAssumedVisibility(const unsigned int assumedVisibility);	
+	/** This is an optimization when issuing the occlusion test. 
+		The test is done with actual geometry rather than the bounding 
+		box of leave nodes previously marked as visible.
+
+		@param testGeometry if this optimization should be used
+		@remark this option is only useful for the coherent hierarchical culling algorithm
+	*/
+	void SetTestGeometryForVisibleLeaves(const bool testGeometry);
+	/** See TestGeometryForVisibleLeaves
+	*/
+	bool GetTestGeometryForVisibleLeaves();
+
 
 protected:
 
-	void IssueMultipleQueries(PendingQueue &pendingQueue, QueryQueue &queryQueue);
+	/** Decides if node is considered to be visible depeding on the 
+		assumed visibility factor.
+		@returns if node is considered to be visible
+	*/
+	bool DecideVisible(HierarchyNode *node) const;
 
-	/** maximal pending nodes.
+	/** Skip query for this node.
 	*/
-	int mMaxPending;
+	void SkipQuery(HierarchyNode *node) const;
+
+	/** If this node is still valid for traversal in this frame.
+		It is possible that the parent was tested invisible before
+		so this node can be skipped.
+	*/
+	bool NodeInvalid(HierarchyNode *node) const;
+
+	void AssignAssumedVisibility(GtpVisibility::HierarchyNode *node);
+
+	void IssueBatchedQuery(HierarchyNodeContainer &nodes);
+
+	inline void IssueQuery(HierarchyNode *node, const bool testGeometry);
+
+
+	//////////////////////
+
+	/** number of steps the visibility is assumed to be valid.
+	*/
+	unsigned int mAssumedVisibility;
+
+	bool mTestGeometryForVisibleLeaves;
+
+	QueryQueue mQueryQueue;
+
+	std::queue<HierarchyNode *> mVisibleNodes;
+	HierarchyNodeContainer mInvisibleNodes;
+
+	int mMaxInvisibleNodesSize;
 };
 
 } // namespace GtpVisibility
 
-#endif // BatchedQueriesCullingManager_H
+#endif // CoherentHierarchicalCullingPlusPlusManager_H
