Index: trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env	(revision 526)
+++ trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env	(revision 530)
@@ -9,5 +9,5 @@
 #	filename vienna.x3d
 #	filename ../data/vienna/vienna-simple.x3d
-#	filename ../data/vienna/vienna-buildings.x3d
+	filename ../data/vienna/vienna-buildings.x3d
 #filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d
 #;../data/vienna/vienna-plane.x3d
@@ -15,5 +15,5 @@
 #	filename ../data/atlanta/atlanta2.x3d
 #	filename ../data/soda/soda.dat
-	filename ../data/soda/soda5.dat
+#	filename ../data/soda/soda5.dat
 }
 
@@ -21,5 +21,5 @@
 	# stored sample rays
 	samplesFilename rays.out
-	useGlRenderer true
+	useGlRenderer false
 #	type sampling
 	type vss
@@ -181,5 +181,5 @@
 	maxViewCells 100000
 	#percentage of total visible objects where pvs is considered invalid
-	maxPvsRatio 0.05
+	maxPvsRatio 0.1
 		
 	delayedConstruction true
@@ -199,5 +199,5 @@
 		colorCode Random
 		exportRays false
-		exportGeometry false
+		exportGeometry true
 	}
 	
@@ -287,9 +287,9 @@
 	Termination {
 		# parameters used for autopartition
-		minRays 		500
+		minRays 		400
 		minPolygons 		-1
 		maxDepth		30
 		minPvs 			10
-		minArea 		0.0001
+		minArea 		0.00008
 		#minArea 		0.000
 		maxRayContribution	0.3
Index: trunk/VUT/GtpVisibilityPreprocessor/src/Beam.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/Beam.cpp	(revision 526)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/Beam.cpp	(revision 530)
@@ -89,9 +89,9 @@
 	 Vector3 directions[4];
 	 
-	/* directions[0] = VssRay::GetDirection(dBox.Min().x, dBox.Min().y);
+	 directions[0] = VssRay::GetDirection(dBox.Min().x, dBox.Min().y);
 	 directions[1] = VssRay::GetDirection(dBox.Max().x, dBox.Min().y);
 	 directions[2] = VssRay::GetDirection(dBox.Max().x, dBox.Max().y);
 	 directions[3] = VssRay::GetDirection(dBox.Min().x, dBox.Max().y);
-*/
+
 	const Vector3 mainDir = directions[0] + directions[1] + directions[2] + directions[3];
 	return Normalize(mainDir);
Index: trunk/VUT/GtpVisibilityPreprocessor/src/dual_depth.cg
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/dual_depth.cg	(revision 528)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/dual_depth.cg	(revision 530)
@@ -3,8 +3,5 @@
 	float4 position  : POSITION;	//screen position
 	float4 color0    : COLOR0;
-	float4 color1    : COLOR1;		//lighting
-	float2 texcoord0 : TEXCOORD0;
-	float4 depthTexCoord: TEXCOORD1;
-	float3 normal	 : TEXCOORD2;
+	float4 depthTexCoord: TEXCOORD0;
 };
 
@@ -15,21 +12,16 @@
 };
 
-
-pixel main(fragment IN,   
-           uniform sampler2D shadowMap: TEXUNIT1,
-           uniform float doTexturing)
+pixel dual_depth(fragment IN,
+		 	     const uniform sampler2D depthMap)
 {
 	pixel OUT;
+
+	// the depth buffer	has to be compared to the current depth
+	float4 depth = tex2D(depthMap, IN.depthTexCoord.xy);
+	float test = IN.depthTexCoord.z / IN.depthTexCoord.w;
 	
-	float4 col = IN.color0;
-	
-	// the depth buffer	
-	float4 depth = tex2Dproj(shadowMap, IN.depthTexCoord);
-	float test = IN.depthTexCoord.z / IN.depthTexCoord.w;
 	// reject by alpha test
-	//if (test < depth.x)
-	//	OUT.color[4] = 0;
-		
-	//OUT.color = localcolor * shadow * IN.color1;
+	if (test < depth.x)
+		OUT.color.w = 0;
 
 	return OUT;
Index: trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp	(revision 527)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp	(revision 530)
@@ -347,4 +347,33 @@
 
 
+void VssPreprocess::VerifyBeamCasting()
+{
+
+	vector<VssLeaf *> leaves;
+	mVssTree->CollectLeaves(leaves);
+
+	for (int i = 0; i < 10; ++i)
+	{
+		const int index = (int)RandomValue(0, (Real)((int)leaf.size() - 1));
+		VssLeaf *leaf = leaves[index];
+
+		Beam beam;
+		AxisAlignedBox3 dirBox = mVssTree->GetDirBBox(leaf);
+		AxisAlignedBox3 box = mVssTree->GetBBox(leaf);
+		beam.Construct(dirBox, box);
+		Intersectable *sourceObj = mObjects[5];
+		BeamSampleStatistics stats;
+		mGlRenderer->SampleBeamContributions(sourceObj,
+											 beam,
+											 10000,
+											 stats);
+
+		Debug << "beam statistics: " << stats << endl;
+
+
+	}
+
+}
+
 float
 VssPreprocessor::GetAvgPvsSize(VssTree *tree,
Index: trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.h	(revision 517)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.h	(revision 530)
@@ -104,4 +104,6 @@
   
   void CastRay(const BspTree &tree, const VssRay & vssRay);
+
+  float VerifyBeamCasting(Beam &beam);
 };
 
Index: trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.cpp	(revision 529)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.cpp	(revision 530)
@@ -8,6 +8,4 @@
 
 #include <GL/glext.h>
-
-
 #include <Cg/cg.h>
 #include <Cg/cgGL.h>
@@ -15,9 +13,5 @@
 static CGcontext sCgContext = NULL;
 static CGprogram sCgFragmentProgram = NULL;
-//static CGprofile sCgFragmentProfile;// = CG_PROFILE_FP30;
-
-//static CGparameter sCgKdParam = NULL;
-//static CGparameter sCgModelViewProjParam = NULL;
-static CGprofile sCgFragmentProfile = CG_PROFILE_FP30;
+static CGprofile sCgFragmentProfile;
 
 GLuint depthMap;
@@ -163,5 +157,5 @@
 											   CG_SOURCE, "../src/dual_depth.cg",
 											   sCgFragmentProfile,
-											   NULL, 
+											   "dual_depth", 
 											   NULL);
 }
@@ -588,5 +582,5 @@
 	glShadeModel(GL_FLAT);
 	glDisable(GL_LIGHTING);
-	// needed to kill fragments
+	// needed to kill the fragments for the front buffer
 	glEnable(GL_ALPHA_TEST);
 	glAlphaFunc(GL_GREATER, 0);
@@ -812,3 +806,3 @@
 			  viewPoint.x, viewPoint.y, viewPoint.z, 
 			  up.x, up.y, up.z);
-}
+}			  
