History: Peter's Grid System
Preview of version: 7
Introduction
After some digging around about grid systems and trying Jeroen Dierckx's EditorGridSystem, We decided to write our own grid system with different feature set and release it to the community, because Ogre is si cool.
Table of contents
Screenshots
|
|
|
|
|
|
Features
Following features are supported by Peter's Grid System:
- This grid have three planes support - XY, XZ, YZ that can be visible/hidden
- Grid is generated/updated by request, uses ManualObject
- Limitations in each dimension
- Cell size per dimension
- Grid Offset
- Colors for offset, master and division axis,
- Does NOT depend from the camera type used,
- Not limited to one instance (no named items used!)
Usage
To create a grid, just create an instance of the class and set the properties you want to, then call update()
/*OgreGrid*/ grid = new OgreGrid(/*Ogre::SceneManager*/ui->TheScene->scene, /*Material name*/"BaseWhiteAlphaBlended"); //Where to draw the grid? grid->drawQueue = Ogre::RENDER_QUEUE_OVERLAY; //Attach it to some SceneNode grid->attachToNode(scene->getRootSceneNode()); //Some grid settings grid->setCellSize(0.5); grid->ymin = -9; grid->ymax = 2; grid->ofY = 2; grid->zmin = -2; grid->zmax = 1; grid->showXZ = true; grid->showXY = true; grid->showYZ = true; grid->setDivisions(10); grid->colorDivision = Ogre::ColourValue(0,1,0,0.3); grid->colorOffset = Ogre::ColourValue(0,0,1,1); grid->colorMaster = Ogre::ColourValue(1,0,0,0.7); //Regenerate the grid grid->update();
Options
After creating an instance to the grid class, you can set the options of the grid you want to. After you change option, you must call update() to update the grid manually. All options are public data members with the exception of some convenience setters.
Cell sizes:
csX, csY, csZ are used to control the master grid axes distance, per dimaneion. You may have a grid with cell size 2x1 in the X/Y dimension. You can use grid sizes such as 0.5x0.5. You can also use setCellSize(float size) and setCellSize(float x, float y, float z) for this purpose.
Zero offset:
ofX, ofY, ofZ are used to move the center of the grid in each dimension. You can also use setOffset(float x, float y, float z)