mercator 0.4.0
A terrain generation library for the Worldforge system.
|
Shader to give the appearance of deep murky water. More...
#include <DepthShader.h>
Public Types | |
typedef std::map< std::string, float > | Parameters |
STL map of parameter values for a shader constructor. More... | |
Public Member Functions | |
DepthShader (float waterLevel=default_waterLevel, float murkyDepth=default_murkyDepth) | |
Constructor. More... | |
DepthShader (const Parameters ¶ms) | |
Constructor. More... | |
float | waterLevel () const |
Accessor for the level of the surface of the water. More... | |
float | murkyDepth () const |
Accessor for the depth at which the bottom becomes completely obscured. More... | |
bool | checkIntersect (const Segment &) const override |
Check whether this Shader has any effect on the given Segment. More... | |
void | shade (Surface &) const override |
Populate a Surface with data. 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... | |
Static Public Attributes | |
static const std::string | key_waterLevel |
Key string used when specifying the water level parameter. More... | |
static const std::string | key_murkyDepth |
Key string used when specifying the murky depth parameter. More... | |
static const float | default_waterLevel = 0.f |
Default level of the surface of the water. More... | |
static const float | default_murkyDepth = -64.f |
Default depth at which the bottom becomes completely obscured. More... | |
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.
Definition at line 19 of file DepthShader.h.
|
inherited |
|
explicit |
Constructor.
waterLevel | level of the surface of the water. |
murkyDepth | depth at which the bottom becomes completely obscured. |
Definition at line 29 of file DepthShader.cpp.
|
explicit |
Constructor.
params | a map of parameters for the shader. |
Definition at line 34 of file DepthShader.cpp.
References key_murkyDepth, and key_waterLevel.
|
overridevirtual |
Check whether this Shader has any effect on the given Segment.
Implements Mercator::Shader.
Definition at line 50 of file DepthShader.cpp.
References Mercator::Segment::getMin().
|
inlineinherited |
|
inlineinherited |
|
inline |
Accessor for the depth at which the bottom becomes completely obscured.
Definition at line 51 of file DepthShader.h.
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().
|
overridevirtual |
Populate a Surface with data.
Implements Mercator::Shader.
Definition at line 59 of file DepthShader.cpp.
References Mercator::Buffer< DataType >::getChannels(), Mercator::Buffer< DataType >::getData(), Mercator::Segment::getPoints(), Mercator::Surface::getSegment(), and Mercator::Segment::getSize().
|
inline |
Accessor for the level of the surface of the water.
Definition at line 49 of file DepthShader.h.
|
static |
Default depth at which the bottom becomes completely obscured.
Definition at line 34 of file DepthShader.h.
|
static |
Default level of the surface of the water.
Definition at line 32 of file DepthShader.h.
|
static |
Key string used when specifying the murky depth parameter.
Definition at line 29 of file DepthShader.h.
Referenced by DepthShader().
|
static |
Key string used when specifying the water level parameter.
Definition at line 27 of file DepthShader.h.
Referenced by DepthShader().