Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/antialiasing.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/antialiasing.cg	(revision 2864)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/antialiasing.cg	(revision 2864)
@@ -0,0 +1,70 @@
+struct v2p
+{
+	float tc0: TEXCOORD0; // Center
+	float tc1: TEXCOORD1; // Center
+	float tc2: TEXCOORD2; // Center
+	float tc3: TEXCOORD3; // Center
+	float tc4: TEXCOORD4; // Center
+	float tc5: TEXCOORD5; // Center
+	float tc6: TEXCOORD6; // Center
+}
+
+
+uniform sampler2D s_distort;
+uniform hlf4 e_barrier;
+uniform half4 e_weights;
+uniform half4 e_kernel;
+
+half4 main(v2p) : COLOR
+{
+
+
+	// discontinuity filter
+	/*float nc = tex1D(s_normal, I.tc0);
+	float nd;
+
+	nd.x = dot(nc, float3(tex2D(s_normal, I.tc1));
+	nd.y = dot(nc, float3(tex2D(s_normal, I.tc2));
+	nd.z = dot(nc, float3(tex2D(s_normal, I.tc3));
+	nd.w = dot(nc, float3(tex2D(s_normal, I.tc4));
+
+	nd -= e_barrier.x;
+	nd = max(0, nd);
+
+	float ne = saturate(dot(nd, e_weights.x));
+
+	float 4 tc5r = = I.tc5.wzyx;
+	float 4 tc6r = = I.tc6.wzyx;
+*/
+
+}
+
+
+
+
+struct fragment
+{
+  float4 pos: WPOS; // normalized screen position
+  float4 texCoord: TEXCOORD0; 
+};
+
+struct pixel
+{
+  float4 color: COLOR0;
+};
+
+
+pixel main(fragment IN, 
+	   uniform sampler2D colorsTex1,
+           uniform sampler2D colorsTex2)
+{
+  pixel OUT;
+  
+  float4 col1 = tex2D(colorsTex1, IN.texCoord.xy);
+  float4 col2 = tex2D(colorsTex2, IN.texCoord.xy);
+  
+  const float x = 0.5f;
+  OUT.color = col1 * x + col2 * (1.0f - x);
+
+  return OUT;
+}
Index: P/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/linearDepth.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/linearDepth.cg	(revision 2809)
+++ 	(revision )
@@ -1,35 +1,0 @@
-// input
-struct appdata 
-{
-    float4 pos: POSITION;
-    float4 color: COLOR0;
-    float4 texCoord: TEXCOORD0;
-};
-
-
-// output
-
-struct vfconn
-{
-     float4 pos	: POSITION;
-     float4 color0: COLOR0;
-     float4 texCoord0: TEXCOORD0; 
-     float4 lindepth: TEXCOORD1; 
-};
-
-
-vfconn main(appdata IN,	uniform float4x4 ModelViewProj)
-{
-   vfconn OUT;
-  
-   // Transform The Vertex Position Into Homogenous Clip-Space (Required)
-   OUT.pos = mul(ModelViewProj, IN.pos);
-
-   OUT.color0 = IN.color;
-   //OUT.color0[1] = 1.0f;
-
-   OUT.texCoord0 = IN.texCoord;
-   OUT.lindepth = OUT.pos;
-
-   return OUT;
-}
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.cpp	(revision 2806)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.cpp	(revision 2864)
@@ -168,18 +168,4 @@
 	glBegin(GL_LINE_LOOP);
 	glVertex3d(fbl.x, fbl.y, fbl.z);
-	glVertex3d(fbr.x, fbr.y, fbr.z);
-	glVertex3d(ftr.x, ftr.y, ftr.z);
-	glVertex3d(ftl.x, ftl.y, ftl.z);
-	glEnd();
-
-	glBegin(GL_LINE_LOOP);
-	glVertex3d(nbl.x, nbl.y, nbl.z);
-	glVertex3d(nbr.x, nbr.y, nbr.z);
-	glVertex3d(ntr.x, ntr.y, ntr.z);
-	glVertex3d(ntl.x, ntl.y, ntl.z);
-	glEnd();
-
-	glBegin(GL_LINE_LOOP);
-	glVertex3d(fbl.x, fbl.y, fbl.z);
 	glVertex3d(ftl.x, ftl.y, ftl.z);
 	glVertex3d(ntl.x, ntl.y, ntl.z);
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2861)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2864)
@@ -746,6 +746,4 @@
 void SetupEyeView()
 {
-	Matrix4x4 matViewing, matProjection;
-
 	// store matrix of last frame
 	oldViewProjMatrix = matProjectionView;
@@ -758,6 +756,9 @@
 	glMatrixMode(GL_MODELVIEW);
 	glLoadIdentity();
+
+	// set up the camera view
 	camera->SetupCameraView();
 
+	// set lights
 	GLfloat position[] = {0.8f, -1.0f, 0.7f, 0.0f};
 	glLightfv(GL_LIGHT0, GL_POSITION, position);
@@ -767,7 +768,12 @@
 
 	
+	/////////////////
+
+	Matrix4x4 matViewing, matProjection;
+
 	camera->GetModelViewMatrix(matViewing);
 	camera->GetProjectionMatrix(matProjection);
 
+	// store matrix for later use
 	matProjectionView = matViewing * matProjection;
 	
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCPlusPlusTraverser.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCPlusPlusTraverser.cpp	(revision 2850)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCPlusPlusTraverser.cpp	(revision 2864)
@@ -82,4 +82,7 @@
 void CHCPlusPlusTraverser::Traverse()
 {
+	int waitedForQueries = 0;
+	int returnedQueries = 0;
+
 	//-- PART 1: process finished occlusion queries
 	while (!mDistanceQueue.empty() || !mQueryQueue.empty())
@@ -101,4 +104,8 @@
 			}
 			
+			if (!resultAvailable)
+				++ waitedForQueries;
+			++ returnedQueries;
+
 			OcclusionQuery *query = mQueryQueue.front();
 			mQueryQueue.pop();
@@ -211,4 +218,6 @@
 		HandleQueryResult(query);
 	}
+
+	//cout << "returned queries: " << returnedQueries << " waited for queries: " << waitedForQueries << " (=" << 100.0f * waitedForQueries / returnedQueries << "%)" << endl;
 }
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Camera.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Camera.cpp	(revision 2860)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Camera.cpp	(revision 2864)
@@ -221,21 +221,10 @@
 
 
-void Camera::SetDirection(const Vector3 &direction)
-{
-	Vector3 h1 = direction; h1.z = 0; 
-	
-	if (SqrMagnitude(h1) > 0)
-	{
-		h1.Normalize();
-		mPitch = acos(DotProd(h1, Vector3(0, 1, 0)));
-	}
-
-	Vector3 h2 = direction; 
-	
-	if (SqrMagnitude(h2) > 0)
-	{
-		h2.Normalize();
-		mYaw = -acos(DotProd(h2, h1));
-	}
+void Camera::SetDirection(const Vector3 &dir)
+{
+	Normalize(dir);
+
+	mPitch = atan2(dir.x, dir.z);
+	mYaw = atan2(dir.y, sqrt((dir.x * dir.x) + (dir.z * dir.z)));
 
 	CalculateFromPitchAndYaw();
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 2861)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 2864)
@@ -10,5 +10,5 @@
 winHeight=768
 camPosition=483.398f 242.364f 186.078f
-camDirection=1 0 0
+camDirection=-1 -1 0
 useFullScreen=0
 #modelPath=data/city/model/
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj	(revision 2861)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj	(revision 2864)
@@ -784,4 +784,8 @@
 			>
 			<File
+				RelativePath=".\src\shaders\antialiasing.cg"
+				>
+			</File>
+			<File
 				RelativePath=".\src\shaders\deferred.cg"
 				>
