Ogre::TerrainMaterialGenerator Class Reference
Terrain

Class that provides functionality to generate materials for use with a terrain. More...

`#include <OgreTerrainMaterialGenerator.h>`

Inheritance diagram for Ogre::TerrainMaterialGenerator:
[legend]

List of all members.

## Classes

class | Profile
| Inner class which should also be subclassed to provide profile-specific material generation. More...

## Public Types

typedef vector< Profile * >::type | ProfileList
| List of profiles - NB should be ordered in descending complexity.

## Public Member Functions

| TerrainMaterialGenerator ()
virtual | ~TerrainMaterialGenerator ()
virtual const ProfileList & | getProfiles () const
| Get the list of profiles that this generator supports.
virtual void | setActiveProfile (const String &name)
| Set the active profile by name.
virtual void | setActiveProfile (Profile *p)
| Set the active Profile.
Profile * | getActiveProfile () const
| Get the active profile.
void | _markChanged ()
| Internal method - indicates that a change has been made that would require material regeneration.
unsigned long long int | getChangeCount () const
| Returns the number of times the generator has undergone a change which would require materials to be regenerated.
virtual const TerrainLayerDeclaration & | getLayerDeclaration () const
| Get the layer declaration that this material generator operates with.
virtual bool | canGenerateUsingDeclaration (const TerrainLayerDeclaration &decl)
| Whether this generator can generate a material for a given declaration.
virtual bool | isVertexCompressionSupported () const
| Return whether this material generator supports using a compressed vertex format.
virtual void | requestOptions (Terrain *terrain)
| Triggers the generator to request the options that it needs.
virtual MaterialPtr | generate (const Terrain *terrain)
| Generate a material for the given terrain using the active profile.
virtual MaterialPtr | generateForCompositeMap (const Terrain *terrain)
| Generate a material for the given composite map of the terrain using the active profile.
virtual uint8 | getMaxLayers (const Terrain *terrain) const
| Get the maximum number of layers supported with the given terrain.
virtual void | updateCompositeMap (const Terrain *terrain, const Rect &rect)
| Update the composite map for a terrain.
virtual void | updateParams (const MaterialPtr &mat, const Terrain *terrain)
| Update parameters for the given terrain using the active profile.
virtual void | updateParamsForCompositeMap (const MaterialPtr &mat, const Terrain *terrain)
| Update parameters for the given terrain composite map using the active profile.
virtual void | setDebugLevel (unsigned int dbg)
| Set the debug level of the material.
virtual unsigned int | getDebugLevel () const
| Get the debug level of the material.
virtual void | _renderCompositeMap (size_t size, const Rect &rect, const MaterialPtr &mat, const TexturePtr &destCompositeMap)
| Helper method to render a composite map.
Texture * | _getCompositeMapRTT ()
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 *)

## Protected Attributes

ProfileList | mProfiles
Profile * | mActiveProfile
unsigned long long int | mChangeCounter
TerrainLayerDeclaration | mLayerDecl
unsigned int | mDebugLevel
SceneManager * | mCompositeMapSM
Camera * | mCompositeMapCam
Texture * | mCompositeMapRTT
ManualObject * | mCompositeMapPlane
Light * | mCompositeMapLight

## Detailed Description

Class that provides functionality to generate materials for use with a terrain.

Remarks:
  Terrains are composed of one or more layers of texture information, and require that a material is generated to render them. There are various approaches to rendering the terrain, which may vary due to:
  - Hardware support (static)
  - Texture instances assigned to a particular terrain (dynamic in an editor)
  - User selection (e.g. changing to a cheaper option in order to increase performance, or in order to test how the material might look on other hardware (dynamic)
  Subclasses of this class are responsible for responding to these factors and to generate a terrain material.

  In order to cope with both hardware support and user selection, the generator must expose a number of named 'profiles'. These profiles should function on a known range of hardware, and be graded by quality. At runtime, the user should be able to select the profile they wish to use (provided hardware support is available).

Definition at line 155 of file OgreTerrainMaterialGenerator.h.

## Member Typedef Documentation

typedef vector<Profile*>::type Ogre::TerrainMaterialGenerator::ProfileList

List of profiles - NB should be ordered in descending complexity.

Definition at line 204 of file OgreTerrainMaterialGenerator.h.

## Constructor & Destructor Documentation

Ogre::TerrainMaterialGenerator::TerrainMaterialGenerator | ( |  | ) |

virtual Ogre::TerrainMaterialGenerator::~TerrainMaterialGenerator | ( |  | ) | `[virtual]`

## Member Function Documentation

Texture* Ogre::TerrainMaterialGenerator::_getCompositeMapRTT | ( |  | ) |

Definition at line 379 of file OgreTerrainMaterialGenerator.h.

void Ogre::TerrainMaterialGenerator::_markChanged | ( |  | ) |

Internal method - indicates that a change has been made that would require material regeneration.

Definition at line 247 of file OgreTerrainMaterialGenerator.h.

virtual void Ogre::TerrainMaterialGenerator::_renderCompositeMap | ( | size_t | size,
|  | const Rect & | rect,
|  | const MaterialPtr & | mat,
|  | const TexturePtr & | destCompositeMap
| ) |  | `[virtual]`

Helper method to render a composite map.

Parameters:

  size | The requested composite map size
  rect | The region of the composite map to update, in image space
  mat | The material to use to render the map
  outBox | The box region of the texture which has been updated, and should be copied into your final texture

virtual bool Ogre::TerrainMaterialGenerator::canGenerateUsingDeclaration | ( | const TerrainLayerDeclaration & | decl | ) | `[virtual]`

Whether this generator can generate a material for a given declaration.

By default this only returns true if the declaration is equal to the standard one returned from getLayerDeclaration, but if a subclass wants to be flexible to generate materials for other declarations too, it can specify here.

Definition at line 263 of file OgreTerrainMaterialGenerator.h.

virtual MaterialPtr Ogre::TerrainMaterialGenerator::generate | ( | const Terrain * | terrain | ) | `[virtual]`

Generate a material for the given terrain using the active profile.

Definition at line 287 of file OgreTerrainMaterialGenerator.h.

References Ogre::TerrainMaterialGenerator::Profile::generate().

virtual MaterialPtr Ogre::TerrainMaterialGenerator::generateForCompositeMap | ( | const Terrain * | terrain | ) | `[virtual]`

Generate a material for the given composite map of the terrain using the active profile.

Definition at line 297 of file OgreTerrainMaterialGenerator.h.

References Ogre::TerrainMaterialGenerator::Profile::generateForCompositeMap().

Profile* Ogre::TerrainMaterialGenerator::getActiveProfile | ( |  | ) | const

Get the active profile.

Definition at line 237 of file OgreTerrainMaterialGenerator.h.

unsigned long long int Ogre::TerrainMaterialGenerator::getChangeCount | ( |  | ) | const

Returns the number of times the generator has undergone a change which would require materials to be regenerated.

Definition at line 252 of file OgreTerrainMaterialGenerator.h.

virtual unsigned int Ogre::TerrainMaterialGenerator::getDebugLevel | ( |  | ) | const`[virtual]`

Get the debug level of the material.

Definition at line 367 of file OgreTerrainMaterialGenerator.h.

virtual const TerrainLayerDeclaration& Ogre::TerrainMaterialGenerator::getLayerDeclaration | ( |  | ) | const`[virtual]`

Get the layer declaration that this material generator operates with.

Definition at line 256 of file OgreTerrainMaterialGenerator.h.

virtual uint8 Ogre::TerrainMaterialGenerator::getMaxLayers | ( | const Terrain * | terrain | ) | const`[virtual]`

Get the maximum number of layers supported with the given terrain.

Note:
  When you change the options on the terrain, this value can change.

Definition at line 308 of file OgreTerrainMaterialGenerator.h.

References Ogre::TerrainMaterialGenerator::Profile::getMaxLayers().

virtual const ProfileList& Ogre::TerrainMaterialGenerator::getProfiles | ( |  | ) | const`[virtual]`

Get the list of profiles that this generator supports.

Definition at line 208 of file OgreTerrainMaterialGenerator.h.

virtual bool Ogre::TerrainMaterialGenerator::isVertexCompressionSupported | ( |  | ) | const`[virtual]`

Return whether this material generator supports using a compressed vertex format.

This is only possible when using shaders.

Definition at line 271 of file OgreTerrainMaterialGenerator.h.

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,
|  | 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 107 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 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 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.

virtual void Ogre::TerrainMaterialGenerator::requestOptions | ( | Terrain * | terrain | ) | `[virtual]`

Triggers the generator to request the options that it needs.

Definition at line 278 of file OgreTerrainMaterialGenerator.h.

References Ogre::TerrainMaterialGenerator::Profile::requestOptions().

virtual void Ogre::TerrainMaterialGenerator::setActiveProfile | ( | const String & | name | ) | `[virtual]`

Set the active profile by name.

Definition at line 211 of file OgreTerrainMaterialGenerator.h.

virtual void Ogre::TerrainMaterialGenerator::setActiveProfile | ( | Profile * | p | ) | `[virtual]`

Set the active Profile.

Definition at line 228 of file OgreTerrainMaterialGenerator.h.

virtual void Ogre::TerrainMaterialGenerator::setDebugLevel | ( | unsigned int | dbg | ) | `[virtual]`

Set the debug level of the material.

Remarks:
  Sets the level of debug display for this material. What this debug level means is entirely depdendent on the generator, the only constant is that 0 means 'no debug' and non-zero means 'some level of debugging', with any graduations in non-zero values being generator-specific.

Definition at line 358 of file OgreTerrainMaterialGenerator.h.

virtual void Ogre::TerrainMaterialGenerator::updateCompositeMap | ( | const Terrain * | terrain,
|  | const Rect & | rect
| ) |  | `[virtual]`

Update the composite map for a terrain.

The composite map for a terrain must match what the terrain should look like at distance. This method will only be called in the render thread so the generator is free to render into a texture to support this, so long as the results are blitted into the Terrain's own composite map afterwards.

Definition at line 323 of file OgreTerrainMaterialGenerator.h.

References Ogre::TerrainMaterialGenerator::Profile::updateCompositeMap().

virtual void Ogre::TerrainMaterialGenerator::updateParams | ( | const MaterialPtr & | mat,
|  | const Terrain * | terrain
| ) |  | `[virtual]`

Update parameters for the given terrain using the active profile.

Definition at line 335 of file OgreTerrainMaterialGenerator.h.

References Ogre::TerrainMaterialGenerator::Profile::updateParams().

virtual void Ogre::TerrainMaterialGenerator::updateParamsForCompositeMap | ( | const MaterialPtr & | mat,
|  | const Terrain * | terrain
| ) |  | `[virtual]`

Update parameters for the given terrain composite map using the active profile.

Definition at line 343 of file OgreTerrainMaterialGenerator.h.

References Ogre::TerrainMaterialGenerator::Profile::updateParamsForCompositeMap().

## Member Data Documentation

Profile* Ogre::TerrainMaterialGenerator::mActiveProfile `[mutable, protected]`

Definition at line 383 of file OgreTerrainMaterialGenerator.h.

unsigned long long int Ogre::TerrainMaterialGenerator::mChangeCounter `[protected]`

Definition at line 384 of file OgreTerrainMaterialGenerator.h.

Camera* Ogre::TerrainMaterialGenerator::mCompositeMapCam `[protected]`

Definition at line 388 of file OgreTerrainMaterialGenerator.h.

Light* Ogre::TerrainMaterialGenerator::mCompositeMapLight `[protected]`

Definition at line 391 of file OgreTerrainMaterialGenerator.h.

ManualObject* Ogre::TerrainMaterialGenerator::mCompositeMapPlane `[protected]`

Definition at line 390 of file OgreTerrainMaterialGenerator.h.

Texture* Ogre::TerrainMaterialGenerator::mCompositeMapRTT `[protected]`

Definition at line 389 of file OgreTerrainMaterialGenerator.h.

SceneManager* Ogre::TerrainMaterialGenerator::mCompositeMapSM `[protected]`

Definition at line 387 of file OgreTerrainMaterialGenerator.h.

unsigned int Ogre::TerrainMaterialGenerator::mDebugLevel `[protected]`

Definition at line 386 of file OgreTerrainMaterialGenerator.h.

TerrainLayerDeclaration Ogre::TerrainMaterialGenerator::mLayerDecl `[protected]`

Definition at line 385 of file OgreTerrainMaterialGenerator.h.

ProfileList Ogre::TerrainMaterialGenerator::mProfiles `[protected]`

Definition at line 382 of file OgreTerrainMaterialGenerator.h.

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

- OgreTerrainMaterialGenerator.h

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sun Sep 2 2012 07:27:44