How to dynamic create SceneGeometry from Ogre::Renderable?

bunny2015

15-12-2010 03:16:56

In my app, the hill is custom Ogre::Renderable class, it's dynamic created in runtime,
It will be SceneGeometry in NxOgre world, how can I trans it from Ogre::Renderable to NxOgre SceneGeometry?
The hill is triangle mesh, not terrain tile.

thanks.

betajaen

15-12-2010 08:50:38

Do you mean copy the mesh data from the Ogre::Renderable into a TriangleMesh used by a StaticGeometry?

bunny2015

15-12-2010 09:34:55

Do you mean copy the mesh data from the Ogre::Renderable into a TriangleMesh used by a StaticGeometry?
In the tutorial 102, some code like this:
...
NxOgre::Mesh* island = mMeshManager->load("ogre://island.nxs", "island");
...
mScene->createSceneGeometry(NxOgre::TriangleGeometryDescription(island), NxOgre::Vec3::ZERO);

// The visualisation.
SceneNode* islandNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(0,0,0));
islandNode->attachObject(mSceneMgr->createEntity("island", "island.mesh"));
islandNode->setScale(0.3,0.3,0.3);
...

I want use Ogre::Renderable copy to NxOgre::Mesh, who used by NxOgre::Scene::createSceneGeometry at runtime,
not from nxs file.

thank you very much.

betajaen

15-12-2010 09:39:35

Not a problem. Take a look at the NxOgre::ManualMesh class it operates much in the way that the Ogre's ManualObject does.

bunny2015

15-12-2010 10:36:24

Yeah, that's what I needed.
Thank you very much, betajaen