Mercator
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Mercator::Shader Class Referenceabstract

Base class for Shader objects which create surface data for use when rendering terrain. More...

#include <Shader.h>

Inheritance diagram for Mercator::Shader:
Mercator::AreaShader Mercator::BandShader Mercator::DepthShader Mercator::FillShader Mercator::GrassShader Mercator::HighShader Mercator::LowShader Mercator::TileShader

Public Types

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

Public Member Functions

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...
 
virtual bool checkIntersect (const Segment &) const =0
 Check whether this Shader has any effect on the given Segment. More...
 
virtual void shade (Surface &) const =0
 Populate a Surface with data.
 

Protected Member Functions

 Shader (bool color=false, bool alpha=true)
 Protected constructor for classes which inherit from this one. More...
 

Private Attributes

const bool m_color
 Flag to control whether this Shader produces color data.
 
const bool m_alpha
 Flag to control whether this Shader produces alpha data.
 

Detailed Description

Base class for Shader objects which create surface data for use when rendering terrain.

Shader objects take heightfield data for a terrain Segment, and use it to populate a Surface with data that can then be used to define the appearance of the terrain when rendering. The Shader is used both to create the Surface object of the right type, and to populate the Surface with data once the Segment heightfield has been generated.

Constructor & Destructor Documentation

Mercator::Shader::Shader ( bool  color = false,
bool  alpha = true 
)
explicitprotected

Protected constructor for classes which inherit from this one.

Permanently sents the color and alpha flags.

Member Function Documentation

virtual bool Mercator::Shader::checkIntersect ( const Segment ) const
pure 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.

Implemented in Mercator::GrassShader, Mercator::BandShader, Mercator::LowShader, Mercator::DepthShader, Mercator::HighShader, Mercator::TileShader, Mercator::AreaShader, and Mercator::FillShader.

Referenced by Mercator::Terrain::addShader(), and getAlpha().

Surface * Mercator::Shader::newSurface ( const Segment segment) const

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.

References m_alpha, and m_color.

Referenced by Mercator::Segment::addArea(), Mercator::Terrain::addShader(), and getAlpha().


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