29 #ifndef __Ogre_TerrainMaterialGenerator_H__
30 #define __Ogre_TerrainMaterialGenerator_H__
83 return source == e.
source &&
92 : source(src), semantic(sem), elementStart(elemStart), elementCount(elemCount)
115 : alias(aliasName), format(fmt)
169 : mParent(parent), mName(name), mDesc(desc) {}
171 : mParent(prof.mParent), mName(prof.mName), mDesc(prof.mDesc) {}
185 virtual uint8 getMaxLayers(
const Terrain* terrain)
const = 0;
187 virtual void updateCompositeMap(
const Terrain* terrain,
const Rect& rect);
192 virtual void updateParamsForCompositeMap(
const MaterialPtr& mat,
const Terrain* terrain) = 0;
195 virtual void requestOptions(
Terrain* terrain) = 0;
212 if (!mActiveProfile || mActiveProfile->getName() != name)
214 for (ProfileList::iterator i = mProfiles.begin(); i != mProfiles.end(); ++i)
216 if ((*i)->getName() == name)
218 setActiveProfile(*i);
229 if (mActiveProfile != p)
239 if (!mActiveProfile && !mProfiles.empty())
240 mActiveProfile = mProfiles[0];
242 return mActiveProfile;
264 return decl == mLayerDecl;
271 Profile* p = getActiveProfile();
280 Profile* p = getActiveProfile();
290 Profile* p = getActiveProfile();
301 Profile* p = getActiveProfile();
316 Profile* p = getActiveProfile();
328 Profile* p = getActiveProfile();
336 Profile* p = getActiveProfile();
351 if (mDebugLevel != dbg)
367 virtual void _renderCompositeMap(
size_t size,
const Rect& rect,
Camera * mCompositeMapCam
A viewpoint from which the scene will be rendered.
TerrainLayerDeclaration mLayerDecl
Texture * _getCompositeMapRTT()
virtual void updateParamsForCompositeMap(const MaterialPtr &mat, const Terrain *terrain)
Update parameters for the given terrain composite map using the active profile.
Class that provides functionality to generate materials for use with a terrain.
The main containing class for a chunk of terrain.
Class providing a much simplified interface to generating manual objects with custom geometry...
Profile(TerrainMaterialGenerator *parent, const String &name, const String &desc)
virtual uint8 getMaxLayers(const Terrain *terrain) const
Get the maximum number of layers supported with the given terrain.
const String & getName() const
Get the name of this profile.
Manages the organisation and rendering of a 'scene' i.e.
Profile * getActiveProfile() const
Get the active profile.
vector< TerrainLayerSampler >::type TerrainLayerSamplerList
Description of a sampler that will be used with each layer.
uint8 elementStart
The colour element at which this element starts.
virtual void requestOptions(Terrain *terrain)
Triggers the generator to request the options that it needs.
TerrainLayerSamplerElement(uint8 src, TerrainLayerSamplerSemantic sem, uint8 elemStart, uint8 elemCount)
virtual void updateParams(const MaterialPtr &mat, const Terrain *terrain)=0
Update params for a terrain.
virtual void setDebugLevel(unsigned int dbg)
Set the debug level of the material.
TerrainLayerSamplerElementList elements
#define _OgreTerrainExport
ManualObject * mCompositeMapPlane
void _markChanged()
Internal method - indicates that a change has been made that would require material regeneration...
TerrainMaterialGenerator * getParent() const
Get the generator which owns this profile.
Representation of a dynamic light source in the scene.
TerrainLayerSampler(const String &aliasName, PixelFormat fmt)
virtual MaterialPtr generate(const Terrain *terrain)=0
Generate / resuse a material for the terrain.
vector< TerrainLayerSamplerElement >::type TerrainLayerSamplerElementList
PixelFormat format
The format required of this texture.
vector< Profile * >::type ProfileList
List of profiles - NB should be ordered in descending complexity.
virtual void setActiveProfile(const String &name)
Set the active profile by name.
Tangent-space normal information from a detail texture.
PixelFormat
The pixel format used for images, textures, and render surfaces.
bool operator==(const TerrainLayerDeclaration &dcl) const
virtual void updateParams(const MaterialPtr &mat, const Terrain *terrain)
Update parameters for the given terrain using the active profile.
TerrainMaterialGenerator * mParent
TerrainLayerSamplerList samplers
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
bool operator==(const TerrainLayerSamplerElement &e) const
virtual MaterialPtr generateForCompositeMap(const Terrain *terrain)=0
Generate / resuse a material for the terrain.
Albedo colour (diffuse reflectance colour)
virtual void requestOptions(Terrain *terrain)=0
Request the options needed from the terrain.
Specialisation of SharedPtr to allow SharedPtr to be assigned to TexturePtr.
Light * mCompositeMapLight
Height information for the detail texture.
virtual void updateCompositeMap(const Terrain *terrain, const Rect &rect)
Update the composite map for a terrain.
unsigned long long int getChangeCount() const
Returns the number of times the generator has undergone a change which would require materials to be ...
SceneManager * mCompositeMapSM
virtual MaterialPtr generateForCompositeMap(const Terrain *terrain)
Generate a material for the given composite map of the terrain using the active profile.
Texture * mCompositeMapRTT
The definition of the information each layer will contain in this terrain.
TerrainLayerSamplerSemantic semantic
The semantic this element represents.
String alias
A descriptive name that is merely used to assist in recognition.
virtual void setActiveProfile(Profile *p)
Set the active Profile.
virtual const ProfileList & getProfiles() const
Get the list of profiles that this generator supports.
virtual MaterialPtr generate(const Terrain *terrain)
Generate a material for the given terrain using the active profile.
virtual unsigned int getDebugLevel() const
Get the debug level of the material.
SharedPtr< TerrainMaterialGenerator > TerrainMaterialGeneratorPtr
virtual void updateCompositeMap(const Terrain *terrain, const Rect &rect)
Update the composite map for a terrain.
virtual void updateParamsForCompositeMap(const MaterialPtr &mat, const Terrain *terrain)=0
Update params for a terrain.
uint8 source
The source sampler index of this element relative to LayerDeclaration's list.
unsigned long long int mChangeCounter
TerrainLayerSamplerElement()
bool operator==(const TerrainLayerSampler &s) const
uint8 elementCount
The number of colour elements this semantic uses (usually standard per semantic)
Inner class which should also be subclassed to provide profile-specific material generation.
Specialisation of SharedPtr to allow SharedPtr to be assigned to MaterialPtr.
Abstract class representing a Texture resource.
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...
Profile(const Profile &prof)
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.
Information about one element of a sampler / texture within a layer.
virtual uint8 getMaxLayers(const Terrain *terrain) const =0
Get the number of layers supported.