mercator  0.4.0
A terrain generation library for the Worldforge system.
Mercator::LowShader Class Reference

Surface shader that defines the surface below a given level. More...

#include <ThresholdShader.h>

Inheritance diagram for Mercator::LowShader:
Collaboration diagram for Mercator::LowShader:

Public Types

typedef std::map< std::string, float > Parameters
 STL map of parameter values for a shader constructor. More...
 

Public Member Functions

 LowShader (float threshold=default_threshold)
 Constructor. More...
 
 LowShader (const Parameters &params)
 Constructor. More...
 
float threshold () const
 Accessor for level below which the shader renders. 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< SurfacenewSurface (const Segment &) const
 Create a new Surface which matches the requirements of this shader. More...
 

Static Public Attributes

static const std::string key_threshold
 Key string used when specifying the threshold parameter. More...
 
static const float default_threshold = -1.f
 Default level below which the shader renders. More...
 

Detailed Description

Surface shader that defines the surface below a given level.

Definition at line 44 of file ThresholdShader.h.

Member Typedef Documentation

◆ Parameters

typedef std::map<std::string, float> Mercator::Shader::Parameters
inherited

STL map of parameter values for a shader constructor.

Definition at line 59 of file Shader.h.

Constructor & Destructor Documentation

◆ LowShader() [1/2]

Mercator::LowShader::LowShader ( float  threshold = default_threshold)
explicit

Constructor.

Parameters
thresholdlevel below which the shader renders.

Definition at line 70 of file ThresholdShader.cpp.

◆ LowShader() [2/2]

Mercator::LowShader::LowShader ( const Parameters params)
explicit

Constructor.

Parameters
paramsa map of parameters for the shader.

Definition at line 74 of file ThresholdShader.cpp.

References key_threshold.

Member Function Documentation

◆ checkIntersect()

bool Mercator::LowShader::checkIntersect ( const Segment ) const
overridevirtual

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.

Definition at line 85 of file ThresholdShader.cpp.

References Mercator::Segment::getMin().

◆ getAlpha()

bool Mercator::Shader::getAlpha ( ) const
inlineinherited

Accessor for alpha flag.

Definition at line 42 of file Shader.h.

References Mercator::Shader::checkIntersect(), Mercator::Shader::newSurface(), and Mercator::Shader::shade().

◆ getColor()

bool Mercator::Shader::getColor ( ) const
inlineinherited

Accessor for color flag.

Definition at line 37 of file Shader.h.

◆ newSurface()

std::unique_ptr< Surface > Mercator::Shader::newSurface ( const Segment segment) const
inherited

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 Mercator::Shader::getAlpha().

◆ shade()

◆ threshold()

float Mercator::LowShader::threshold ( ) const
inline

Accessor for level below which the shader renders.

Definition at line 67 of file ThresholdShader.h.

References Mercator::HighShader::checkIntersect(), and Mercator::HighShader::shade().

Member Data Documentation

◆ default_threshold

const float Mercator::LowShader::default_threshold = -1.f
static

Default level below which the shader renders.

Definition at line 53 of file ThresholdShader.h.

Referenced by Mercator::HighShader::shade().

◆ key_threshold

const std::string Mercator::LowShader::key_threshold
static

Key string used when specifying the threshold parameter.

Definition at line 50 of file ThresholdShader.h.

Referenced by LowShader(), and Mercator::HighShader::shade().


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