mercator 0.4.0
A terrain generation library for the Worldforge system.
ThresholdShader.h
1// This file may be redistributed and modified only under the terms of
2// the GNU General Public License (See COPYING for details).
3// Copyright (C) 2003 Alistair Riddoch
4
5#ifndef MERCATOR_FILL_THRESHOLD_SHADER_H
6#define MERCATOR_FILL_THRESHOLD_SHADER_H
7
8#include "Shader.h"
9
10namespace Mercator {
11
13class HighShader : public Shader {
14 private:
16 float m_threshold;
17 public:
19 static const std::string key_threshold;
20
22 static const float default_threshold;
23
27 explicit HighShader(float threshold = default_threshold);
31 explicit HighShader(const Parameters & params);
32
33 ~HighShader() override;
34
36 float threshold() const { return m_threshold; }
37
38 bool checkIntersect(const Segment &) const override;
39
40 void shade(Surface &) const override;
41};
42
44class LowShader : public Shader {
45 private:
47 float m_threshold;
48 public:
50 static const std::string key_threshold;
51
53 static const float default_threshold;
54
58 explicit LowShader(float threshold = default_threshold);
62 explicit LowShader(const Parameters & params);
63
64 ~LowShader() override;
65
67 float threshold() const { return m_threshold; }
68
69 bool checkIntersect(const Segment &) const override;
70
71 void shade(Surface &) const override;
72};
73
75class BandShader : public Shader {
76 private:
78 float m_lowThreshold;
80 float m_highThreshold;
81 public:
83 static const std::string key_lowThreshold;
85 static const std::string key_highThreshold;
86
88 static const float default_lowThreshold;
90 static const float default_highThreshold;
91
96 explicit BandShader(float low_threshold = default_lowThreshold,
97 float high_threshold = default_highThreshold);
101 explicit BandShader(const Parameters & params);
102
103 ~BandShader() override;
104
106 float lowThreshold() const { return m_lowThreshold; }
108 float highThreshold() const { return m_highThreshold; }
109
110 bool checkIntersect(const Segment &) const override;
111
112 void shade(Surface &) const override;
113};
114
115} // namespace Mercator
116
117#endif // MERCATOR_FILL_THRESHOLD_SHADER_H
Surface shader that defines the surface between two levels.
static const float default_highThreshold
Default level below which the shader renders.
float lowThreshold() const
Accessor for the level above which the shader renders.
BandShader(float low_threshold=default_lowThreshold, float high_threshold=default_highThreshold)
Constructor.
static const std::string key_highThreshold
Key string used when specifying the high threshold parameter.
float highThreshold() const
Accessor for the level below which the shader renders.
bool checkIntersect(const Segment &) const override
Check whether this Shader has any effect on the given Segment.
static const float default_lowThreshold
Default level above which the shader renders.
void shade(Surface &) const override
Populate a Surface with data.
static const std::string key_lowThreshold
Key string used when specifying the low threshold parameter.
Surface shader that defines the surface above a given level.
HighShader(float threshold=default_threshold)
Constructor.
void shade(Surface &) const override
Populate a Surface with data.
static const float default_threshold
Default level above which the shader renders.
float threshold() const
Accessor for level above which the shader renders.
static const std::string key_threshold
Key string used when specifying the threshold parameter.
bool checkIntersect(const Segment &) const override
Check whether this Shader has any effect on the given Segment.
Surface shader that defines the surface below a given level.
static const std::string key_threshold
Key string used when specifying the threshold parameter.
static const float default_threshold
Default level below which the shader renders.
bool checkIntersect(const Segment &) const override
Check whether this Shader has any effect on the given Segment.
LowShader(float threshold=default_threshold)
Constructor.
void shade(Surface &) const override
Populate a Surface with data.
float threshold() const
Accessor for level below which the shader renders.
Class storing heightfield and other data for a single fixed size square area of terrain defined by fo...
Definition: Segment.h:37
Base class for Shader objects which create surface data for use when rendering terrain.
Definition: Shader.h:25
std::map< std::string, float > Parameters
STL map of parameter values for a shader constructor.
Definition: Shader.h:59
Data store for terrain surface data.
Definition: Surface.h:23