Building resources on the fly

Misterblue

21-12-2008 18:16:57

I have an application where I'm receiving meshes over the network. My current process is:
- receive mesh (not in Ogre mesh format)
- build a ManualObject from the mesh
- create a Mogre.Mesh using ManualObject.ConvertToMesh
- serialize the mesh to a local file using MeshSerializer.ExportMesh
- add the mesh to a resource group that was created for these meshes
- between frames, add the mesh to a SceneNode

I've been digging through the docs and don't know the proper process for some of these dynamic operations. Some questions:

What is the proper method for freeing the ManualObject and Mesh? I create them and write them and then need to dispose of the temporary instances. Is .Dispose() the proper method?

How to dynamically build a resource group? The docs say that after I've called ResourceGroupManager.Singleton.initializeResourceGroup(mygroup) I cannot call declareResource. What is the proper method for dynamically adding new resources to a resource group? I do not know what meshes I will receive before hand so I cannot prebuild the ResourceGroup.

Any wisdom is appreciated.