Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp	(revision 2961)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp	(revision 2963)
@@ -41,10 +41,13 @@
 		int index = (int)strtol(str, NULL, 10) - 1;
 
-		str = strtok_s(substrings[i], "/", &next_token);	  
+		int tIndex = index;
+		int nIndex = index;
+
+		/*str = strtok_s(substrings[i], "/", &next_token);	  
 		int tIndex = (int)strtol(str, NULL, 10) - 1;
 
 		str = strtok_s(substrings[i], "/", &next_token);	  
 		int nIndex = (int)strtol(str, NULL, 10) - 1;
-
+*/
 		// store indices
 		if (index >= 0)
@@ -70,5 +73,14 @@
 			faceVertices.push_back(vertices[indices[idx2]]);
 			faceVertices.push_back(vertices[indices[idx3]]);
-		
+	
+			Vector3 dummy(1, 0, 0);
+			faceNormals.push_back(dummy);
+			faceNormals.push_back(dummy);
+			faceNormals.push_back(dummy);
+
+			/*
+			const Vector3 v2 = mVertices[2] - mVertices[1];
+			Normalize(CrossProd(v2, v1));
+
 			faceNormals.push_back(normals[nIndices[idx1]]);
 			faceNormals.push_back(normals[nIndices[idx2]]);
@@ -78,4 +90,5 @@
 			faceTexcoords.push_back(texcoords[tIndices[idx2]]);
 			faceTexcoords.push_back(texcoords[tIndices[idx3]]);
+			*/
 		}
 	}
@@ -129,6 +142,9 @@
 		geom->mNormals[i].z = faceNormals[i].y;
 
-		geom->mTexcoords[i].first = faceTexcoords[i].first;
-		geom->mTexcoords[i].second = faceTexcoords[i].second;
+		if (i <= geom->mTexcoordCount)
+		{
+			geom->mTexcoords[i].first = faceTexcoords[i].first;
+			geom->mTexcoords[i].second = faceTexcoords[i].second;
+		}
 	}
 
@@ -228,4 +244,16 @@
 					        faceVertices, faceNormals, faceTexcoords);
 
+				if (((line % 100) == 99) && 
+					!faceVertices.empty())
+				{
+					++ mNumShapes;
+
+					LoadShape(faceVertices, faceNormals, faceTexcoords);
+
+					faceVertices.clear();
+					faceNormals.clear();
+					faceTexcoords.clear();
+				}
+
 				break;
 			}   // end face
@@ -286,6 +314,6 @@
 	//-- texture
 
-	//int texId = -1;
-	int texId = 0;
+	int texId = -1;
+	//int texId = 0;
 	str.write(reinterpret_cast<char *>(&texId), sizeof(int));
 
@@ -330,6 +358,6 @@
 	//-- write textures
 
-	int textureCount = 1;
-	//int textureCount = 0;
+	//int textureCount = 1;
+	int textureCount = 0;
 
 	ofile.write(reinterpret_cast<char *>(&textureCount), sizeof(int));
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/main.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/main.cpp	(revision 2961)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/main.cpp	(revision 2963)
@@ -21,9 +21,12 @@
 	}
 */
-	if (!converter.Convert(model_path + "toyplane.obj", model_path + "toyplane.dem"))
-		cerr << "conversion failed" << endl;
+	//if (!converter.Convert(model_path + "toyplane.obj", model_path + "toyplane.dem"))
+	//	cerr << "conversion failed" << endl;
 
 	//if (!converter.Convert(model_path + "sky.obj", model_path + "sky.dem"))
 	//	cerr << "conversion failed" << endl;
+
+	if (!converter.Convert(model_path + "city_full.obj", model_path + "city_full.dem"))
+		cerr << "conversion failed" << endl;
 
 	cout << "conversion successful" << endl;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhLoader.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhLoader.cpp	(revision 2962)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhLoader.cpp	(revision 2963)
@@ -77,5 +77,5 @@
 	newRoot->mLast = root->mLast;
 
-	// create 'dynamic' leaf which basicly is a container
+	// create 'dynamic' leaf which basically is a container
 	// for all dynamic objects
 	BvhLeaf *dynamicLeaf = new BvhLeaf(newRoot);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 2961)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 2963)
@@ -235,11 +235,13 @@
 	str.read(reinterpret_cast<char *>(&entityCount), sizeof(int));
 
-	entities.resize(entityCount);
+	entities.reserve(entityCount);
 
 	for (int i = 0; i < entityCount; ++ i)
 	{
 		SceneEntity *ent = LoadSceneEntity(str);
-		entities[i] = ent;
-
+
+		// return loaded entities
+		entities.push_back(ent);
+		// also store internally
 		mSceneEntities.push_back(ent);
 	}
@@ -275,5 +277,4 @@
 	mGeometryTable.clear();
 	mMaterialTable.clear();
-	//mShapesTable.clear();
 
 	return true;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.cpp	(revision 2931)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.cpp	(revision 2963)
@@ -154,5 +154,5 @@
 	RenderFrustum();
 
-	ShadowMap::DrawPolys();
+	ShadowMap::VisualizeFrustra();
 
 	Vector3 pos = mCamera->GetPosition();
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.h	(revision 2952)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.h	(revision 2963)
@@ -21,5 +21,6 @@
 class DirectionalLight;
 
-/** This class implements a the computation of single shadow map
+/** This class implements a the computation of single shadow map using 
+	LispSM (light space perspective shadow mapping)
 */
 class ShadowMap
@@ -28,5 +29,5 @@
 public:
 	/** Constructor taking the scene boundig box and the current camera. 
-		The shadow map has resolution size * size.
+		The shadow map has resolution size squared.
 	*/
 	ShadowMap(DirectionalLight *light, int size, const AxisAlignedBox3 &sceneBox, Camera *cam);
@@ -39,7 +40,7 @@
 	*/
 	unsigned int GetShadowColorTexture() const;
-	
+	/** Returns the depth texture used for shadow comparison.
+	*/
 	unsigned int GetDepthTexture() const;
-
 	/** Returns computed texture matrix. It must be applied on the
 		the world space positions. 
@@ -53,10 +54,13 @@
 	*/
 	int GetSize() const { return mSize; }
-
+	/** Returns the camera used for light view rendering.
+	*/
 	Camera *GetShadowCamera() const { return mShadowCam; }
-
+	/** Renders the scene from shadow view using conventional shading.
+	*/
 	void RenderShadowView(RenderTraverser *renderer, const Matrix4x4 &projView);
-
-	static void DrawPolys();
+	/** Draws LispSM intersection body B and the used light frustrum
+	*/
+	static void VisualizeFrustra();
 
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp	(revision 2954)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp	(revision 2963)
@@ -427,4 +427,5 @@
 	else
 	{
+		// hack: use dummy wrapper in order to use function
 		static BvhNodeContainer dummy(1);
 		dummy[0] = node;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp	(revision 2954)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp	(revision 2963)
@@ -156,5 +156,5 @@
 
 
-static void DrawPoly(Polyhedron *poly, const Vector3 &color)
+static void DrawPolyhedron(Polyhedron *poly, const Vector3 &color)
 {
 	if (!poly) return;
@@ -179,8 +179,8 @@
 
 
-void ShadowMap::DrawPolys()
-{
-	DrawPoly(lightPoly, Vector3(1, 0, 1));
-	DrawPoly(polyhedron, Vector3(0, 1, 0));
+void ShadowMap::VisualizeFrustra()
+{
+	DrawPolyhedron(lightPoly, Vector3(1, 0, 1));
+	DrawPolyhedron(polyhedron, Vector3(0, 1, 0));
 }
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2961)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2963)
@@ -447,4 +447,16 @@
 
 	
+	
+	// set far plane based on scene extent
+	farDist = 10.0f * Magnitude(bvh->GetBox().Diagonal());
+	bvh->SetVirtualLeaves(trianglesPerVirtualLeaf);
+
+	camera->SetFar(Magnitude(bvh->GetBox().Diagonal()));
+	
+	InitCg();
+
+	DeferredRenderer::Init(sCgContext);
+	SkyPreetham::Init(sCgContext);
+
 	Vector3 cubeCenter(470.398f, 240.364f, 182.5f);
 	/*AxisAlignedBox3 box(cubeCenter - Vector3(2.0f), cubeCenter + Vector3(2.0f));
@@ -457,5 +469,6 @@
 	Matrix4x4 transl = TranslationMatrix(cubeCenter);
 	
-	const string aeroplaneStr = model_path + "toyplane.dem";
+	//const string aeroplaneStr = model_path + "toyplane.dem";
+	const string aeroplaneStr = model_path + "city_full.dem";
 
 	SceneEntityContainer dummy;
@@ -471,21 +484,4 @@
 	}
 
-	aeroplane = dummy[0];
-	aeroplane->GetTransform()->MultMatrix(transl);
-	dummy.clear();
-
-
-	// set far plane based on scene extent
-	farDist = 10.0f * Magnitude(bvh->GetBox().Diagonal());
-	bvh->SetVirtualLeaves(trianglesPerVirtualLeaf);
-
-	camera->SetFar(Magnitude(bvh->GetBox().Diagonal()));
-	
-	InitCg();
-
-	DeferredRenderer::Init(sCgContext);
-	SkyPreetham::Init(sCgContext);
-
-	
 	string skyDomeStr(model_path + "sky.dem");
 
@@ -500,6 +496,9 @@
 	}
 
-	skyDome = dummy[0];
-	
+	aeroplane = dummy[0];
+	skyDome = dummy[1];
+
+	aeroplane->GetTransform()->MultMatrix(transl);
+
 	const float turbitiy = 3.0f;
 	preetham = new SkyPreetham(turbitiy, skyDome);
@@ -1087,5 +1086,16 @@
 	{
 		// actually render the scene geometry using the specified algorithm
-		traverser->RenderScene();
+		//traverser->RenderScene();
+		state.Reset();
+	/*	SceneEntityContainer::const_iterator sit, sit_end = sceneEntities.end();
+
+		for (sit = sceneEntities.begin(); sit != sit_end; ++ sit)
+		{
+			renderQueue->Enqueue(*sit);
+		}*/
+
+		aeroplane->Render(&state);
+
+		renderQueue->Apply();
 	}
 
@@ -1112,5 +1122,5 @@
 
 	//state.Reset(); glEnable(GL_TEXTURE_2D);
-	aeroplane->Render(&state);
+	//aeroplane->Render(&state);
 
 
