Skip to main content

History: Peter's Grid System

Source of version: 8

Copy to clipboard
            {DIV(type="div",bg="#FFC",align="center")}__Warning__: Article under construction...{DIV}

!! Introduction

After some digging around about grid systems and trying ((EditorGridSystem|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.

{maketoc}

!! Screenshots
||{img fileId="2182" thumb="y" rel="box[g]"}|{img fileId="2183" thumb="y" rel="box[g]"}
{img fileId="2185" thumb="y" rel="box[g]"}|{img fileId="2184" thumb="y" rel="box[g]"}||

!! 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 {MONO()}update(){MONO} 
{FADE(label="View C++ code")}
{CODE(wrap="1", colors="c++")}

    /*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();
{CODE}
{FADE}

!! 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 {MONO()}update(){MONO} to update the grid manually. All options are public data members with the exception of some convenience setters.

__Cell sizes: __
{MONO()}float csX, csY, csZ{MONO} 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 {MONO()}setCellSize(float size){MONO} and {MONO()}setCellSize(float x, float y, float z){MONO} for this purpose.

__Zero offset:__
{MONO()}float ofX, ofY, ofZ{MONO} are used to move the center of the grid in each dimension. You can also use {MONO()}setOffset(float x, float y, float z){MONO}

__Division count: __
{MONO()}int divX, divY, divZ{MONO} are used to set the number of subdivisions in each dimension. You can also use {MONO()}setDivisions(int n){MONO} and {MONO()}setDivisions(int x,int y,int z){MONO} for this purpose.



        

History

Information Version
Fri 19 of Jul, 2013 06:21 GMT-0000 petersvp 29
Fri 19 of Jul, 2013 04:54 GMT-0000 petersvp 28
Fri 19 of Jul, 2013 04:40 GMT-0000 petersvp 27
Fri 19 of Jul, 2013 04:26 GMT-0000 petersvp 26
Fri 19 of Jul, 2013 04:20 GMT-0000 petersvp 25
Fri 19 of Jul, 2013 04:16 GMT-0000 petersvp 24
Fri 19 of Jul, 2013 04:12 GMT-0000 petersvp 23
Fri 19 of Jul, 2013 04:11 GMT-0000 petersvp 22
Fri 19 of Jul, 2013 03:21 GMT-0000 petersvp 21
Fri 19 of Jul, 2013 03:20 GMT-0000 petersvp 20
Fri 19 of Jul, 2013 03:18 GMT-0000 petersvp 19
Fri 19 of Jul, 2013 03:18 GMT-0000 petersvp 18
Fri 19 of Jul, 2013 03:10 GMT-0000 petersvp 17
Fri 19 of Jul, 2013 03:09 GMT-0000 petersvp 16
Fri 19 of Jul, 2013 02:27 GMT-0000 petersvp 15
Fri 19 of Jul, 2013 02:27 GMT-0000 petersvp 14
Fri 19 of Jul, 2013 02:21 GMT-0000 petersvp 13
Fri 19 of Jul, 2013 02:18 GMT-0000 petersvp 12
Fri 19 of Jul, 2013 02:17 GMT-0000 petersvp 11
Fri 19 of Jul, 2013 02:10 GMT-0000 petersvp 10
Fri 19 of Jul, 2013 02:10 GMT-0000 petersvp 9
Fri 19 of Jul, 2013 02:04 GMT-0000 petersvp 8
Fri 19 of Jul, 2013 02:01 GMT-0000 petersvp 7
Fri 19 of Jul, 2013 01:51 GMT-0000 petersvp 6
Fri 19 of Jul, 2013 01:35 GMT-0000 petersvp 5
  • «
  • 1 (current)
  • 2