OGRE  2.2.4
Object-Oriented Graphics Rendering Engine
Ogre::TerrainMaterialGenerator Class Reference

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

#include <OgreTerrainMaterialGenerator.h>

+ Inheritance diagram for Ogre::TerrainMaterialGenerator:

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. More...
 

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...
 
virtual void _renderCompositeMap (size_t size, const Rect &rect, const MaterialPtr &mat, const TexturePtr &destCompositeMap)
 Helper method to render a composite map. More...
 
virtual bool canGenerateUsingDeclaration (const TerrainLayerDeclaration &decl)
 Whether this generator can generate a material for a given declaration. More...
 
virtual MaterialPtr generate (const Terrain *terrain)
 Generate a material for the given terrain using the active profile. More...
 
virtual MaterialPtr generateForCompositeMap (const Terrain *terrain)
 Generate a material for the given composite map of the terrain using the active profile. More...
 
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...
 
virtual unsigned int getDebugLevel () const
 Get the debug level of the material. More...
 
virtual 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 const ProfileListgetProfiles () const
 Get the list of profiles that this generator supports. More...
 
virtual bool isVertexCompressionSupported () const
 Return whether this material generator supports using a compressed vertex format. More...
 
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 *)
 
void * operator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info More...
 
void * operator new (size_t sz)
 
void * operator new (size_t sz, void *ptr)
 placement operator new More...
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info More...
 
void * operator new[] (size_t sz)
 
virtual void requestOptions (Terrain *terrain)
 Triggers the generator to request the options that it needs. More...
 
virtual void setActiveProfile (const String &name)
 Set the active profile by name. More...
 
virtual void setActiveProfile (Profile *p)
 Set the active Profile. More...
 
virtual 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...
 
virtual 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.

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).

Member Typedef Documentation

◆ ProfileList

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

Constructor & Destructor Documentation

◆ TerrainMaterialGenerator()

Ogre::TerrainMaterialGenerator::TerrainMaterialGenerator ( )

◆ ~TerrainMaterialGenerator()

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

Member Function Documentation

◆ _getCompositeMapRTT()

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

◆ _markChanged()

void Ogre::TerrainMaterialGenerator::_markChanged ( )
inline

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

◆ _renderCompositeMap()

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
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

◆ canGenerateUsingDeclaration()

virtual bool Ogre::TerrainMaterialGenerator::canGenerateUsingDeclaration ( const TerrainLayerDeclaration decl)
inlinevirtual

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.

◆ generate()

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

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

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

◆ generateForCompositeMap()

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

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

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

◆ getActiveProfile()

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

Get the active profile.

◆ 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.

◆ getDebugLevel()

virtual unsigned int Ogre::TerrainMaterialGenerator::getDebugLevel ( ) const
inlinevirtual

Get the debug level of the material.

◆ getLayerDeclaration()

virtual const TerrainLayerDeclaration& Ogre::TerrainMaterialGenerator::getLayerDeclaration ( ) const
inlinevirtual

Get the layer declaration that this material generator operates with.

◆ 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.

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

◆ getProfiles()

virtual const ProfileList& Ogre::TerrainMaterialGenerator::getProfiles ( ) const
inlinevirtual

Get the list of profiles that this generator supports.

◆ 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.

◆ operator delete() [1/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr)
inlineinherited

◆ operator delete() [2/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
void *   
)
inlineinherited

◆ operator delete() [3/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator delete[]() [1/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr)
inlineinherited

◆ operator delete[]() [2/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator new() [1/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

operator new, with debug line info

◆ operator new() [2/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

◆ operator new() [3/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void *  ptr 
)
inlineinherited

placement operator new

◆ operator new[]() [1/2]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

array operator new, with debug line info

◆ operator new[]() [2/2]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz)
inlineinherited

◆ requestOptions()

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

Triggers the generator to request the options that it needs.

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

◆ setActiveProfile() [1/2]

virtual void Ogre::TerrainMaterialGenerator::setActiveProfile ( const String name)
inlinevirtual

Set the active profile by name.

◆ setActiveProfile() [2/2]

virtual void Ogre::TerrainMaterialGenerator::setActiveProfile ( Profile p)
inlinevirtual

Set the active Profile.

◆ setDebugLevel()

virtual void Ogre::TerrainMaterialGenerator::setDebugLevel ( unsigned int  dbg)
inlinevirtual

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.

◆ 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).

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

◆ updateCompositeMap()

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

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.

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

◆ updateParams()

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

Update parameters for the given terrain using the active profile.

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

◆ 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.

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


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