PagedGeometry  1.2.0
Forests::PageInfo Struct Reference

Useful page information supplied to a pageloader. More...

#include <PagedGeometry.h>

Public Attributes

TBounds bounds
 The page boundaries in which all entities should be placed. More...
 
Ogre::Vector3 centerPoint
 The center of the page (simply the middle of the bounds). More...
 
int xIndex
 The X index of the page tile. More...
 
int zIndex
 The Z index of the page tile. More...
 
void * userData
 Misc. More...
 
std::vector< Ogre::Mesh * > meshList
 

Detailed Description

Useful page information supplied to a pageloader.

When your page loader's loadPage() or unloadPage() is called, you are supplied with a PageInfo variable. This basically tells you what region in space is to be loaded into the page, in addition to some other useful information about that region.

See also
the PageLoader::loadPage() and PageLoader::unloadPage() documentation for more information.

Member Data Documentation

TBounds Forests::PageInfo::bounds

The page boundaries in which all entities should be placed.

This specifies the rectangular boundary of the page. Every entity contained in the page should reside within these boundaries.

  • bounds.left is the minimum X coordinate allowed for any entity in the page.
  • bounds.right is the maximum X coordinate allowed for any entity in the page.
  • bounds.top is the minimum Z coordinate allowed for any entity in the page.
  • bounds.bottom is the maximum Z coordinate allowed for any entity in the page.

Referenced by Forests::GrassLoader::loadPage(), Forests::TreeLoader3D::loadPage(), Forests::TreeLoader2D::loadPage(), Forests::GeometryPageManager::resetPreloadedGeometry(), Forests::GrassLayer::setDensityMapFilter(), and Forests::GrassLoader::unloadPage().

Ogre::Vector3 Forests::PageInfo::centerPoint

The center of the page (simply the middle of the bounds).

Note
Since there is no way of knowing the elevation of your entities, centerPoint.y will always be defaulted at 0.

Referenced by Forests::GrassLoader::loadPage(), Forests::GeometryPageManager::resetPreloadedGeometry(), and Forests::GrassLoader::unloadPage().

int Forests::PageInfo::xIndex

The X index of the page tile.

If all the geometry pages were arranged in a big 2D grid, this would be the X index of this page in that grid.

This is mathematically equivalent to Math::Floor( bounds.left / bounds.width() ), although this should be used instead due to floating point precision issues which may occur otherwise.

Referenced by Forests::TreeLoader3D::loadPage(), Forests::TreeLoader2D::loadPage(), and Forests::GeometryPageManager::resetPreloadedGeometry().

int Forests::PageInfo::zIndex

The Z index of the page tile.

If all the geometry pages were arranged in a big 2D grid, this would be the Z index of this page in that grid.

This is mathematically equivalent to Math::Floor( bounds.top / bounds.height() ), although this should be used instead due to floating point precision issues which may occur otherwise.

Referenced by Forests::TreeLoader3D::loadPage(), Forests::TreeLoader2D::loadPage(), and Forests::GeometryPageManager::resetPreloadedGeometry().

void* Forests::PageInfo::userData

Misc.

custom data to associate with this page tile.

This field can be set in PageLoader::loadPage() to point to custom data allocated during the loading of a page. You can later retreive this data in PageLoader::unloadPage() in order to deallocate the data if desired.

Warning
After a page is unloaded, userData becomes NULL. Don't attempt to use userData to reference an object longer than the page's life span; anything userData points to should be fully deallocated when PageLoader::unloadPage() is called.

Referenced by Forests::GeometryPageManager::resetPreloadedGeometry().