Mercator
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
Mercator::DepthShader Class Reference

Shader to give the appearance of deep murky water. More...

#include <DepthShader.h>

Inheritance diagram for Mercator::DepthShader:
Mercator::Shader

Public Member Functions

 DepthShader (float waterLevel=default_waterLevel, float murkyDepth=default_murkyDepth)
 Constructor. More...
 
 DepthShader (const Parameters &params)
 Constructor. More...
 
const float waterLevel () const
 Accessor for the level of the surface of the water.
 
const float murkyDepth () const
 Accessor for the depth at which the bottom becomes completely obscured.
 
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_waterLevel
 Key string used when specifying the water level parameter.
 
static const std::string key_murkyDepth
 Key string used when specifying the murky depth parameter.
 
static const float default_waterLevel = 0.f
 Default level of the surface of the water.
 
static const float default_murkyDepth = -64.f
 Default depth at which the bottom becomes completely obscured.
 

Private Attributes

float m_waterLevel
 The level of the surface of the water.
 
float m_murkyDepth
 The depth at which the bottom becomes completely obscured.
 

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 to give the appearance of deep murky water.

Areas of terrain covered by water should be darker as less distinct as they get deeper. This shader adds a uniform alpha blended surface below water level which becomes more opaque as it gets deeper concealing the underlying appearance of the terrain from a viewer at the surface.

Constructor & Destructor Documentation

Mercator::DepthShader::DepthShader ( float  waterLevel = default_waterLevel,
float  murkyDepth = default_murkyDepth 
)
explicit

Constructor.

Parameters
waterLevellevel of the surface of the water.
murkyDepthdepth at which the bottom becomes completely obscured.
Mercator::DepthShader::DepthShader ( const Parameters params)
explicit

Constructor.

Parameters
paramsa map of parameters for the shader.

References key_murkyDepth, key_waterLevel, m_murkyDepth, and m_waterLevel.

Member Function Documentation

bool Mercator::DepthShader::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.

References Mercator::Segment::getMin(), and m_waterLevel.

Referenced by murkyDepth().


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