Mercator
|
Base class for Shader objects which create surface data for use when rendering terrain. More...
#include <Shader.h>
Public Types | |
typedef std::map< std::string, float > | Parameters |
STL map of parameter values for a shader constructor. | |
Public Member Functions | |
virtual | ~Shader () |
Destructor does nothing interesting. | |
bool | getColor () const |
Accessor for color flag. | |
bool | getAlpha () const |
Accessor for alpha flag. | |
Surface * | newSurface (const Segment &) const |
Create a new Surface which matches the requirements of this shader. | |
virtual bool | checkIntersect (const Segment &) const =0 |
Check whether this Shader has any effect on the given Segment. | |
virtual void | shade (Surface &) const =0 |
Populate a Surface with data. | |
Protected Member Functions | |
Shader (bool color=false, bool alpha=true) | |
Protected constructor for classes which inherit from this one. | |
Private Attributes | |
const bool | m_color |
Flag to control whether this Shader produces color data. | |
const bool | m_alpha |
Flag to control whether this Shader produces alpha data. |
Base class for Shader objects which create surface data for use when rendering terrain.
Shader objects take heightfield data for a terrain Segment, and use it to populate a Surface with data that can then be used to define the appearance of the terrain when rendering. The Shader is used both to create the Surface object of the right type, and to populate the Surface with data once the Segment heightfield has been generated.
Mercator::Shader::Shader | ( | bool | color = false , |
bool | alpha = true |
||
) | [explicit, protected] |
Protected constructor for classes which inherit from this one.
Permanently sents the color and alpha flags.
virtual bool Mercator::Shader::checkIntersect | ( | const Segment & | ) | const [pure virtual] |
Check whether this Shader has any effect on the given Segment.
Implemented in Mercator::GrassShader, Mercator::BandShader, Mercator::LowShader, Mercator::DepthShader, Mercator::HighShader, Mercator::TileShader, Mercator::AreaShader, and Mercator::FillShader.
Referenced by Mercator::Terrain::addShader().
Surface * Mercator::Shader::newSurface | ( | const Segment & | segment | ) | const |
Create a new Surface which matches the requirements of this shader.
Called by terrain when creating a new Segment to add the necessary Surface objects to that Segment.
References m_alpha, and m_color.
Referenced by Mercator::Segment::addArea(), and Mercator::Terrain::addShader().