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