NxOgre.org

Betajaen’s shortguide to NxOgre

Meshes & Heightfields — Behold the Starfish King of North London!


It is clearly said that Meshes and HeightFields have their differences, but what are they and how are the different?

Heightfields

HeightFields are pieces of terrain; much like a hill, huge tracks of land, or a underwater mini-golf course. HeightFields are like spreadsheets organised into rows and columns – with each cell representing the height of the terrain at that particular point. A value of 32768 may feel like being on top of the world, where as -32678 may feel like everyone is all above at you – laughing.

HeightFields in NxOgre use the HeightField class and are organised by the HeightFieldManager singleton (you’ve met them already). HeightFields may be created within code via the ManualHeightField class or if your feeling adventurous be loaded from a NxOgre HeightField xhf file, which is loaded through the ResourceSystem. You can save xhf files from the ManualHeightField – so it’s win win.

HeightField* northLondon = HeightFieldManager::getSingleton()->load("myFishesArchive:northLondon.xhf");

But for now my petite starfish, we will do it the old fashioned way and make our HeightFields by hand, like our forefathers did.

ManualHeightField southLondon;
southLondon.begin(8,8);
for (unsigned int i=0; i < 8;i++)
 for (unsigned int j=0; j < 8;j++)
  southLondon.sample((i * 10) + j * 100);
HeightField* theRealSouthLondon = mhf.end("southLondon");

Heightfields are used with StaticGeometries which you’ll encounter later in Level 2. Meshes are also used with StaticGeometries which I will have a chin-wag with you now.

Meshes

Meshes unlike Heightfields are superior (or not – depending on your point of view). Unlike Heightfields they can take any upon any shape you wish. You can picture of them as an unmovable, loud mouth, shapeshift once sort of…shape.

Like Heightfields Meshes can be loaded from disk via a saved PhysX Mesh nxs file using the MeshManager singleton.

Mesh* the_starfish_king = MeshManager::getSingleton()->load("myFishesArchive:donald.nxs");

TODO

Previous | TOC | TODO

IndexWhat is NxOgre?Guides and TutorialsDownloadForums