# Ogre::Grid2DPageStrategyData Class Reference
[Paging]

Specialisation of PageStrategyData for GridPageStrategy. More...

`#include <OgreGrid2DPageStrategy.h>`

Inheritance diagram for Ogre::Grid2DPageStrategyData:
[legend]

List of all members.

## Public Member Functions

| Grid2DPageStrategyData ()
| ~Grid2DPageStrategyData ()
virtual void | setMode (Grid2DMode mode)
| Set the grid alignment mode.
virtual Grid2DMode | getMode () const
| Set the grid alignment mode.
virtual void | setOrigin (const Vector3 &worldOrigin)
| Set the origin of the grid in world space.
virtual const Vector3 & | getOrigin (const Vector3 &worldOrigin)
| Get the origin of the grid in world space.
virtual void | setCellSize (Real sz)
| Set the size of the cells in the grid.
virtual Real | getCellSize () const
| Get the size of the cells in the grid.
virtual void | setLoadRadius (Real sz)
| Set the loading radius.
virtual Real | getLoadRadius () const
| Get the loading radius.
virtual void | setHoldRadius (Real sz)
| Set the Holding radius.
virtual Real | getHoldRadius () const
| Get the Holding radius.
virtual Real | getLoadRadiusInCells ()
| Get the load radius as a multiple of cells.
virtual Real | getHoldRadiusInCells ()
| Get the Hold radius as a multiple of cells.
virtual void | setCellRange (int32 minX, int32 minY, int32 maxX, int32 maxY)
| Set the index range of all cells (values outside this will be ignored).
virtual void | setCellRangeMinX (int32 minX)
| Set the index range of all cells (values outside this will be ignored).
virtual void | setCellRangeMinY (int32 minY)
| Set the index range of all cells (values outside this will be ignored).
virtual void | setCellRangeMaxX (int32 maxX)
| Set the index range of all cells (values outside this will be ignored).
virtual void | setCellRangeMaxY (int32 maxY)
| Set the index range of all cells (values outside this will be ignored).
virtual int32 | getCellRangeMinX () const
| get the index range of all cells (values outside this will be ignored)
virtual int32 | getCellRangeMinY () const
| get the index range of all cells (values outside this will be ignored)
virtual int32 | getCellRangeMaxX () const
| get the index range of all cells (values outside this will be ignored)
virtual int32 | getCellRangeMaxY () const
| get the index range of all cells (values outside this will be ignored)
bool | load (StreamSerialiser &stream)
| Load this data from a stream (returns true if successful).
void | save (StreamSerialiser &stream)
| Save this data to a stream.
virtual void | convertWorldToGridSpace (const Vector3 &world, Vector2 &grid)
| Convert a world point to grid space (not relative to origin).
virtual void | convertGridToWorldSpace (const Vector2 &grid, Vector3 &world)
| Convert a grid point to world space - note only 2 axes populated.
virtual void | getMidPointGridSpace (int32 x, int32 y, Vector2 &mid)
| Get the (grid space) mid point of a cell.
virtual void | getBottomLeftGridSpace (int32 x, int32 y, Vector2 &bl)
| Get the (grid space) bottom-left of a cell.
virtual void | getCornersGridSpace (int32 x, int32 y, Vector2 *pFourPoints)
| Get the (grid space) corners of a cell.
void | determineGridLocation (const Vector2 &gridpos, int32 *x, int32 *y)
| Convert a grid position into a row and column index.
PageID | calculatePageID (int32 x, int32 y)
void | calculateCell (PageID inPageID, int32 *x, int32 *y)
void * | operator new (size_t sz, const char *file, int line, const char *func)
| operator new, with debug line info
void * | operator new (size_t sz)
void * | operator new (size_t sz, void *ptr)
| placement operator new
void * | operator new[] (size_t sz, const char *file, int line, const char *func)
| array operator new, with debug line info
void * | operator new[] (size_t sz)
void | operator delete (void *ptr)
void | operator delete (void *ptr, void *)
void | operator delete (void *ptr, const char *, int, const char *)
void | operator delete[] (void *ptr)
void | operator delete[] (void *ptr, const char *, int, const char *)

## Static Public Attributes

static const uint32 | CHUNK_ID
static const uint16 | CHUNK_VERSION

## Protected Member Functions

void | updateDerivedMetrics ()

## Protected Attributes

Grid2DMode | mMode
| Orientation of the grid.
Vector3 | mWorldOrigin
| Origin (world space).
Vector2 | mOrigin
| Origin (grid-aligned world space).
Real | mCellSize
| Grid cell (page) size.
Real | mLoadRadius
| Load radius.
Real | mHoldRadius
| Hold radius.
Real | mLoadRadiusInCells
Real | mHoldRadiusInCells
int32 | mMinCellX
int32 | mMinCellY
int32 | mMaxCellX
int32 | mMaxCellY

## Detailed Description

Specialisation of PageStrategyData for GridPageStrategy.

Remarks:
  Structurally this data defines with a grid of pages, with the logical origin in the middle of the entire grid. The grid cells are indexed from 0 as a 'centre' slot, supporting both positive and negative values. so (0,0) is the centre cell, (1,0) is the cell to the right of the centre, (1,0) is the cell above the centre, (-2,1) is the cell two to the left of the centre and one up, etc. The maximum extent of each axis is -32768 to +32767, so in other words enough for over 4 billion entries.

  To limit the page load requests that are generated to a fixed region, you can set the min and max cell indexes (inclusive)for each direction; if a page request would address a cell outside this range it is ignored so you don't have the expense of checking for page data that will never exist.

  The data format for this in a file is:
  Grid2DPageStrategyData (Identifier 'G2DD')
  [Version 1]

  Name | Type | Description
  Grid orientation | uint8 | The orientation of the grid; XZ = 0, XY = 1, YZ = 2
  Grid origin | Vector3 | World origin of the grid.
  Grid cell size | Real | The size of each cell (page) in the grid
  Grid cell range (minx, maxx, miny, maxy) | int16 * 4 | The extents of the world in cell indexes
  Load radius | Real | The outer radius at which new pages should start loading
  Hold radius | Real | The radius at which existing pages should be held if already loaded but not actively loaded (should be larger than Load radius)

Definition at line 114 of file OgreGrid2DPageStrategy.h.

## Constructor & Destructor Documentation

Ogre::Grid2DPageStrategyData::Grid2DPageStrategyData | ( |  | ) |

Ogre::Grid2DPageStrategyData::~Grid2DPageStrategyData | ( |  | ) |

## Member Function Documentation

void Ogre::Grid2DPageStrategyData::calculateCell | ( | PageID | inPageID,
|  | int32 * | x,
|  | int32 * | y |
| ) |  |  |

PageID Ogre::Grid2DPageStrategyData::calculatePageID | ( | int32 | x,
|  | int32 | y |
| ) |  |  |

virtual void Ogre::Grid2DPageStrategyData::convertGridToWorldSpace | ( | const Vector2 & | grid,
|  | Vector3 & | world |
| ) |  |  | `[virtual]`

Convert a grid point to world space - note only 2 axes populated.

virtual void Ogre::Grid2DPageStrategyData::convertWorldToGridSpace | ( | const Vector3 & | world,
|  | Vector2 & | grid |
| ) |  |  | `[virtual]`

Convert a world point to grid space (not relative to origin).

void Ogre::Grid2DPageStrategyData::determineGridLocation | ( | const Vector2 & | gridpos,
|  | int32 * | x,
|  | int32 * | y |
| ) |  |  |

Convert a grid position into a row and column index.

virtual void Ogre::Grid2DPageStrategyData::getBottomLeftGridSpace | ( | int32 | x,
|  | int32 | y,
|  | Vector2 & | bl |
| ) |  |  | `[virtual]`

Get the (grid space) bottom-left of a cell.

virtual int32 Ogre::Grid2DPageStrategyData::getCellRangeMaxX | ( |  | ) | const`[virtual]`

get the index range of all cells (values outside this will be ignored)

Definition at line 187 of file OgreGrid2DPageStrategy.h.

virtual int32 Ogre::Grid2DPageStrategyData::getCellRangeMaxY | ( |  | ) | const`[virtual]`

get the index range of all cells (values outside this will be ignored)

Definition at line 189 of file OgreGrid2DPageStrategy.h.

virtual int32 Ogre::Grid2DPageStrategyData::getCellRangeMinX | ( |  | ) | const`[virtual]`

get the index range of all cells (values outside this will be ignored)

Definition at line 183 of file OgreGrid2DPageStrategy.h.

virtual int32 Ogre::Grid2DPageStrategyData::getCellRangeMinY | ( |  | ) | const`[virtual]`

get the index range of all cells (values outside this will be ignored)

Definition at line 185 of file OgreGrid2DPageStrategy.h.

virtual Real Ogre::Grid2DPageStrategyData::getCellSize | ( |  | ) | const`[virtual]`

Get the size of the cells in the grid.

Definition at line 158 of file OgreGrid2DPageStrategy.h.

virtual void Ogre::Grid2DPageStrategyData::getCornersGridSpace | ( | int32 | x,
|  | int32 | y,
|  | Vector2 * | pFourPoints |
| ) |  |  | `[virtual]`

Get the (grid space) corners of a cell.

Remarks:
  Populates pFourPoints in anticlockwise order from the bottom left point.

virtual Real Ogre::Grid2DPageStrategyData::getHoldRadius | ( |  | ) | const`[virtual]`

Get the Holding radius.

Definition at line 166 of file OgreGrid2DPageStrategy.h.

virtual Real Ogre::Grid2DPageStrategyData::getHoldRadiusInCells | ( |  | ) | `[virtual]`

Get the Hold radius as a multiple of cells.

Definition at line 170 of file OgreGrid2DPageStrategy.h.

virtual Real Ogre::Grid2DPageStrategyData::getLoadRadius | ( |  | ) | const`[virtual]`

Get the loading radius.

Definition at line 162 of file OgreGrid2DPageStrategy.h.

virtual Real Ogre::Grid2DPageStrategyData::getLoadRadiusInCells | ( |  | ) | `[virtual]`

Get the load radius as a multiple of cells.

Definition at line 168 of file OgreGrid2DPageStrategy.h.

virtual void Ogre::Grid2DPageStrategyData::getMidPointGridSpace | ( | int32 | x,
|  | int32 | y,
|  | Vector2 & | mid |
| ) |  |  | `[virtual]`

Get the (grid space) mid point of a cell.

virtual Grid2DMode Ogre::Grid2DPageStrategyData::getMode | ( |  | ) | const`[virtual]`

Set the grid alignment mode.

Definition at line 149 of file OgreGrid2DPageStrategy.h.

virtual const Vector3& Ogre::Grid2DPageStrategyData::getOrigin | ( | const Vector3 & | worldOrigin | ) | `[virtual]`

Get the origin of the grid in world space.

Definition at line 154 of file OgreGrid2DPageStrategy.h.

bool Ogre::Grid2DPageStrategyData::load | ( | StreamSerialiser & | stream | ) | `[virtual]`

Load this data from a stream (returns true if successful).

Implements Ogre::PageStrategyData.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr | ) | `[inherited]`

Definition at line 95 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | const char * | ,
|  | int | ,
|  | const char * |  |
| ) |  |  | `[inherited]`

Definition at line 107 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | void * |  |
| ) |  |  | `[inherited]`

Definition at line 101 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr,
|  | const char * | ,
|  | int | ,
|  | const char * |  |
| ) |  |  | `[inherited]`

Definition at line 118 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr | ) | `[inherited]`

Definition at line 112 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz,
|  | const char * | file,
|  | int | line,
|  | const char * | func |
| ) |  |  | `[inherited]`

operator new, with debug line info

Definition at line 67 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz | ) | `[inherited]`

Definition at line 72 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz,
|  | void * | ptr |
| ) |  |  | `[inherited]`

placement operator new

Definition at line 78 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz,
|  | const char * | file,
|  | int | line,
|  | const char * | func |
| ) |  |  | `[inherited]`

array operator new, with debug line info

Definition at line 85 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz | ) | `[inherited]`

Definition at line 90 of file OgreMemoryAllocatedObject.h.

void Ogre::Grid2DPageStrategyData::save | ( | StreamSerialiser & | stream | ) | `[virtual]`

Save this data to a stream.

Implements Ogre::PageStrategyData.

virtual void Ogre::Grid2DPageStrategyData::setCellRange | ( | int32 | minX,
|  | int32 | minY,
|  | int32 | maxX,
|  | int32 | maxY |
| ) |  |  | `[virtual]`

Set the index range of all cells (values outside this will be ignored).

virtual void Ogre::Grid2DPageStrategyData::setCellRangeMaxX | ( | int32 | maxX | ) | `[virtual]`

Set the index range of all cells (values outside this will be ignored).

virtual void Ogre::Grid2DPageStrategyData::setCellRangeMaxY | ( | int32 | maxY | ) | `[virtual]`

Set the index range of all cells (values outside this will be ignored).

virtual void Ogre::Grid2DPageStrategyData::setCellRangeMinX | ( | int32 | minX | ) | `[virtual]`

Set the index range of all cells (values outside this will be ignored).

virtual void Ogre::Grid2DPageStrategyData::setCellRangeMinY | ( | int32 | minY | ) | `[virtual]`

Set the index range of all cells (values outside this will be ignored).

virtual void Ogre::Grid2DPageStrategyData::setCellSize | ( | Real | sz | ) | `[virtual]`

Set the size of the cells in the grid.

virtual void Ogre::Grid2DPageStrategyData::setHoldRadius | ( | Real | sz | ) | `[virtual]`

Set the Holding radius.

virtual void Ogre::Grid2DPageStrategyData::setLoadRadius | ( | Real | sz | ) | `[virtual]`

Set the loading radius.

virtual void Ogre::Grid2DPageStrategyData::setMode | ( | Grid2DMode | mode | ) | `[virtual]`

Set the grid alignment mode.

virtual void Ogre::Grid2DPageStrategyData::setOrigin | ( | const Vector3 & | worldOrigin | ) | `[virtual]`

Set the origin of the grid in world space.

void Ogre::Grid2DPageStrategyData::updateDerivedMetrics | ( |  | ) | `[protected]`

## Member Data Documentation

const uint32 Ogre::Grid2DPageStrategyData::CHUNK_ID `[static]`

Definition at line 139 of file OgreGrid2DPageStrategy.h.

const uint16 Ogre::Grid2DPageStrategyData::CHUNK_VERSION `[static]`

Definition at line 140 of file OgreGrid2DPageStrategy.h.

Real Ogre::Grid2DPageStrategyData::mCellSize `[protected]`

Grid cell (page) size.

Definition at line 124 of file OgreGrid2DPageStrategy.h.

Real Ogre::Grid2DPageStrategyData::mHoldRadius `[protected]`

Hold radius.

Definition at line 128 of file OgreGrid2DPageStrategy.h.

Real Ogre::Grid2DPageStrategyData::mHoldRadiusInCells `[protected]`

Definition at line 130 of file OgreGrid2DPageStrategy.h.

Real Ogre::Grid2DPageStrategyData::mLoadRadius `[protected]`

Load radius.

Definition at line 126 of file OgreGrid2DPageStrategy.h.

Real Ogre::Grid2DPageStrategyData::mLoadRadiusInCells `[protected]`

Definition at line 129 of file OgreGrid2DPageStrategy.h.

int32 Ogre::Grid2DPageStrategyData::mMaxCellX `[protected]`

Definition at line 133 of file OgreGrid2DPageStrategy.h.

int32 Ogre::Grid2DPageStrategyData::mMaxCellY `[protected]`

Definition at line 134 of file OgreGrid2DPageStrategy.h.

int32 Ogre::Grid2DPageStrategyData::mMinCellX `[protected]`

Definition at line 131 of file OgreGrid2DPageStrategy.h.

int32 Ogre::Grid2DPageStrategyData::mMinCellY `[protected]`

Definition at line 132 of file OgreGrid2DPageStrategy.h.

Grid2DMode Ogre::Grid2DPageStrategyData::mMode `[protected]`

Orientation of the grid.

Definition at line 118 of file OgreGrid2DPageStrategy.h.

Vector2 Ogre::Grid2DPageStrategyData::mOrigin `[protected]`

Origin (grid-aligned world space).

Definition at line 122 of file OgreGrid2DPageStrategy.h.

Vector3 Ogre::Grid2DPageStrategyData::mWorldOrigin `[protected]`

Origin (world space).

Definition at line 120 of file OgreGrid2DPageStrategy.h.

The documentation for this class was generated from the following file:

- OgreGrid2DPageStrategy.h

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Wed Nov 3 2010 19:25:04