Preserving entities with auto scene manager creation

MrPixel

16-11-2008 22:14:14

I'm fairly new to Ogre and oFusion so please don't beat me up if this is a dumb question (I _have_ searched the forum for an answer). I'm working on a simple level editor and I support the loading of any osm scene. I would like to have OSMScene::create() create the SceneManager based on the type in the file. But the rub is that I have a bunch of stuff (Gui, ManualObjects, Movables, etc.) that I would like to preserve through a new scene load. It kinda seems impossible since I am potentially tossing the old SceneManager.

Is there a way to do this besides destroying and recreating everything with a new scene load? TIA

Lioric

18-11-2008 00:26:34

That is very application specific, and usually involves creating a customized Scene Manager that handles Sub-Scene Managers (a single main scene manager that creates and handles sub SM's and render them as needed)

Probably the easier method is simply creating a function that stores and recreates the needed data that is existing in the scene before loading a new scene type

See the oScene Serializer library code to have a guide on how to handle all the existing scene data, but store it in memory and "load" this data after the new scene manager is created (and add the object types you need, as Gui and manualObjects)

MrPixel

18-11-2008 02:35:49

Hi Lioric. I'll look into the serializer method as well as a "super" SceneManager. Thanks for the info!

Would the serializer method be the same as (but more efficient than) keeping the old SceneManger around and transferring the persistent chunks to the new SceneManager?

Lioric

18-11-2008 14:59:35

Yes, but if you mantain multiple scene managers you might experience performance and memory issues (specially when loading big scenes), but if you mantain just the data needed to recreate the objects it will use just some KBs, it all depends on your specific application