Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3117)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3119)
@@ -102,5 +102,5 @@
 	// retrieve the sample from the last frame
 	const float4 oldPixel = tex2Dlod(oldTex, float4(oldTexCoords, .0f, .0f));
-
+	// the eye linear depth from the previous frame
 	const float oldEyeSpaceDepth = oldPixel.w;
 	
@@ -110,6 +110,6 @@
 	const float projectedEyeSpaceDepth = invlen * length(translatedPos);
 
-	float depthDif = (abs(eyeSpaceDepth - sampleEyeSpaceDepth) > 5.0f) ? 0 : 
-		abs(1.0f - oldEyeSpaceDepth / projectedEyeSpaceDepth);
+	float depthDif = (abs(eyeSpaceDepth - sampleEyeSpaceDepth) > 3.0f) ? 
+		0 : abs(1.0f - oldEyeSpaceDepth / projectedEyeSpaceDepth);
 
 	return depthDif;
@@ -207,5 +207,4 @@
 												);
 			//overallDepth += sampleDif;
-
 			if (sampleDif >= MIN_DEPTH_DIFF) ++ notValid;
 		}
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3118)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3119)
@@ -463,5 +463,6 @@
 	//-- load some dynamic stuff
 
-	LoadModel("hbuddha.dem", dynamicObjects);
+	LoadModel("fisch.dem", dynamicObjects);
+	//LoadModel("hbuddha.dem", dynamicObjects);
 	buddha = dynamicObjects.back();
 	
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/VboFormatConverter/VboFormatConverter.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/VboFormatConverter/VboFormatConverter.cpp	(revision 3110)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/VboFormatConverter/VboFormatConverter.cpp	(revision 3119)
@@ -9,107 +9,4 @@
 
 
-static void LoadIndices(char *str, 
-						const VertexArray &vertices, 
-						const VertexArray &normals, 
-						const vector<pair<float, float> > &texcoords,
-						VertexArray &faceVertices,
-						VertexArray &faceNormals,
-						vector<Texcoord> &faceTexcoords
-						)
-{
-	vector<char *> substrings;
-
-	char *next_token;
-
-	// extract the triples of the form v/t/n v/t/n ...
-	char *pch = strtok_s(str + 1, " ", &next_token);
-
-	while (pch != NULL)
-	{
-		substrings.push_back(pch);
-		pch = strtok_s(NULL, " ", &next_token);	  
-	}
-
-	vector<int> indices;
-	vector<int> nIndices;
-	vector<int> tIndices;
-
-	for (size_t i = 0; i < substrings.size(); ++ i)
-	{
-		// vertex, normal, texture indices
-		char *str = strtok_s(substrings[i], "/", &next_token);	  
-		int index = (int)strtol(str, NULL, 10) - 1;
-
-		int tIndex = index;
-		int nIndex = index;
-
-		str = strtok_s(substrings[i], "/", &next_token);	  
-
-		if (str != NULL)
-		{
-			int idx = (int)strtol(str, NULL, 10) - 1;
-			if (idx) tIndex = idx;
-		}
-		str = strtok_s(substrings[i], "/", &next_token);	  
-
-		if (str != NULL)
-		{
-			int idx = (int)strtol(str, NULL, 10) - 1;
-			if (idx) nIndex = idx;
-		}
-
-		// store indices
-		if (index >= 0)
-		{
-			indices.push_back(index);
-			nIndices.push_back(nIndex);
-			tIndices.push_back(tIndex);
-		}
-
-		// new triangle found
-		if (indices.size() > 2)
-		{
-			// change orientation of faces?
-#if 1
-			int idx1 = 0;
-			int idx2 = (int)indices.size() - 2;
-			int idx3 = (int)indices.size() - 1;
-#else
-			int idx3 = 0;
-			int idx2 = (int)indices.size() - 2;
-			int idx1 = (int)indices.size() - 1;
-#endif
-			faceVertices.push_back(vertices[indices[idx1]]);
-			faceVertices.push_back(vertices[indices[idx2]]);
-			faceVertices.push_back(vertices[indices[idx3]]);
-
-			if (!normals.empty())
-			{
-				faceNormals.push_back(normals[nIndices[idx1]]);
-				faceNormals.push_back(normals[nIndices[idx2]]);
-				faceNormals.push_back(normals[nIndices[idx3]]);
-			}
-			else
-			{
-				// no face normals?
-				const SimpleTri tri(vertices[indices[idx1]], vertices[indices[idx2]], vertices[indices[idx3]]);
-				const SimpleVec n = tri.GetNormal();
-
-				faceNormals.push_back(n);
-				faceNormals.push_back(n);
-				faceNormals.push_back(n);
-			}
-
-			if (!texcoords.empty())
-			{
-				faceTexcoords.push_back(texcoords[tIndices[idx1]]);
-				faceTexcoords.push_back(texcoords[tIndices[idx2]]);
-				faceTexcoords.push_back(texcoords[tIndices[idx3]]);
-			}
-		}
-	}
-}
-
-
 VboFormatConverter::VboFormatConverter()
 {}
@@ -131,195 +28,87 @@
 
 
-void VboFormatConverter::LoadShape(const VertexArray &faceVertices,
-								   const VertexArray &faceNormals,
-								   const vector<Texcoord> &faceTexcoords)
-{
-	int numElements = (int)faceVertices.size();
+bool VboFormatConverter::Convert(const string &filename,
+								 const std::string &outputFilename)
+{
+	mNumShapes = 0;
+	
+	for (size_t i = 0; i < mGeometry.size(); ++ i)
+	{
+		delete [] mGeometry[i]->mVertices;
+		delete [] mGeometry[i]->mNormals;
+		delete [] mGeometry[i]->mTexcoords;
+
+		delete mGeometry[i];
+	}
+	
+	mGeometry.clear();
+
+	if (!ReadFile(filename))
+	{
+		cerr << "could not read file" << endl;
+		return false;
+	}
+
+	if (!WriteFile(outputFilename))
+	{
+		cerr << "could not write file" << endl;
+		return false;
+	}
+
+
+	return true;
+}
+
+
+bool VboFormatConverter::ReadFile(const string &filename) 
+{
+	FILE *file;
+	if ((file = fopen(filename.c_str(), "r")) == NULL) return false;
+	
+	int line = 0;
+
+	const int len = 10000;
+	char str[len];
+
+	int numElements;
+
+	// first line only holds number of vertices
+	fgets(str, len, file);
+	sscanf(str, "%d", &numElements);
+
 	Geometry *geom = new Geometry();
 
 	// convert the triangles to geometry
+	geom->mVertexCount = numElements;
 	geom->mVertices = new SimpleVec[numElements];
 	geom->mNormals = new SimpleVec[numElements];
 	geom->mTexcoords = new Texcoord[numElements];
 
-	geom->mVertexCount = numElements;
-	geom->mTexcoordCount = (int)faceTexcoords.size();
-
-	cout << "number of vertices=" << numElements << endl;
-
-	for (int i = 0; i < numElements; ++ i)
-	{
-#if 0
-		// convert to our camera system: change y and z
-		geom->mVertices[i].x = faceVertices[i].x;
-		geom->mVertices[i].y = -faceVertices[i].z;
-		geom->mVertices[i].z = faceVertices[i].y;
-	
-		geom->mNormals[i].x = faceNormals[i].x;
-		geom->mNormals[i].y = -faceNormals[i].z;
-		geom->mNormals[i].z = faceNormals[i].y;
-#else
-		geom->mVertices[i].x = faceVertices[i].x;
-		geom->mVertices[i].y = faceVertices[i].y;
-		geom->mVertices[i].z = faceVertices[i].z;
-	
-		geom->mNormals[i].x = faceNormals[i].x;
-		geom->mNormals[i].y = faceNormals[i].y;
-		geom->mNormals[i].z = faceNormals[i].z;
-
-#endif
-		geom->mVertices[i].x += 470.398f;
-		geom->mVertices[i].y += 240.364f;
-		geom->mVertices[i].z += 182.5f;
-
-		if (i < geom->mTexcoordCount)
-		{
-			geom->mTexcoords[i].first = faceTexcoords[i].first;
-			geom->mTexcoords[i].second = faceTexcoords[i].second;
-		}
+	SimpleVec vtx, normal, tangent;
+	Texcoord tex;
+
+	cout << "elements: " << numElements << endl;
+	while (fgets(str, len, file) != NULL)
+	{
+		sscanf(str, "%f %f %f %f %f %f %f %f %f %f %f", 
+		       &vtx.x, &vtx.z, &vtx.y, 
+			   &normal.x, &normal.z, &normal.y, 
+			   &tex.first, &tex.second,
+			   &tangent.x, &tangent.y, &tangent.z);
+
+		vtx.x *= 0.07f;
+		vtx.y *= 0.07f;
+		vtx.z *= 0.07f;
+
+		geom->mVertices[line] = vtx;
+		geom->mNormals[line] = normal;
+		geom->mTexcoords[line] = tex;
+
+		++ line;
 	}
 
 	mGeometry.push_back(geom);
-}
-
-
-bool VboFormatConverter::Convert(const string &filename, const std::string &outputFilename)
-{
-	mNumShapes = 0;
-	
-	for (size_t i = 0; i < mGeometry.size(); ++ i)
-	{
-		delete [] mGeometry[i]->mVertices;
-		delete [] mGeometry[i]->mNormals;
-		delete [] mGeometry[i]->mTexcoords;
-
-		delete mGeometry[i];
-	}
-	
-	mGeometry.clear();
-
-	if (!ReadFile(filename))
-	{
-		cerr << "could not read file" << endl;
-		return false;
-	}
-
-	if (!WriteFile(outputFilename))
-	{
-		cerr << "could not write file" << endl;
-		return false;
-	}
-
-
-	return true;
-}
-
-
-bool VboFormatConverter::ReadFile(const string &filename) 
-{
-	FILE *file;
-
-	if ((file = fopen(filename.c_str(), "r")) == NULL)
-	{	
-		return false;
-	}
-	
-	VertexArray faceVertices; 
-	VertexArray faceNormals;
-	vector<Texcoord> faceTexcoords;
-
-	VertexArray vertices; 
-	VertexArray normals;
-	vector<Texcoord> texcoords;
-
-	vector<int> indices;
-
-	int line = 0;
-
-	const int len = 10000;
-	char str[len];
-
-	while (fgets(str, len, file) != NULL)
-	{
-//		if (1)//(line % 100) == 0)
-//			cout << "read line " << line << " " << str;
-		switch (str[0]) 
-		{
-		case 'v': // vertex or normal
-			{
-				float x, y, z;
-
-				switch (str[1]) 
-				{
-				case 'n' :
-					sscanf(str + 2, "%f %f %f", &x, &y, &z);
-					normals.push_back(SimpleVec(x, y, z));
-					break;
-				case 't':
-					sscanf(str + 2, "%f %f", &x, &y);
-					texcoords.push_back(pair<float, float>(x, y));
-					break;
-				default:
-					sscanf(str + 1, "%f %f %f", &x, &y, &z);
-					vertices.push_back(SimpleVec(x, y, z));
-					//cout <<"v " << x << " " << y << " "<< z << " ";
-				}
-				break;
-			}
-		case 'f': 
-			{
-				//////////
-				//-- indices in the current line
-
-				LoadIndices(str, 
-					        vertices, normals, texcoords, 
-					        faceVertices, faceNormals, faceTexcoords);
-
-				if (0 &&
-					(((line % 1000) == 999) && !faceVertices.empty()))
-				{
-					++ mNumShapes;
-
-					LoadShape(faceVertices, faceNormals, faceTexcoords);
-
-					faceVertices.clear();
-					faceNormals.clear();
-					faceTexcoords.clear();
-				}
-
-				break;
-			}   // end face
-		case 'g': // load a new shape
-			{/*
-				if (!faceVertices.empty())
-				{
-					++ mNumShapes;
-
-					LoadShape(faceVertices, faceNormals, faceTexcoords);
-
-					faceVertices.clear();
-					faceNormals.clear();
-					faceTexcoords.clear();
-				}*/
-			}
-			break;
-		default:
-			break;
-		}
-
-		++ line;
-	}
-
-	if (!faceVertices.empty())
-	{
-		++ mNumShapes;
-
-		LoadShape(faceVertices, faceNormals, faceTexcoords);
-
-		faceVertices.clear();
-		faceNormals.clear();
-		faceTexcoords.clear();
-	}
-
+
+	mNumShapes = 1;
 	fclose(file);
 	
@@ -346,6 +135,6 @@
 	//-- texture
 
-	//int texId = -1;
-	int texId = 0;
+	int texId = -1;
+	//int texId = 0;
 	str.write(reinterpret_cast<char *>(&texId), sizeof(int));
 
@@ -390,6 +179,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/VboFormatConverter/VboFormatConverter.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/VboFormatConverter/VboFormatConverter.h	(revision 3107)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/VboFormatConverter/VboFormatConverter.h	(revision 3119)
@@ -6,11 +6,4 @@
 #include <vector>
 
-/*struct SimpleVec
-{
-	SimpleVec() {}
-	SimpleVec(float _x, float _y, float _z): x(_x), y(_y), z(_z) {}
-
-	float x, y, z;
-};*/
 
 typedef std::vector<SimpleVec> VertexArray;
@@ -29,5 +22,5 @@
 	bool Convert(const std::string &inputFilename, 
 		         const std::string &outputFilename);
-	// const std::string textureFilename) const;
+				 //const std::string textureFilename) const;
 
 	~VboFormatConverter();
@@ -45,8 +38,4 @@
 	};
 
-	void LoadShape(const VertexArray &faceVertices,
-		           const VertexArray &faceNormals,
-				   const std::vector<Texcoord> &faceTexcoords);
-
 	void WriteGeometry(ogzstream &str, Geometry *geom);
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 3117)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 3119)
@@ -1,7 +1,10 @@
-#############################
-# environment file for the friendlyculling demo
+#####################################################
+#   environment file for the friendlyculling demo   #
+#####################################################
+
+
 
 ############
-## chc++ options
+# chc++ options
 
 assumedVisibleFrames=10
@@ -10,4 +13,11 @@
 trianglesPerVirtualLeaf=300
 
+################
+
+useLODs=1
+shadowSize=4096
+
+####################
+# camera / light options
 
 # move speed
@@ -17,10 +27,7 @@
 #keyRotation=1.5f
 
-
-winWidth=1024
-winHeight=768
-
-# initial positin + orientation
+# initial camera position
 camPosition=483.398f 242.364f 186.078f
+# initial camera orientation
 camDirection=1 0 0
 
@@ -28,14 +35,19 @@
 lightDirection=-0.3f 0.2f -0.7f
 
+
+#####################
+# window options
+
+winWidth=1024
+winHeight=768
+
 useFullScreen=0
-useLODs=1
-shadowSize=4096
+
 
 #modelPath=data/city/model/
 
 
-
 ############
-# shader stuff
+# shader options
 
 # ssao temporal coherence factor
