Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# Ogre::HeightmapTerrainPageSource Class Reference

Specialisation of the TerrainPageSource class to provide tiles loaded from a 2D greyscale image. More...

`#include <OgreHeightmapTerrainPageSource.h>`

Inheritance diagram for Ogre::HeightmapTerrainPageSource:

[legend]
List of all members.

## Public Methods

| HeightmapTerrainPageSource ()
| ~HeightmapTerrainPageSource ()
void | shutdown (void)

See also:
  TerrainPageSource

void | requestPage (ushort x, ushort y)

See also:
  TerrainPageSource

void | expirePage (ushort x, ushort y)

See also:
  TerrainPageSource

void | initialise (TerrainSceneManager *tsm, ushort tileSize, ushort pageSize, bool asyncLoading, TerrainPageSourceOptionList &optionList)

See also:
  TerrainPageSource

## Static Public Methods

void | addListener (TerrainPageSourceListener *pl)
| Register a class which will be called back whenever a new page is available.
void | removeListener (TerrainPageSourceListener *pl)
| Unregister a class which will be called back whenever a new page is available.

## Protected Methods

void | loadHeightmap (void)
| Load a heightmap.
virtual TerrainPage * | buildPage (Real *heightData, Material *pMaterial)
| Utility method for building a page of tiles based on some source data, wherever that may have come from.

## Static Protected Methods

void | firePageConstructed (size_t pagex, size_t pagez, Real *heightData)
| Internal method for firing pageContructed events.

## Protected Attributes

bool | mIsRaw
| Is this input RAW?
bool | mFlipTerrain
| Should we flip terrain vertically?
Image | mImage
| Image containing the source heightmap if loaded from non-RAW.
SDDataChunk | mRawData
| Arbitrary data loaded from RAW.
TerrainPage * | mPage
| The (single) terrain page this source will provide.
String | mSource
| Source file name.
size_t | mRawSize
| Manual size if source is RAW.
uchar | mRawBpp
| Manual bpp if source is RAW.
TerrainSceneManager * | mSceneManager
| Link back to parent manager.
bool | mAsyncLoading
| Has asynchronous loading been requested?
unsigned short | mPageSize
| The expected size of the page in number of vertices.
unsigned short | mTileSize
| The expected size of a tile in number of vertices.

## Detailed Description

Specialisation of the TerrainPageSource class to provide tiles loaded from a 2D greyscale image.

Remarks:
  This is a simple tile provider that does not support paging; it is assumed that the entire heightmap is loaded as one page.

Definition at line 41 of file OgreHeightmapTerrainPageSource.h.

## Constructor & Destructor Documentation

Ogre::HeightmapTerrainPageSource::HeightmapTerrainPageSource | ( |  | ) |

| Definition at line 37 of file OgreHeightmapTerrainPageSource.cpp.

Ogre::HeightmapTerrainPageSource::~HeightmapTerrainPageSource | ( |  | ) |

| Definition at line 42 of file OgreHeightmapTerrainPageSource.cpp. References shutdown().

## Member Function Documentation

void Ogre::TerrainPageSource::addListener | ( | TerrainPageSourceListener * | pl | ) | `[static, inherited]`

Register a class which will be called back whenever a new page is available.

Remarks:
  Since this method is static, it applies to any page source which is in active use; there is no need to register one per source.

Definition at line 134 of file OgreTerrainPageSource.cpp.

References Ogre::TerrainPageSourceListenerManager::addListener().

TerrainPage * Ogre::TerrainPageSource::buildPage | ( | Real * | heightData,
|  | Material * | pMaterial
| ) | `[protected, virtual, inherited]`

Utility method for building a page of tiles based on some source data, wherever that may have come from.

Remarks:
  It is expected that this height data is represented in the range [0..1], which will be duly scaled by the TerrainRenderables it creates.

Definition at line 76 of file OgreTerrainPageSource.cpp.

References Ogre::SceneNode::attachObject(), Ogre::SceneNode::createChildSceneNode(), Ogre::OctreeSceneManager::createSceneNode(), Ogre::TerrainRenderable::initialise(), Ogre::TerrainPage::linkNeighbours(), Ogre::TerrainPageSource::mPageSize, Ogre::TerrainPageSource::mSceneManager, Ogre::TerrainPageSource::mTileSize, Ogre::TerrainPage::pageSceneNode, Ogre::Real, Ogre::TerrainRenderable::setMaterial(), Ogre::String, and Ogre::TerrainPage::tiles.

Referenced by requestPage().

void Ogre::HeightmapTerrainPageSource::expirePage | ( | ushort | x,
|  | ushort | y
| ) | `[virtual]`

See also:
  TerrainPageSource

Implements Ogre::TerrainPageSource.

Definition at line 266 of file OgreHeightmapTerrainPageSource.cpp.

References mPage, and Ogre::ushort.

void Ogre::TerrainPageSource::firePageConstructed | ( | size_t | pagex,
|  | size_t | pagez,
|  | Real * | heightData
| ) | `[static, protected, inherited]`

| Internal method for firing pageContructed events. Definition at line 129 of file OgreTerrainPageSource.cpp. References Ogre::TerrainPageSourceListenerManager::firePageConstructed(), and Ogre::Real. Referenced by requestPage().

void Ogre::HeightmapTerrainPageSource::initialise | ( | TerrainSceneManager * | tsm,
|  | ushort | tileSize,
|  | ushort | pageSize,
|  | bool | asyncLoading,
|  | TerrainPageSourceOptionList & | optionList
| ) | `[virtual]`

See also:
  TerrainPageSource

Reimplemented from Ogre::TerrainPageSource.

Definition at line 104 of file OgreHeightmapTerrainPageSource.cpp.

References Except, loadHeightmap(), mFlipTerrain, mIsRaw, mRawBpp, mRawSize, mSource, shutdown(), Ogre::String, Ogre::TerrainPageSourceOptionList, and Ogre::ushort.

void Ogre::HeightmapTerrainPageSource::loadHeightmap | ( | void |  | ) | `[protected]`

| Load a heightmap. Definition at line 54 of file OgreHeightmapTerrainPageSource.cpp. References Ogre::DataChunk::clear(), Except, Ogre::Image::getHeight(), Ogre::DataChunk::getSize(), Ogre::Image::getWidth(), Ogre::Image::load(), mImage, Ogre::TerrainPageSource::mPageSize, mRawBpp, mRawData, mRawSize, mSource, shutdown(), and Ogre::String. Referenced by initialise().

void Ogre::TerrainPageSource::removeListener | ( | TerrainPageSourceListener * | pl | ) | `[static, inherited]`

| Unregister a class which will be called back whenever a new page is available. Definition at line 139 of file OgreTerrainPageSource.cpp. References Ogre::TerrainPageSourceListenerManager::removeListener().

void Ogre::HeightmapTerrainPageSource::requestPage | ( | ushort | x,
|  | ushort | y
| ) | `[virtual]`

See also:
  TerrainPageSource

Implements Ogre::TerrainPageSource.

Definition at line 178 of file OgreHeightmapTerrainPageSource.cpp.

References Ogre::TerrainSceneManager::attachPage(), Ogre::TerrainPageSource::buildPage(), Except, Ogre::TerrainPageSource::firePageConstructed(), Ogre::Image::getData(), Ogre::Image::getFormat(), Ogre::DataChunk::getPtr(), mImage, mPage, Ogre::TerrainPageSource::mPageSize, mRawBpp, mRawData, Ogre::TerrainPageSource::mSceneManager, Ogre::PF_L16, Ogre::PF_L8, Ogre::PixelFormat, Ogre::Real, Ogre::uchar, Ogre::ulong, and Ogre::ushort.

void Ogre::HeightmapTerrainPageSource::shutdown | ( | void |  | ) | `[virtual]`

See also:
  TerrainPageSource

Reimplemented from Ogre::TerrainPageSource.

Definition at line 47 of file OgreHeightmapTerrainPageSource.cpp.

References mPage.

Referenced by initialise(), loadHeightmap(), and ~HeightmapTerrainPageSource().

## Member Data Documentation

bool Ogre::TerrainPageSource::mAsyncLoading`[protected, inherited]`

| Has asynchronous loading been requested? Definition at line 137 of file OgreTerrainPageSource.h.

bool Ogre::HeightmapTerrainPageSource::mFlipTerrain`[protected]`

| Should we flip terrain vertically? Definition at line 47 of file OgreHeightmapTerrainPageSource.h. Referenced by initialise().

Image Ogre::HeightmapTerrainPageSource::mImage`[protected]`

| Image containing the source heightmap if loaded from non-RAW. Definition at line 49 of file OgreHeightmapTerrainPageSource.h. Referenced by loadHeightmap(), and requestPage().

bool Ogre::HeightmapTerrainPageSource::mIsRaw`[protected]`

| Is this input RAW? Definition at line 45 of file OgreHeightmapTerrainPageSource.h. Referenced by initialise().

TerrainPage* Ogre::HeightmapTerrainPageSource::mPage`[protected]`

| The (single) terrain page this source will provide. Definition at line 53 of file OgreHeightmapTerrainPageSource.h. Referenced by expirePage(), requestPage(), and shutdown().

unsigned short Ogre::TerrainPageSource::mPageSize`[protected, inherited]`

| The expected size of the page in number of vertices. Definition at line 139 of file OgreTerrainPageSource.h. Referenced by Ogre::TerrainPageSource::buildPage(), loadHeightmap(), and requestPage().

uchar Ogre::HeightmapTerrainPageSource::mRawBpp`[protected]`

| Manual bpp if source is RAW. Definition at line 59 of file OgreHeightmapTerrainPageSource.h. Referenced by initialise(), loadHeightmap(), and requestPage().

SDDataChunk Ogre::HeightmapTerrainPageSource::mRawData`[protected]`

| Arbitrary data loaded from RAW. Definition at line 51 of file OgreHeightmapTerrainPageSource.h. Referenced by loadHeightmap(), and requestPage().

size_t Ogre::HeightmapTerrainPageSource::mRawSize`[protected]`

| Manual size if source is RAW. Definition at line 57 of file OgreHeightmapTerrainPageSource.h. Referenced by initialise(), and loadHeightmap().

TerrainSceneManager* Ogre::TerrainPageSource::mSceneManager`[protected, inherited]`

| Link back to parent manager. Definition at line 135 of file OgreTerrainPageSource.h. Referenced by Ogre::TerrainPageSource::buildPage(), and requestPage().

String Ogre::HeightmapTerrainPageSource::mSource`[protected]`

| Source file name. Definition at line 55 of file OgreHeightmapTerrainPageSource.h. Referenced by initialise(), and loadHeightmap().

unsigned short Ogre::TerrainPageSource::mTileSize`[protected, inherited]`

| The expected size of a tile in number of vertices. Definition at line 141 of file OgreTerrainPageSource.h. Referenced by Ogre::TerrainPageSource::buildPage().

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

- OgreHeightmapTerrainPageSource.h
- OgreHeightmapTerrainPageSource.cpp

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:49:51 2004