Go to the documentation of this file.
29 #ifndef __Ogre_TerrainMaterialGenerator_H__
30 #define __Ogre_TerrainMaterialGenerator_H__
83 return source == e.
source &&
90 source(0), semantic(
TLSS_ALBEDO), elementStart(0), elementCount(0)
95 : source(src), semantic(sem), elementStart(elemStart), elementCount(elemCount)
121 : alias(aliasName), format(fmt)
175 : mParent(parent), mName(name), mDesc(desc) {}
177 : mParent(prof.mParent), mName(prof.mName), mDesc(prof.mDesc) {}
186 virtual bool isVertexCompressionSupported()
const = 0;
192 virtual void setLightmapEnabled(
bool enabled) = 0;
194 virtual uint8 getMaxLayers(
const Terrain* terrain)
const = 0;
196 virtual void updateCompositeMap(
const Terrain* terrain,
const Rect& rect);
201 virtual void updateParamsForCompositeMap(
const MaterialPtr& mat,
const Terrain* terrain) = 0;
204 virtual void requestOptions(
Terrain* terrain) = 0;
221 if (!mActiveProfile || mActiveProfile->getName() != name)
223 for (ProfileList::iterator i = mProfiles.begin(); i != mProfiles.end(); ++i)
225 if ((*i)->getName() == name)
227 setActiveProfile(*i);
238 if (mActiveProfile != p)
248 if (!mActiveProfile && !mProfiles.empty())
249 mActiveProfile = mProfiles[0];
251 return mActiveProfile;
273 return decl == mLayerDecl;
281 return getActiveProfile()->isVertexCompressionSupported();
288 Profile* p = getActiveProfile();
297 Profile* p = getActiveProfile();
307 Profile* p = getActiveProfile();
318 Profile* p = getActiveProfile();
327 Profile* p = getActiveProfile();
342 Profile* p = getActiveProfile();
354 Profile* p = getActiveProfile();
362 Profile* p = getActiveProfile();
377 if (mDebugLevel != dbg)
392 virtual void _renderCompositeMap(
size_t size,
const Rect& rect,
virtual void updateCompositeMap(const Terrain *terrain, const Rect &rect)
Update the composite map for a terrain.
Abstract class representing a Texture resource.
uint8 source
The source sampler index of this element relative to LayerDeclaration's list.
Profile * getActiveProfile() const
Get the active profile.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Profile(TerrainMaterialGenerator *parent, const String &name, const String &desc)
Class that provides functionality to generate materials for use with a terrain.
TerrainLayerDeclaration mLayerDecl
A viewpoint from which the scene will be rendered.
virtual uint8 getMaxLayers(const Terrain *terrain) const
Get the maximum number of layers supported with the given terrain.
TerrainLayerSampler(const String &aliasName, PixelFormat fmt)
TerrainMaterialGenerator * getParent() const
Get the generator which owns this profile.
virtual uint8 getMaxLayers(const Terrain *terrain) const =0
Get the number of layers supported.
Tangent-space normal information from a detail texture.
TerrainLayerSamplerElementList elements
PixelFormat format
The format required of this texture.
#define _OgreTerrainExport
Profile(const Profile &prof)
SharedPtr< Material > MaterialPtr
Representation of a dynamic light source in the scene.
The main containing class for a chunk of terrain.
const String & getName() const
Get the name of this profile.
TerrainLayerSamplerList samplers
TerrainLayerSamplerSemantic semantic
The semantic this element represents.
virtual void setLightmapEnabled(bool enabled)=0
Whether to support a light map over the terrain in the shader, if it's present (default true)
Class providing a much simplified interface to generating manual objects with custom geometry.
The definition of the information each layer will contain in this terrain.
Inner class which should also be subclassed to provide profile-specific material generation.
String alias
A descriptive name that is merely used to assist in recognition.
virtual MaterialPtr generateForCompositeMap(const Terrain *terrain)
Generate a material for the given composite map of the terrain using the active profile.
virtual const TerrainLayerDeclaration & getLayerDeclaration() const
Get the layer declaration that this material generator operates with.
Texture * _getCompositeMapRTT()
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 void updateParams(const MaterialPtr &mat, const Terrain *terrain)
Update parameters for the given terrain using the active profile.
vector< TerrainLayerSamplerElement >::type TerrainLayerSamplerElementList
PixelFormat
The pixel format used for images, textures, and render surfaces.
Manages the organisation and rendering of a 'scene' i.e.
uint8 elementCount
The number of colour elements this semantic uses (usually standard per semantic)
Camera * mCompositeMapCam
virtual void setActiveProfile(const String &name)
Set the active profile by name.
uint8 elementStart
The colour element at which this element starts.
TerrainLayerSamplerElement()
virtual MaterialPtr generate(const Terrain *terrain)=0
Generate / reuse a material for the terrain.
virtual bool isVertexCompressionSupported() const
Return whether this material generator supports using a compressed vertex format.
virtual void updateCompositeMap(const Terrain *terrain, const Rect &rect)
Update the composite map for a terrain.
virtual void setLightmapEnabled(bool enabled)
Whether to support a light map over the terrain in the shader, if it's present (default true).
virtual MaterialPtr generate(const Terrain *terrain)
Generate a material for the given terrain using the active profile.
virtual MaterialPtr generateForCompositeMap(const Terrain *terrain)=0
Generate / reuse a material for the terrain.
Albedo colour (diffuse reflectance colour)
virtual bool canGenerateUsingDeclaration(const TerrainLayerDeclaration &decl)
Whether this generator can generate a material for a given declaration.
virtual void requestOptions(Terrain *terrain)=0
Request the options needed from the terrain.
virtual const ProfileList & getProfiles() const
Get the list of profiles that this generator supports.
Texture * mCompositeMapRTT
SharedPtr< TerrainMaterialGenerator > TerrainMaterialGeneratorPtr
virtual void updateParams(const MaterialPtr &mat, const Terrain *terrain)=0
Update params for a terrain.
bool operator==(const TerrainLayerSampler &s) const
Height information for the detail texture.
SceneManager * mCompositeMapSM
virtual unsigned int getDebugLevel() const
Get the debug level of the material.
const String & getDescription() const
Get the description of this profile.
TerrainLayerSamplerSemantic
Enumeration of types of data that can be read from textures that are specific to a given layer.
bool operator==(const TerrainLayerSamplerElement &e) const
Description of a sampler that will be used with each layer.
TerrainLayerSamplerElement(uint8 src, TerrainLayerSamplerSemantic sem, uint8 elemStart, uint8 elemCount)
unsigned long long int mChangeCounter
virtual void updateParamsForCompositeMap(const MaterialPtr &mat, const Terrain *terrain)=0
Update params for a terrain.
virtual void requestOptions(Terrain *terrain)
Triggers the generator to request the options that it needs.
vector< TerrainLayerSampler >::type TerrainLayerSamplerList
Information about one element of a sampler / texture within a layer.
vector< Profile * >::type ProfileList
List of profiles - NB should be ordered in descending complexity.
TerrainMaterialGenerator * mParent
ManualObject * mCompositeMapPlane
unsigned long long int getChangeCount() const
Returns the number of times the generator has undergone a change which would require materials to be ...
bool operator==(const TerrainLayerDeclaration &dcl) const
void _markChanged()
Internal method - indicates that a change has been made that would require material regeneration.
virtual void setActiveProfile(Profile *p)
Set the active Profile.
Light * mCompositeMapLight
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.