Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/include/ObjReader.h
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/include/ObjReader.h	(revision 2112)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/include/ObjReader.h	(revision 2115)
@@ -31,4 +31,6 @@
 	
 	const std::vector<Ogre::Entity *> &GetObjects() const;
+	
+	Ogre::Entity *CreateEntity(const std::string &name);
 
 protected:
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.cpp	(revision 2112)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.cpp	(revision 2115)
@@ -57,49 +57,82 @@
 
 
-#if TODO
-
-Ogre::Entity *IVReader::createEntity(Ogre::SceneManager* sceneMgr, 
-									 std::string name, 
-									 ObjMeshData *mData, 
-									 Ogre::Vector3 *translation)
+Ogre::Entity *ObjReader::CreateEntity(const std::string &name)
+//									  ObjMeshData *mData, 
+//									  Ogre::Vector3 *translation)
 {
 	using namespace Ogre;
+	Entity *entity;
 
+	
 	std::string meshName = name.substr(name.find('/',0), name.length()) + "/Mesh";
 	std::string entityName = name + "/Entity";
 
-	Mesh* pMesh = NULL;
-	if ((pMesh = (Mesh *) MeshManager::getSingleton().getByName(meshName).getPointer()) == NULL)
+	MeshPtr mesh = MeshManager::getSingleton().createManual(meshName, "ObjGroup");
+	SubMesh* submesh = mesh->createSubMesh();
+int nbVertices = 99992;
+	// We must create the vertex data, indicating how many vertices there will be
+	submesh->useSharedVertices = false;
+	submesh->vertexData = new VertexData();
+	submesh->vertexData->vertexStart = 0;
+	submesh->vertexData->vertexCount = nbVertices;
+
+	static const unsigned short source = 0;
+	size_t offset = 0;
+
+	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();
+
+
+	int numVertices = 0;
+
+	HardwareVertexBufferSharedPtr vbuffer = 
+		HardwareBufferManager::getSingleton().createVertexBuffer(declaration->getVertexSize(source), // size of one whole vertex
+		submesh->vertexData->vertexCount, // number of vertices
+		HardwareBuffer::HBU_STATIC_WRITE_ONLY, // usage
+		false); // no shadow buffer
+
+
+	// No we get access to the buffer to fill it.  During so we record the bounding box.
+	AxisAlignedBox aabox;
+
+	float* vdata = static_cast<float*>(vbuffer->lock(HardwareBuffer::HBL_DISCARD));
+
+	for (size_t i = 0; i < nbVertices; ++ i)
 	{
+		// Position
+		Vector3 position;// = 20.0f*positions[i];
+		*vdata++ = position.x;
+		*vdata++ = position.y;
+		*vdata++ = position.z;
+		aabox.merge(position);
+		// Normal
+		Vector3 normal = position.normalisedCopy();
+		*vdata++ = normal.x;
+		*vdata++ = normal.y;
+		*vdata++ = normal.z;
 
-		ObjMeshData *data = mData->expand();
+		// Texture coordinate
+		Vector2 tcoordinate;// = tcoordinates[i];
+		*vdata ++ = tcoordinate.x;
 
-		ObjManualMeshLoader *loader	= new ObjManualMeshLoader(data);
+		*vdata ++ = tcoordinate.y;
 
-		if (translation != NULL) *translation = data->boundingBox->getCenter();
-
-		addMeshToList(meshName, loader);
-
-		Mesh* pMesh = MeshManager::getSingleton().createManual(meshName, "IVGroup", loader).getPointer(); 
-
-		pMesh->load(); 
-		pMesh->touch();
-	}
-	else
-	{
-		if (translation != NULL)
-		{
-			*translation = meshList->getManualMeshLoader(meshName)->getBoundingBox()->getCenter();
-		}
 	}
 
-	Entity *pEntity = sceneMgr->createEntity(entityName, meshName);
+	vbuffer->unlock();
 
+	// We must indicate the bounding box
+	//mesh->_setBounds(aabox); 
 
-	if (0) pEntity->setRenderQueueGroup(Ogre::RENDER_QUEUE_MAIN);
+	//mesh->_setBoundingSphereRadius((aabox.getMaximum()-aabox.getMinimum()).length()/2.0); 
 
-	return pEntity;
+	mesh->load();
+	
+	// Create an entity with the mesh
+	//entity = mSceneManager->createEntity(meshName, entityName);
+
+	return entity;
 }
-
-
-#endif
