OGRE  14.2
Object-Oriented Graphics Rendering Engine
Ogre::TerrainMaterialGenerator Class Referenceabstract

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

#include <OgreTerrainMaterialGenerator.h>

+ Inheritance diagram for Ogre::TerrainMaterialGenerator:

Classes

struct  Profile
 

Public Member Functions

 TerrainMaterialGenerator ()
 
virtual ~TerrainMaterialGenerator ()
 
Texture_getCompositeMapRTT ()
 
void _markChanged ()
 Internal method - indicates that a change has been made that would require material regeneration. More...
 
void _renderCompositeMap (size_t size, const Rect &rect, const MaterialPtr &mat, const TexturePtr &destCompositeMap)
 Helper method to render a composite map. More...
 
virtual MaterialPtr generate (const Terrain *terrain)=0
 Generate a material for the given terrain using the active profile. More...
 
virtual MaterialPtr generateForCompositeMap (const Terrain *terrain)=0
 Generate a material for the given composite map of the terrain using the active profile. More...
 
virtual ProfilegetActiveProfile () const
 Get the active profile. More...
 
unsigned long long int getChangeCount () const
 Returns the number of times the generator has undergone a change which would require materials to be regenerated. More...
 
unsigned int getDebugLevel () const
 Get the debug level of the material. More...
 
const TerrainLayerDeclarationgetLayerDeclaration () const
 Get the layer declaration that this material generator operates with. More...
 
virtual uint8 getMaxLayers (const Terrain *terrain) const
 Get the maximum number of layers supported with the given terrain. More...
 
virtual bool isVertexCompressionSupported () const
 Return whether this material generator supports using a compressed vertex format. More...
 
virtual void requestOptions (Terrain *terrain)
 Triggers the generator to request the options that it needs. More...
 
void setDebugLevel (unsigned int dbg)
 Set the debug level of the material. More...
 
virtual void setLightmapEnabled (bool enabled)
 Whether to support a light map over the terrain in the shader, if it's present (default true). More...
 
void updateCompositeMap (const Terrain *terrain, const Rect &rect)
 Update the composite map for a terrain. More...
 
virtual void updateParams (const MaterialPtr &mat, const Terrain *terrain)
 Update parameters for the given terrain using the active profile. More...
 
virtual void updateParamsForCompositeMap (const MaterialPtr &mat, const Terrain *terrain)
 Update parameters for the given terrain composite map using the active profile. More...
 

Detailed Description

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

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.

Constructor & Destructor Documentation

◆ TerrainMaterialGenerator()

Ogre::TerrainMaterialGenerator::TerrainMaterialGenerator ( )

◆ ~TerrainMaterialGenerator()

virtual Ogre::TerrainMaterialGenerator::~TerrainMaterialGenerator ( )
virtual

Member Function Documentation

◆ getActiveProfile()

virtual Profile* Ogre::TerrainMaterialGenerator::getActiveProfile ( ) const
inlinevirtual

Get the active profile.

Reimplemented in Ogre::TerrainMaterialGeneratorA.

◆ _markChanged()

void Ogre::TerrainMaterialGenerator::_markChanged ( )
inline

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

◆ getChangeCount()

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

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

◆ getLayerDeclaration()

const TerrainLayerDeclaration& Ogre::TerrainMaterialGenerator::getLayerDeclaration ( ) const
inline

Get the layer declaration that this material generator operates with.

◆ isVertexCompressionSupported()

virtual bool Ogre::TerrainMaterialGenerator::isVertexCompressionSupported ( ) const
inlinevirtual

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

This is only possible when using shaders.

Reimplemented in Ogre::TerrainMaterialGeneratorA.

◆ requestOptions()

virtual void Ogre::TerrainMaterialGenerator::requestOptions ( Terrain terrain)
inlinevirtual

Triggers the generator to request the options that it needs.

Reimplemented in Ogre::TerrainMaterialGeneratorA.

◆ generate()

virtual MaterialPtr Ogre::TerrainMaterialGenerator::generate ( const Terrain terrain)
pure virtual

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

Implemented in Ogre::TerrainMaterialGeneratorA.

◆ generateForCompositeMap()

virtual MaterialPtr Ogre::TerrainMaterialGenerator::generateForCompositeMap ( const Terrain terrain)
pure virtual

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

Implemented in Ogre::TerrainMaterialGeneratorA.

◆ setLightmapEnabled()

virtual void Ogre::TerrainMaterialGenerator::setLightmapEnabled ( bool  enabled)
inlinevirtual

Whether to support a light map over the terrain in the shader, if it's present (default true).

Reimplemented in Ogre::TerrainMaterialGeneratorA.

◆ getMaxLayers()

virtual uint8 Ogre::TerrainMaterialGenerator::getMaxLayers ( const Terrain terrain) const
inlinevirtual

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

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

Reimplemented in Ogre::TerrainMaterialGeneratorA.

◆ updateCompositeMap()

void Ogre::TerrainMaterialGenerator::updateCompositeMap ( const Terrain terrain,
const Rect rect 
)

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.

◆ updateParams()

virtual void Ogre::TerrainMaterialGenerator::updateParams ( const MaterialPtr mat,
const Terrain terrain 
)
inlinevirtual

Update parameters for the given terrain using the active profile.

Reimplemented in Ogre::TerrainMaterialGeneratorA.

◆ updateParamsForCompositeMap()

virtual void Ogre::TerrainMaterialGenerator::updateParamsForCompositeMap ( const MaterialPtr mat,
const Terrain terrain 
)
inlinevirtual

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

Reimplemented in Ogre::TerrainMaterialGeneratorA.

◆ setDebugLevel()

void Ogre::TerrainMaterialGenerator::setDebugLevel ( unsigned int  dbg)
inline

Set the debug level of the material.

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.

◆ getDebugLevel()

unsigned int Ogre::TerrainMaterialGenerator::getDebugLevel ( ) const
inline

Get the debug level of the material.

◆ _renderCompositeMap()

void Ogre::TerrainMaterialGenerator::_renderCompositeMap ( size_t  size,
const Rect rect,
const MaterialPtr mat,
const TexturePtr destCompositeMap 
)

Helper method to render a composite map.

Parameters
sizeThe requested composite map size
rectThe region of the composite map to update, in image space
matThe material to use to render the map
destCompositeMapA TexturePtr for the composite map to be written into

◆ _getCompositeMapRTT()

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

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