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

Shader agregating surface data. More...

#include <TileShader.h>

Inheritance diagram for Mercator::TileShader:
Collaboration diagram for Mercator::TileShader:

Public Types

typedef std::map< int, std::unique_ptr< Shader > > Shaderstore
 STL map to store sparse array of Shader pointers. More...
 
typedef std::map< std::string, float > Parameters
 STL map of parameter values for a shader constructor. More...
 

Public Member Functions

void addShader (std::unique_ptr< Shader > t, int id)
 Add a shader to those agregated by the tile shader. 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...
 

Detailed Description

Shader agregating surface data.

Some applications require the terrain surface data be stored in a single buffer so specific locations can be queried to determine the type. Typically this is used on a server, where lots of surface data optimised for rendering is not required, but fast cheap queries about the surface at a specific point are required.

Definition at line 21 of file TileShader.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.

◆ Shaderstore

typedef std::map<int, std::unique_ptr<Shader> > Mercator::TileShader::Shaderstore

STL map to store sparse array of Shader pointers.

Definition at line 24 of file TileShader.h.

Member Function Documentation

◆ addShader()

void Mercator::TileShader::addShader ( std::unique_ptr< Shader t,
int  id 
)
inline

Add a shader to those agregated by the tile shader.

Definition at line 34 of file TileShader.h.

References checkIntersect(), and shade().

◆ checkIntersect()

bool Mercator::TileShader::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 18 of file TileShader.cpp.

Referenced by addShader().

◆ 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()

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

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