Development:Ogre:Docs:Models
Development:Ogre |
Contents
Overview
VegaStrike models != Ogre mehses
You make a nice ship using blender. Grab the exporter for Ogre .xml format, use it, and there you have an .xml file with your ship. Is that it? No... sure, you convert it to .mesh using the beautiful tools provided by the Ogre comunity. Now, you have a .mesh file.
Now... that's it. Wrong!
Where are the mountpoints? Thruster exhausts? Automatic articulation?
It's all defined in VegaStrike-specific scripts... very much alike Ogre scripts.
Material instancing
Now... you have your diffuse texture, your specmap, your nicely tweaked and precisely calibrated shading parameters. What do you do? Write a material script?
Well... you could, but I doubt you would want to. Use material instancing script instead.
In order to avoid reinventing the wheel every time you need a new fancy material (and by fancy understand anything that requires a shader - which, by modern quality standard, is pretty much everything), material instancing scripts and material templates have been invented.
How they work?
First, you have a .materialTemplate file. That's the template, holding an almost-standard Ogre material script. The only difference, is all those $(VARIABLE=default) thingies. What they do? They're a placeholder for variables. Let's take the standard per-pixel diffuse with specmaps example. Should you have to write a per-pixel shader that works acceptably on most hardware (even hardware without shaders - remember VegaStrike should work in older hardware, without the bells and whistles of course), you would have to write something as this ogre material script. Not compelling, is it?
That's why templates exist. Those standard and often used materials will be included as templates in the core VegaStrike engine. You can then create instances of those materials as simply as this.
Models, the concept, the features
Quickly: models are collections of meshes, with properties that allow them to behave like ships, rather than... well... collections of textured triangles.
Material Instance scripts
this is a nice real-world example. However, that does not expose the full functionality of material instance scripts. For that, take a look at this sample instance script. Pay particular attention to the comments indicating how commands map to variables in templates.