aida
22-08-2007 10:56:29
Hi
Is there a similar code as the following to parse an osm scene file to build a treecollision (the following code uses the dotSceneManager plugin i.e. parses a .scene file)
It's just that I use ofusion to export meshes from 3DSMax and create the scene in Ogre. So I already parse the osm file once to load the scene. It's a shame to do it again with dotSceneManager to build the collision body....
Is there a similar code as the following to parse an osm scene file to build a treecollision (the following code uses the dotSceneManager plugin i.e. parses a .scene file)
//needs Plugin_DotSceneManager.dll
DotSceneOctreeManager * mDotSceneMgr = (DotSceneOctreeManager *)root->createSceneManager("DotSceneOctreeManager");
mDotSceneMgr->setWorldGeometry("scene.scene");
int numMeshes;
mDotSceneMgr->getOption("NumMeshes", &numMeshes);
StringVector keyss;
mDotSceneMgr->getOptionKeys(keyss);
for (int meshIndex = 0; meshIndex < numMeshes; meshIndex++)
{
int numVerts = 0;
mDotSceneMgr->getOption("NumVertices" + StringConverter::toString(meshIndex), &numVerts);
int numIndices = 0;
mDotSceneMgr->getOption("NumIndex" + StringConverter::toString(meshIndex), &numIndices);
float* vertPtr = 0;
mDotSceneMgr->getOption("VerticesPtr" + StringConverter::toString(meshIndex), &vertPtr);
int* indicesPtr = 0;
mDotSceneMgr->getOption("IndexPtr" + StringConverter::toString(meshIndex), &indicesPtr);
OgreNewt::CollisionPrimitives::TreeCollision* col_dotscene
= new OgreNewt::CollisionPrimitives::TreeCollision
(pWorld,numVerts,numIndices,vertPtr,indicesPtr, true);
OgreNewt::Body* bod = new OgreNewt::Body(pWorld, col_dotscene);
delete col_dotscene;
}
It's just that I use ofusion to export meshes from 3DSMax and create the scene in Ogre. So I already parse the osm file once to load the scene. It's a shame to do it again with dotSceneManager to build the collision body....