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

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

#include <ThresholdShader.h>

Inheritance diagram for Mercator::HighShader:
Collaboration diagram for Mercator::HighShader:

Public Types

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

Public Member Functions

 HighShader (float threshold=default_threshold)
 Constructor. More...
 
 HighShader (const Parameters &params)
 Constructor. More...
 
float threshold () const
 Accessor for level above 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 above which the shader renders. More...
 

Detailed Description

Surface shader that defines the surface above a given level.

Definition at line 13 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

◆ HighShader() [1/2]

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

Constructor.

Parameters
thresholdlevel below which the shader renders.

Definition at line 18 of file ThresholdShader.cpp.

◆ HighShader() [2/2]

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

Constructor.

Parameters
paramsa map of parameters for the shader.

Definition at line 22 of file ThresholdShader.cpp.

References key_threshold.

Member Function Documentation

◆ checkIntersect()

bool Mercator::HighShader::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 33 of file ThresholdShader.cpp.

References Mercator::Segment::getMax().

Referenced by Mercator::BandShader::highThreshold(), threshold(), and Mercator::LowShader::threshold().

◆ 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::HighShader::threshold ( ) const
inline

Accessor for level above which the shader renders.

Definition at line 36 of file ThresholdShader.h.

References checkIntersect(), and shade().

Member Data Documentation

◆ default_threshold

const float Mercator::HighShader::default_threshold = 1.f
static

Default level above which the shader renders.

Definition at line 22 of file ThresholdShader.h.

◆ key_threshold

const std::string Mercator::HighShader::key_threshold
static

Key string used when specifying the threshold parameter.

Definition at line 19 of file ThresholdShader.h.

Referenced by HighShader().


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