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

Surface shader that defines the surface between two levels. More...

#include <ThresholdShader.h>

Inheritance diagram for Mercator::BandShader:
Collaboration diagram for Mercator::BandShader:

Public Types

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

Public Member Functions

 BandShader (float low_threshold=default_lowThreshold, float high_threshold=default_highThreshold)
 Constructor. More...
 
 BandShader (const Parameters &params)
 Constructor. More...
 
float lowThreshold () const
 Accessor for the level above which the shader renders. More...
 
float highThreshold () const
 Accessor for the 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_lowThreshold
 Key string used when specifying the low threshold parameter. More...
 
static const std::string key_highThreshold
 Key string used when specifying the high threshold parameter. More...
 
static const float default_lowThreshold = -1.f
 Default level above which the shader renders. More...
 
static const float default_highThreshold = 1.f
 Default level below which the shader renders. More...
 

Detailed Description

Surface shader that defines the surface between two levels.

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

◆ BandShader() [1/2]

Mercator::BandShader::BandShader ( float  low_threshold = default_lowThreshold,
float  high_threshold = default_highThreshold 
)
explicit

Constructor.

Parameters
low_thresholdlevel above which the shader renders.
high_thresholdlevel below which the shader renders.

Definition at line 124 of file ThresholdShader.cpp.

◆ BandShader() [2/2]

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

Constructor.

Parameters
paramsa map of parameters for the shader.

Definition at line 129 of file ThresholdShader.cpp.

References key_highThreshold, and key_lowThreshold.

Member Function Documentation

◆ checkIntersect()

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

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

◆ getAlpha()

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

Accessor for alpha flag.

Definition at line 42 of file Shader.h.

◆ getColor()

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

Accessor for color flag.

Definition at line 37 of file Shader.h.

◆ highThreshold()

float Mercator::BandShader::highThreshold ( ) const
inline

Accessor for the level below which the shader renders.

Definition at line 108 of file ThresholdShader.h.

◆ lowThreshold()

float Mercator::BandShader::lowThreshold ( ) const
inline

Accessor for the level above which the shader renders.

Definition at line 106 of file ThresholdShader.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().

◆ shade()

void Mercator::BandShader::shade ( Surface ) const
overridevirtual

Member Data Documentation

◆ default_highThreshold

const float Mercator::BandShader::default_highThreshold = 1.f
static

Default level below which the shader renders.

Definition at line 90 of file ThresholdShader.h.

◆ default_lowThreshold

const float Mercator::BandShader::default_lowThreshold = -1.f
static

Default level above which the shader renders.

Definition at line 88 of file ThresholdShader.h.

◆ key_highThreshold

const std::string Mercator::BandShader::key_highThreshold
static

Key string used when specifying the high threshold parameter.

Definition at line 85 of file ThresholdShader.h.

Referenced by BandShader().

◆ key_lowThreshold

const std::string Mercator::BandShader::key_lowThreshold
static

Key string used when specifying the low threshold parameter.

Definition at line 83 of file ThresholdShader.h.

Referenced by BandShader().


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