mercator
0.4.0
A terrain generation library for the Worldforge system.
|
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. More... | |
Public Member Functions | |
virtual | ~Shader () |
Destructor does nothing interesting. More... | |
bool | getColor () const |
Accessor for color flag. More... | |
bool | getAlpha () const |
Accessor for alpha flag. More... | |
std::unique_ptr< Surface > | newSurface (const Segment &) const |
Create a new Surface which matches the requirements of this shader. More... | |
virtual bool | checkIntersect (const Segment &) const =0 |
Check whether this Shader has any effect on the given Segment. More... | |
virtual void | shade (Surface &) const =0 |
Populate a Surface with data. More... | |
Protected Member Functions | |
Shader (bool color=false, bool alpha=true) | |
Protected constructor for classes which inherit from this one. More... | |
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.
typedef std::map<std::string, float> Mercator::Shader::Parameters |
|
explicitprotected |
Protected constructor for classes which inherit from this one.
Permanently sets the color and alpha flags.
Definition at line 16 of file Shader.cpp.
References ~Shader().
|
virtualdefault |
Destructor does nothing interesting.
Referenced by Shader().
|
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 getAlpha().
|
inline |
Accessor for alpha flag.
Definition at line 42 of file Shader.h.
References checkIntersect(), newSurface(), and shade().
|
inline |
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.
Definition at line 27 of file Shader.cpp.
Referenced by Mercator::Terrain::addShader(), Mercator::Segment::clearMods(), and getAlpha().
|
pure virtual |
Populate a Surface with data.
Implemented in Mercator::GrassShader, Mercator::BandShader, Mercator::LowShader, Mercator::DepthShader, Mercator::HighShader, Mercator::TileShader, Mercator::FillShader, and Mercator::AreaShader.
Referenced by getAlpha(), and Mercator::Surface::populate().