Index: trunk/VUT/GtpVisibility/include/CoherentHierarchicalCullingManager.h
===================================================================
--- trunk/VUT/GtpVisibility/include/CoherentHierarchicalCullingManager.h	(revision 142)
+++ trunk/VUT/GtpVisibility/include/CoherentHierarchicalCullingManager.h	(revision 146)
@@ -16,11 +16,12 @@
 	CoherentHierarchicalCullingManager();
 	void RenderScene();
-	/** Sets assumed visibility which is a decition variable 
-		wether an occlusion query should be issued or not.
-		@param assumedVisibility indicates that same visibility should be assumed
-		 for approximately assumedVisibility frames. 
-		 if 0, no assumedVisibility will be tested.
+	/** Sets assumed visibility which is a an estimation for e 
+		how many frames the visibility is considered to be valied
+		@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(int assumedVisibility);
+	void SetAssumedVisibility(unsigned int assumedVisibility);
+
 protected:
 	/** Decides wether occlusion query should be issued depending on some 
@@ -29,5 +30,10 @@
 	*/
 	bool DecideQueryTest(HierarchyNode *node) const;
-	int mAssumedVisibility;
+
+	unsigned int mAssumedVisibility;
+	/** Threshold for rand function to return positive result with respect to
+		mAssumedVisibility.
+	*/
+	unsigned int mThreshold;
 };
 
Index: trunk/VUT/GtpVisibility/include/VisibilityManager.h
===================================================================
--- trunk/VUT/GtpVisibility/include/VisibilityManager.h	(revision 130)
+++ trunk/VUT/GtpVisibility/include/VisibilityManager.h	(revision 146)
@@ -55,4 +55,8 @@
 	*/
 	void SetUseChcOptimization(bool useOptimization);
+	/** Indicates for how long a frame is considered to be visible.
+		@param assumedVisibility estimation for how long visibility is assumed to be valid.
+	*/
+	void SetAssumedVisibility(unsigned int assumedVisibility);
 	/** Sets pointer to a query manager. 
 	*/
@@ -71,5 +75,5 @@
 
 	unsigned int mVisibilityThreshold;
-
+	unsigned int mAssumedVisibility;
 };
 } // namespace GtpVisibility
Index: trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp
===================================================================
--- trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp	(revision 142)
+++ trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp	(revision 146)
@@ -6,5 +6,5 @@
 //-----------------------------------------------------------------------
 CoherentHierarchicalCullingManager:: CoherentHierarchicalCullingManager():
-mAssumedVisibility(0)
+mAssumedVisibility(0), mThreshold(0)
 {
 	// initialise random generator because of assumed visibility
@@ -111,14 +111,19 @@
 }
 //-----------------------------------------------------------------------
-void CoherentHierarchicalCullingManager::SetAssumedVisibility(int assumedVisibility)
+void CoherentHierarchicalCullingManager::SetAssumedVisibility(unsigned int assumedVisibility)
 {
 	mAssumedVisibility = assumedVisibility;
+	
+	mThreshold = 0;
+
+	if (mAssumedVisibility)
+	{
+		mThreshold =  RAND_MAX / mAssumedVisibility;
+	}
 }
 //-----------------------------------------------------------------------
 bool CoherentHierarchicalCullingManager::DecideQueryTest(HierarchyNode *node) const
 {
-	bool result = false;
-	rand();
-	return result;
+	return rand() < mThreshold;
 }
 } // namespace GtpVisibility
Index: trunk/VUT/GtpVisibility/src/VisibilityManager.cpp
===================================================================
--- trunk/VUT/GtpVisibility/src/VisibilityManager.cpp	(revision 130)
+++ trunk/VUT/GtpVisibility/src/VisibilityManager.cpp	(revision 146)
@@ -46,4 +46,6 @@
 		case VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING:
 			mCullingManager = new CoherentHierarchicalCullingManager();
+			dynamic_cast<CoherentHierarchicalCullingManager *>(mCullingManager)->
+				SetAssumedVisibility(mAssumedVisibility);
 			break;
 
@@ -93,3 +95,14 @@
 	return mQueryManager;
 }
+void VisibilityManager::SetAssumedVisibility(unsigned int assumedVisibility)
+{
+	mAssumedVisibility = assumedVisibility;
+
+	if (VisibilityManager::GetCullingManagerType() == 
+		VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING)
+	{
+		dynamic_cast<CoherentHierarchicalCullingManager *>(mCullingManager)->
+				SetAssumedVisibility(mAssumedVisibility);
+	}
+}
 } // namespace GtpVisibility
