Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/IVReader/src/IVReader.vcproj
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/IVReader/src/IVReader.vcproj	(revision 2119)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/IVReader/src/IVReader.vcproj	(revision 2122)
@@ -73,5 +73,5 @@
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;..\include"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IVREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IVREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1;USE_VERBOSE_PVS"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreTypeConverter.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreTypeConverter.cpp	(revision 1621)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreTypeConverter.cpp	(revision 2122)
@@ -67,6 +67,4 @@
 		GtpVisibilityPreprocessor::VertexIndexContainer::const_iterator 
 			iit, iit_end = face->mVertexIndices.end();
-		//GtpVisibilityPreprocessor::VertexIndexContainer::const_reverse_iterator 
-		//	iit, iit_end = face->mVertexIndices.rend();
 
 		for (iit = face->mVertexIndices.begin(); iit != iit_end; ++ iit)
@@ -78,5 +76,4 @@
 
 	manual->end();
-	//mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(manual);
 
 	return manual;
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj	(revision 2119)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj	(revision 2122)
@@ -90,5 +90,5 @@
 				OptimizeForWindowsApplication="TRUE"
 				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include;..\..\..\Preprocessing\src\Timer;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\ObjReader\include"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1;USE_VERBOSE_PVS"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp	(revision 2119)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp	(revision 2122)
@@ -600,4 +600,11 @@
 void OcclusionCullingSceneManager::_renderVisibleObjects()
 {
+	// $$matt temp: Remove this!!
+	if (1) 
+	{
+		getDestinationRenderSystem()->_setCullingMode(CULL_NONE);
+		LogManager::getSingleton().logMessage("warning: culling mode");
+	}
+
 	if (mNormalExecution)
 	{
@@ -800,4 +807,5 @@
 	if (key == "DelayRenderTransparents")
 	{
+		//LoadScene(mFilename, mViewCellsFilename);
 		mDelayRenderTransparents = (*static_cast<const bool *>(val));
 		return true;
@@ -1709,6 +1717,4 @@
 	}
 
-	SceneNode *node = root->createChildSceneNode("ObjSceneNode");
-
 	std::stringstream d; 
 	d << "loaded " << filename << " in " << timer->getMilliseconds() * 1e-3 << " secs";
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/include/ObjReader.h
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/include/ObjReader.h	(revision 2119)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/include/ObjReader.h	(revision 2122)
@@ -20,5 +20,6 @@
 	Ogre::Entity *CreateEntity(const std::string &name,
 							   GtpVisibilityPreprocessor::Intersectable *object);
-
+	Ogre::ManualObject *CreateManualObject(const std::string &name,
+							   GtpVisibilityPreprocessor::Intersectable *object);
 protected:
 
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.vcproj
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.vcproj	(revision 2119)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.vcproj	(revision 2122)
@@ -73,5 +73,5 @@
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;..\include;..\..\..\Preprocessing\src"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;OBJREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;OBJREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1;USE_VERBOSE_PVS"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.cpp	(revision 2119)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.cpp	(revision 2122)
@@ -52,5 +52,5 @@
 
 	std::stringstream d; 
-	d << "successfully loaded " << pvsObjects.size() << " objects";
+	d << "successfully loaded " << pvsObjects.size() << " objects from " << preprocessor->mObjects.size() << " preprocessor objects";
 
 	Ogre::LogManager::getSingleton().logMessage(d.str());
@@ -60,16 +60,65 @@
 	int i = 0;
 	for (oit = pvsObjects.begin(); oit != oit_end; ++ oit, ++ i)
-	{Ogre::LogManager::getSingleton().logMessage("r");
-		const Ogre::String entname = "Object" + i;
-
-		Ogre::Entity *ent = CreateEntity(entname, *oit);
-
-		const Ogre::String nodeName = entname + "/Node";
-		root->createChildSceneNode(nodeName);
+	{
+		Ogre::LogManager::getSingleton().logMessage("r");
+		const Ogre::String entname = "Object" + Ogre::StringConverter::toString(i);
+
+		Ogre::ManualObject *ent = CreateEntity(entname, *oit);
+
+		const Ogre::String nodeName = entname + "Node";
+		Ogre::SceneNode* node = root->createChildSceneNode(nodeName);
+		node->attachObject(ent);
+
+		if (i > 100)
+			break;
 	}
 
 	delete preprocessor;
 
-	return false;
+	return true;
+}
+
+
+Ogre::ManualObject *ObjReader::CreateManualObject(const std::string &name,
+												  GtpVisibilityPreprocessor::Intersectable *object)
+{
+	using namespace Ogre;
+	//using namespace GtpVisibilityPreprocessor;
+
+	std::string meshName = name + ".mesh";
+	std::string entityName = name + "Entity";
+
+GtpVisibilityPreprocessor::BvhLeaf *bvhObj = 
+		static_cast<GtpVisibilityPreprocessor::BvhLeaf *>(object);
+	const int vertexCount = (int)bvhObj->mObjects.size() * 3;
+
+	ManualObject* manual = mSceneManager->createManualObject(entityName);
+	manual->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_STRIP);
+	
+	// create vertices
+	
+	GtpVisibilityPreprocessor::ObjectContainer::const_iterator oit, oit_end = bvhObj->mObjects.end();
+	
+	for (oit = bvhObj->mObjects.begin(); oit != oit_end; ++ oit)
+	{
+		GtpVisibilityPreprocessor::TriangleIntersectable *tObj = 
+			static_cast<GtpVisibilityPreprocessor::TriangleIntersectable *>(*oit);
+		
+		GtpVisibilityPreprocessor::Triangle3 tri = tObj->GetItem();
+
+		for (int i = 0; i < 3; ++ i)
+		{
+			const GtpVisibilityPreprocessor::Vector3 vtx = tri.mVertices[i];
+			manual->position(vtx.x, vtx.y, vtx.z);
+			manual->colour(1.0f, 0.0f, 0.0f);
+		}
+	}
+
+	for (int i = 0; i < vertexCount; ++ i)
+	{
+		manual->index(i);
+	}
+
+	return manual;
 }
 
@@ -79,5 +128,4 @@
 {
 	using namespace Ogre;
-	//using namespace GtpVisibilityPreprocessor;
 
 	Entity *entity;
@@ -86,9 +134,11 @@
 		static_cast<GtpVisibilityPreprocessor::BvhLeaf *>(object);
 
-	std::string meshName = name + "/Mesh";
-	std::string entityName = name + "/Entity";
-
-	MeshPtr mesh = MeshManager::getSingleton().createManual(meshName, "ObjGroup");
+	std::string meshName = name + ".mesh";
+	std::string entityName = name + "Entity";
+
+	MeshPtr mesh = MeshManager::getSingleton().createManual(meshName, "Custom");
 	SubMesh* submesh = mesh->createSubMesh();
+
+	const int vertexCount = (int)bvhObj->mObjects.size() * 3;
 
 	// We must create the vertex data, indicating how many vertices there will be
@@ -96,5 +146,8 @@
 	submesh->vertexData = new VertexData();
 	submesh->vertexData->vertexStart = 0;
-	submesh->vertexData->vertexCount = (int)bvhObj->mObjects.size() * 3;
+	submesh->vertexData->vertexCount = vertexCount;
+
+	std::stringstream d; d << "objects: " << bvhObj->mObjects.size() << " vtx: " << submesh->vertexData->vertexCount << endl;
+	Ogre::LogManager::getSingleton().logMessage(d.str());
 
 	static const unsigned short source = 0;
@@ -103,7 +156,7 @@
 	VertexDeclaration* declaration = HardwareBufferManager::getSingleton().createVertexDeclaration();
 
-	offset += declaration->addElement(source, offset, VET_FLOAT3,VES_POSITION).getSize();
-	//	offset += declaration->addElement(source,offset,VET_FLOAT3,VES_NORMAL).getSize();
-	//	offset += declaration->addElement(source,offset,VET_FLOAT2,VES_TEXTURE_COORDINATES).getSize();
+	offset += declaration->addElement(source, offset, VET_FLOAT3, VES_POSITION).getSize();
+	//offset += declaration->addElement(source, offset, VET_FLOAT3,VES_NORMAL).getSize();
+	//offset += declaration->addElement(source, offset, VET_FLOAT2,VES_TEXTURE_COORDINATES).getSize();
 
 
@@ -113,6 +166,5 @@
 		createVertexBuffer(declaration->getVertexSize(source),
 						   submesh->vertexData->vertexCount,
-						   HardwareBuffer::HBU_STATIC_WRITE_ONLY,
-						   false);
+						   HardwareBuffer::HBU_STATIC_WRITE_ONLY);
 
     // No we get access to the buffer to fill it.  During so we record the bounding box.
@@ -132,5 +184,5 @@
 		for (int i = 0; i < 3; ++ i)
 		{
-			Vector3 vtx(tri.mVertices[i]);
+			Vector3 vtx = Vector3(tri.mVertices[i]);
 
 			*vdata ++ = vtx.x;
@@ -138,19 +190,55 @@
 			*vdata ++ = vtx.z;
 
+			//std::stringstream d; d << vtx;
+			//Ogre::LogManager::getSingleton().logMessage(d.str());
 			aabox.merge(vtx);
 		}
 	}
-
+	//Ogre::LogManager::getSingleton().logMessage("***");
 	vbuffer->unlock();
+	
+	/*Ogre::RenderOperation rop;
+	submesh->_getRenderOperation(rop);
+	rop.useIndexes = false;
+*/
+	//////
+	//-- Creates the index data
+
+    submesh->vertexData->vertexBufferBinding->setBinding(source, vbuffer);
+
+	submesh->indexData->indexStart = 0;
+	// we use an index for every vertex
+	submesh->indexData->indexCount = vertexCount;
+	submesh->indexData->indexBuffer =
+	    HardwareBufferManager::getSingleton().
+			createIndexBuffer(HardwareIndexBuffer::IT_16BIT,
+							  submesh->indexData->indexCount,
+							  HardwareBuffer::HBU_STATIC_WRITE_ONLY);
+	submesh->operationType = RenderOperation::OT_LINE_STRIP;
+	//uint16* idata = static_cast<uint16*>(submesh->indexData->indexBuffer->lock(HardwareBuffer::HBL_DISCARD));
+    unsigned short* idata = static_cast<unsigned short*>(submesh->indexData->indexBuffer->lock(HardwareBuffer::HBL_DISCARD));
+
+	for (int j = 0; j < vertexCount; ++ j)
+    {
+		*idata = j;
+		++ idata;
+    }
+    
+	submesh->indexData->indexBuffer->unlock();
+
+	submesh->setMaterialName("BaseWhiteNoLighting"); 
 
 	// We must indicate the bounding box
 	mesh->_setBounds(aabox); 
-
-	mesh->_setBoundingSphereRadius((aabox.getMaximum()-aabox.getMinimum()).length()/2.0); 
+	mesh->_setBoundingSphereRadius((aabox.getMaximum() - aabox.getMinimum()).length() / 2.0); 
 	mesh->load();
-	
+	mesh->touch();
+
 	// Create an entity with the mesh
-	entity = mSceneManager->createEntity(meshName, entityName);
+	entity = mSceneManager->createEntity(entityName, meshName);
+
+	//entity->setRenderQueueGroup(Ogre::RENDER_QUEUE_MAIN);
 
 	return entity;
+#endif
 }
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 2119)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 2122)
@@ -1647,5 +1647,5 @@
 {
 	ObjectsParser parser;
-Debug << "here322 " << filename << endl;
+
 	const bool success = parser.ParseObjects(filename, 
 											 pvsObjects, 
@@ -1658,6 +1658,7 @@
 
 	// hack: no bvh object could be found => take preprocessor objects
-	if (!pvsObjects.empty())
-	{
+	if (pvsObjects.empty())
+	{
+		Debug << "here81 no objects" << endl;
 		pvsObjects = preprocessorObjects;
 	}
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 2120)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 2122)
@@ -1018,4 +1018,18 @@
 
 
+ViewCellsManager *ViewCellsManager::LoadViewCells(const string &filename, 
+												  ObjectContainer &pvsObjects,
+												  bool finalizeViewCells,
+												  BoundingBoxConverter *bconverter)
+												 
+{
+	ObjectContainer preprocessorObjects;
+
+	return LoadViewCells(filename, 
+						 pvsObjects,
+						 preprocessorObjects,
+						 finalizeViewCells,
+						 bconverter);
+}
 
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/PvsDefinitions.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/PvsDefinitions.h	(revision 2117)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/PvsDefinitions.h	(revision 2122)
@@ -10,39 +10,36 @@
 #ifdef USE_HASH_PVS
 
-#include "HashPvs.h"
+	#include "HashPvs.h"
 
-#define PVS_TYPE 0
+	#define PVS_TYPE 0
 
-namespace GtpVisibilityPreprocessor {
-typedef HashPvs<Intersectable *, PvsData> DefaultPvs;
-typedef HashPvsIterator<Intersectable *, PvsData> ObjectPvsIterator;
-}
+	namespace GtpVisibilityPreprocessor {
+		typedef HashPvs<Intersectable *, PvsData> DefaultPvs;
+		typedef HashPvsIterator<Intersectable *, PvsData> ObjectPvsIterator;
+	}
+#else
+	#ifdef USE_BIT_PVS
 
-#endif
+		#include "BitVectorPvs.h"
 
-#ifdef USE_VERBOSE_PVS
+		#define PVS_TYPE 2
 
-#include "Pvs.h"
+		namespace GtpVisibilityPreprocessor {
+			typedef BitVectorPvs<Intersectable *, PvsData> DefaultPvs;
+			typedef BitVectorPvsIterator<Intersectable *, PvsData> ObjectPvsIterator;
+		}
 
-#define PVS_TYPE 1
+	#else
 
-namespace GtpVisibilityPreprocessor {
-typedef VerbosePvs<Intersectable *, PvsData> DefaultPvs;
-typedef PvsIterator<Intersectable *, PvsData> ObjectPvsIterator;
-}
-#endif
+		//#ifdef USE_VERBOSE_PVS
+		#include "Pvs.h"
 
+		#define PVS_TYPE 1
 
-#ifdef USE_BIT_PVS
-
-#include "BitVectorPvs.h"
-
-#define PVS_TYPE 2
-
-namespace GtpVisibilityPreprocessor {
-typedef BitVectorPvs<Intersectable *, PvsData> DefaultPvs;
-typedef BitVectorPvsIterator<Intersectable *, PvsData> ObjectPvsIterator;
-}
-
+		namespace GtpVisibilityPreprocessor {
+			typedef VerbosePvs<Intersectable *, PvsData> DefaultPvs;
+			typedef PvsIterator<Intersectable *, PvsData> ObjectPvsIterator;
+		}
+	#endif
 #endif
 
