Mercator  0.4.0
Public Member Functions | Static Public Attributes | List of all members
Mercator::GrassShader Class Reference

Shader for adding grass to the terrain. More...

#include <GrassShader.h>

Inheritance diagram for Mercator::GrassShader:
Mercator::Shader

Public Member Functions

 GrassShader (float lowThreshold=default_lowThreshold, float highThreshold=default_highThreshold, float cutoff=default_cutoff, float intercept=default_intercept)
 Constructor. More...
 
 GrassShader (const Parameters &params)
 Constructor. More...
 
float lowThreshold () const
 Accessor for level above which the shader renders.
 
float highThreshold () const
 Accessor for level below which the shader renders.
 
float cutoff () const
 Accessor for slope below which grass is opaque.
 
float intercept () const
 Accessor for slope steeper than which no grass grows.
 
virtual bool checkIntersect (const Segment &) const
 Check whether this Shader has any effect on the given Segment. More...
 
virtual void shade (Surface &) const
 Populate a Surface with data.
 
- Public Member Functions inherited from Mercator::Shader
virtual ~Shader ()
 Destructor does nothing interesting.
 
bool getColor () const
 Accessor for color flag.
 
bool getAlpha () const
 Accessor for alpha flag.
 
SurfacenewSurface (const Segment &) const
 Create a new Surface which matches the requirements of this shader. More...
 

Static Public Attributes

static const std::string key_lowThreshold
 Key string used when specifying the low threshold parameter.
 
static const std::string key_highThreshold
 Key string used when specifying the high threshold parameter.
 
static const std::string key_cutoff
 Key string used when specifying the cutoff parameter.
 
static const std::string key_intercept
 Key string used when specifying the intercept parameter.
 
static const float default_lowThreshold = 1.f
 Default level above which the shader renders.
 
static const float default_highThreshold = 20.f
 Default level below which the shader renders.
 
static const float default_cutoff = 1.f
 Default slope below which grass is opaque.
 
static const float default_intercept = 2.f
 Default slope steeper than which no grass grows.
 

Additional Inherited Members

- Public Types inherited from Mercator::Shader
typedef std::map< std::string, float > Parameters
 STL map of parameter values for a shader constructor.
 
- Protected Member Functions inherited from Mercator::Shader
 Shader (bool color=false, bool alpha=true)
 Protected constructor for classes which inherit from this one. More...
 

Detailed Description

Shader for adding grass to the terrain.

This shader is used to add grassy vegetation to some terrain. The mask generated by this shader depends on two factors. The altitude of the terrain, and its slope. Two parameter specify the low and high altitude values between which vegetation grows. The low value will typically be just above sea level, and the high value could be anything up to the height above which plants cannot grow.

Constructor & Destructor Documentation

Mercator::GrassShader::GrassShader ( float  lowThreshold = default_lowThreshold,
float  highThreshold = default_highThreshold,
float  cutoff = default_cutoff,
float  intercept = default_intercept 
)
explicit

Constructor.

Parameters
lowThresholdlevel above which the shader renders.
highThresholdlevel above which the shader renders.
cutoffslope below which grass is opaque.
interceptslope steeper than which no grass grows.
Mercator::GrassShader::GrassShader ( const Parameters params)
explicit

Constructor.

Parameters
paramsa map of parameters for the shader.

Member Function Documentation

bool Mercator::GrassShader::checkIntersect ( const Segment ) const
virtual

Check whether this Shader has any effect on the given Segment.

Returns
true if the given Segment height range is within the range that this Shader uses. e.g. A high altitude snow shader will have no effect on low level terrain.

Implements Mercator::Shader.


The documentation for this class was generated from the following files: