Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.h	(revision 3085)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.h	(revision 3102)
@@ -96,4 +96,7 @@
 	static void SetUseLODs(bool useLODs) { sUseLODs = useLODs; }
 
+	static bool GetUseLODs() { return sUseLODs; }
+
+
 
 protected:
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.h	(revision 3062)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.h	(revision 3102)
@@ -165,5 +165,5 @@
 Matrix4x4 GetFrustum(float left, float right, float bottom, float top, float near, float far);
 Matrix4x4 LookAt(const Vector3 &pos, const Vector3 &dir, const Vector3& up);
-Matrix4x4 GetOrtho(float fov, float aspect, float near, float far);
+Matrix4x4 GetOrtho(float left, float right, float bottom, float top, float near, float far);
 Matrix4x4 GetPerspective(float fov, float aspect, float near, float far);
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.cpp	(revision 3074)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.cpp	(revision 3102)
@@ -52,5 +52,6 @@
 mShowBounds(false),
 mRenderQueue(NULL),
-mMaxVisibleDistance(.0f)
+mMaxVisibleDistance(.0f),
+mRenderDynamicObjects(true)
 {
 }
@@ -156,5 +157,9 @@
 
 	// add root node to queue
-	EnqueueNode(mBvh->GetRoot());
+	if (mRenderDynamicObjects)
+		EnqueueNode(mBvh->GetRoot());
+	else
+		EnqueueNode(mBvh->GetStaticRoot());
+
 	
 
@@ -278,3 +283,8 @@
 
 
-}
+void RenderTraverser::SetRenderDynamicObjects(bool dynamic)
+{
+	mRenderDynamicObjects = dynamic;
+}
+
+}
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Camera.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Camera.h	(revision 3063)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Camera.h	(revision 3102)
@@ -195,5 +195,37 @@
 };
 
-
+/** Classs representing an orthographics camera.
+*/
+class OrthoCamera: public Camera
+{
+	friend class ShadowMap;
+
+public:
+	/** Default constructor.
+	*/
+	OrthoCamera();
+	/** Camera taking the frustum left, right, bottom, top.
+	*/
+	OrthoCamera(float l, float r, float b, float t);
+
+	/** Camera taking the frustum left, right, bottom, top, near, far.
+	*/
+	OrthoCamera(float l, float r, float b, float t, float n, float f);
+
+
+protected:
+	/** Calculates the current projection matrix.
+	*/
+	virtual void UpdateProjectionMatrix();
+
+
+	//////////
+	//-- members
+
+	float mLeft;
+	float mRight;
+	float mBottom;
+	float mTop;
+};
 }
 #endif
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp	(revision 3101)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp	(revision 3102)
@@ -7,4 +7,6 @@
 #include "FrameBufferObject.h"
 #include "RenderState.h"
+#include "SceneEntity.h"
+
 
 #include <IL/il.h>
@@ -140,13 +142,5 @@
 	const float ylen = mSceneBox.Size().y * .5f;
 	
-	PerspectiveCamera *orthoCam = new PerspectiveCamera(xlen / ylen);
-	//orthoCam->SetOrtho(true);
-
-	orthoCam->SetNear(0.0f);
-	orthoCam->Yaw(.5 * M_PI);
-	orthoCam->SetDirection(Vector3(0, 0, -1));
-
 	Vector3 pos = Vector3(mSceneBox.Center().x, mSceneBox.Center().y, mSceneBox.Max().z);
-	orthoCam->SetPosition(pos);
 
 	FrameBufferObject *fbo = new FrameBufferObject(texWidth, texHeight, FrameBufferObject::DEPTH_32, true);
@@ -166,25 +160,23 @@
 	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
-	// hack: disable cull face because of alpha textured balconies
-	glDisable(GL_CULL_FACE);
-	mRenderState->LockCullFaceEnabled(true);
-
-	//glDisable(GL_CULL_FACE);
-	//glEnable(GL_DEPTH_TEST);
-
 	glMatrixMode(GL_MODELVIEW);
 	glPushMatrix();
-	glLoadIdentity();
+	//glLoadIdentity();
 
 	glMatrixMode(GL_PROJECTION);
 	glPushMatrix();
-	glLoadIdentity();
-
-	glOrtho(xlen, -xlen, ylen, -ylen, 0.0f, mSceneBox.Size().z); 
-	//glOrtho(xlen, .0f, ylen, .0f, .0f, mSceneBox.Size().z); 
-
-	glMatrixMode(GL_MODELVIEW);
-
-	orthoCam->SetupCameraView();
+	//glLoadIdentity();
+
+	OrthoCamera *orthoCam = new OrthoCamera(xlen, -xlen, ylen, -ylen, .0f, mSceneBox.Size().z);
+	
+	orthoCam->Yaw(.5 * M_PI);
+	orthoCam->SetDirection(Vector3(0, 0, -1));
+	orthoCam->SetPosition(pos);
+
+	orthoCam->SetupViewProjection();
+
+	//glOrtho(xlen, -xlen, ylen, -ylen, 0.0f, mSceneBox.Size().z); 
+	//glMatrixMode(GL_MODELVIEW);
+	//orthoCam->SetupCameraView();
 
 	mDepth = new float[texHeight * texWidth];
@@ -196,6 +188,11 @@
 	glEnableClientState(GL_NORMAL_ARRAY);
 
+	// hack: use highest lod level for trees (billboards)
+	LODLevel::InitFrame(Vector3(1e6f));
+
 	// forward rendering
 	mRenderState->SetRenderTechnique(0);
+	// temporarilly switch off
+	renderer->SetRenderDynamicObjects(false);
 
 	renderer->RenderScene();
@@ -205,7 +202,6 @@
 
 	renderer->SetCamera(oldCam);
-	
-	mRenderState->LockCullFaceEnabled(false);
-	//glEnable(GL_CULL_FACE);
+	// temporarilly switch off
+	renderer->SetRenderDynamicObjects(true);
 
 	glMatrixMode(GL_MODELVIEW);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.h	(revision 3074)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.h	(revision 3102)
@@ -528,5 +528,9 @@
 	*/
 	inline BvhNode *GetRoot();
-
+	/** Returns the static root node of the bvh.
+	*/
+	inline BvhNode *GetStaticRoot();
+	/** Returns the dynamic root node of the bvh.
+	*/
 	inline BvhNode *GetDynamicRoot();
 	/** Returns the bounding box of this bvh.
@@ -850,4 +854,10 @@
 
 
+BvhNode *Bvh::GetStaticRoot()
+{ 
+	return mStaticRoot; 
+}
+
+
 const AxisAlignedBox3 &Bvh::GetBox() const 
 { 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp	(revision 3101)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp	(revision 3102)
@@ -44,7 +44,5 @@
 	for (int i = 0; i < l; ++ i)
 	{
-		if (mLODLevels[i].GetSquaredDistance() > dist)
-			break;
-
+		if (mLODLevels[i].GetSquaredDistance() > dist) break;
 		mCurrentLODLevel = i;
 	}
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3101)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3102)
@@ -458,5 +458,5 @@
 	//-- load some dynamic stuff
 
-	LoadModel("hbuddha.dem", dynamicObjects);
+	/*LoadModel("hbuddha.dem", dynamicObjects);
 	//LoadModel("hbuddha2.dem", dynamicObjects);
 	buddha = dynamicObjects.back();
@@ -484,4 +484,5 @@
 	}
 
+*/
 
 	///////////
@@ -883,5 +884,5 @@
 
 	Matrix4x4 mat = TranslationMatrix(planepos);
-	buddha->GetTransform()->SetMatrix(mat);
+	//buddha->GetTransform()->SetMatrix(mat);
 
 	Vector3 oldPos = camera->GetPosition();
@@ -1987,9 +1988,9 @@
 	shadowMap->ComputeShadowMap(shadowTraverser, viewProjMat);
 
-	glEnable(GL_CULL_FACE);
 	camera->SetFar(farDist);
 
 	renderState.SetUseAlphaToCoverage(true);
 	renderState.LockCullFaceEnabled(false);
+	glEnable(GL_CULL_FACE);
 
 	glEnableClientState(GL_NORMAL_ARRAY);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.cpp	(revision 3078)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.cpp	(revision 3102)
@@ -751,7 +751,7 @@
 
 
-/** The resultig matrix that is equal to the result of glOrtho
+/** The resulting matrix is equal to the result of glOrtho
 */
-Matrix4x4 GetOrtho(float left, float right, float bottom, float top, float far, float near)
+Matrix4x4 GetOrtho(float left, float right, float bottom, float top, float near, float far)
 {
 	Matrix4x4 m;
@@ -778,5 +778,5 @@
 	m.x[3][0] = (right + left) * xDif;
 	m.x[3][1] = (top + bottom) * yDif;
-	m.x[3][2] = (far + near) * zDif;
+	m.x[3][2] = (far + near)   * zDif;
 	m.x[3][3] = 1.0f;
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.h	(revision 3065)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.h	(revision 3102)
@@ -137,4 +137,7 @@
 	*/
 	float GetMaxVisibleDistance() const { return mMaxVisibleDistance; }
+	/** Render also dynamic objects.
+	*/
+	void SetRenderDynamicObjects(bool dynamic);
 
 
@@ -210,4 +213,6 @@
 
 	bool mUseDepthPass;
+
+	bool mRenderDynamicObjects;
 };
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Camera.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Camera.cpp	(revision 3063)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Camera.cpp	(revision 3102)
@@ -276,10 +276,12 @@
 void Camera::GetProjectionMatrix(Matrix4x4 &m)const
 {
+	//glGetFloatv(GL_PROJECTION_MATRIX, (float *)m.x);
 	m = mProjection;
 }
 
 
-/*********************************************************/
-/*       Class PerspectiveCamera implementation           */
+
+/*********************************************************/
+/*       Class PerspectiveCamera implementation          */
 /*********************************************************/
 
@@ -385,4 +387,11 @@
 
 
+void PerspectiveCamera::UpdateProjectionMatrix()
+{
+	mProjection = GetPerspective(mFOVy, 1.0f / mAspect, mNear, mFar);
+}
+
+
+
 void PerspectiveCamera::ComputePoints(Vector3 &ftl, Vector3 &ftr, Vector3 &fbl, Vector3 &fbr,
 									  Vector3 &ntl, Vector3 &ntr, Vector3 &nbl, Vector3 &nbr,
@@ -397,9 +406,39 @@
 
 
-void PerspectiveCamera::UpdateProjectionMatrix()
-{
-	mProjection = GetPerspective(mFOVy, 1.0f / mAspect, mNear, mFar);
-}
-
-
-}
+
+/*********************************************************/
+/*          Class OrthoCamera implementation             */
+/*********************************************************/
+
+
+OrthoCamera::OrthoCamera(): 
+mLeft(0), mRight(1), mBottom(0), mTop(1)
+{
+	mNear = 0; mFar = 1;
+	UpdateProjectionMatrix();
+}
+
+
+OrthoCamera::OrthoCamera(float l, float r, float b, float t): 
+mLeft(l), mRight(r), mBottom(b), mTop(t)
+{
+	mNear = 0; mFar = 1;
+	UpdateProjectionMatrix();
+}
+
+
+OrthoCamera::OrthoCamera(float l, float r, float b, float t, float n, float f): 
+mLeft(l), mRight(r), mBottom(b), mTop(t)
+{
+	mNear = n; mFar = f;
+	UpdateProjectionMatrix();
+}
+
+
+void OrthoCamera::UpdateProjectionMatrix()
+{
+	mProjection = GetOrtho(mLeft, mRight, mBottom, mTop, mNear, mFar);
+}
+
+
+}
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj	(revision 3071)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj	(revision 3102)
@@ -228,26 +228,4 @@
 			</File>
 			<File
-				RelativePath=".\src\RenderTraverser.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)\$(InputName)1.obj"
-						XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)\$(InputName)1.obj"
-						XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
 				RelativePath=".\src\SampleGenerator.cpp"
 				>
@@ -325,26 +303,4 @@
 				</File>
 				<File
-					RelativePath=".\src\CHCTraverser.cpp"
-					>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							ObjectFile="$(IntDir)\$(InputName)1.obj"
-							XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							ObjectFile="$(IntDir)\$(InputName)1.obj"
-							XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
-						/>
-					</FileConfiguration>
-				</File>
-				<File
 					RelativePath=".\src\CHCTraverser.h"
 					>
@@ -389,5 +345,49 @@
 				</File>
 				<File
+					RelativePath=".\src\CHCTraverser.cpp"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							ObjectFile="$(IntDir)\$(InputName)1.obj"
+							XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							ObjectFile="$(IntDir)\$(InputName)1.obj"
+							XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
 					RelativePath=".\src\FrustumCullingTraverser.cpp"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							ObjectFile="$(IntDir)\$(InputName)1.obj"
+							XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							ObjectFile="$(IntDir)\$(InputName)1.obj"
+							XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath=".\src\RenderTraverser.cpp"
 					>
 					<FileConfiguration
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp	(revision 3089)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp	(revision 3102)
@@ -368,5 +368,5 @@
 		ambient.x = ambient.y = ambient.z = 0.2f;
 		diffuse.x = diffuse.y = diffuse.z = 1.0f;
-		black.x = black.y = black.z = .0f;
+		black.x   = black.y   = black.z   = .0f;
 
 		// only write rgb part of the material
