Search code examples
meshogrescene

How to create a .mesh file with OGRE?


I'm relatively new to OGRE graphics engine, so my question may seem too obvious, but searching for relevant information was not successful.

Given:
I have an OGRE application with a scene created of some meshes, lights, cameras and textures. It is rather simple, I think. That all is represented by a tree of scene nodes(internal object).

The goal:
To save the full tree of scene nodes or, preferably, an indicated branch of nodes of the tree to a ".mesh" file. To be able load it later as any other mesh. The ".mesh.xml" format is also fine. How it could be done?

If not:
If the desired thing is not possible, what is normal way to create those ".mesh" files? And where I could find some guides for it?


Solution

  • I think you're a bit confused: OGRE mesh file is a file that stores only geometric data of a given 3D model like positions, normals, texture coordinates, tangents, binormals, bone index, bone weights and so on. It also can store a subdivision of a single mesh in submeshes (generally based on the material), and each of them can have a reference to the proper material. In essence a mesh file only contains data on the models you would like to load on your game, nothing about the scene structure.

    If you want to save (serialize) your scene, you have two choice:

    1. Write your own scene serializer.
    2. Using some library already provided by the OGRE community: for example DotScene format.