Mercator
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 <Mercator/Shader.h>
9 
10 namespace Mercator {
11 
13 class 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  virtual ~HighShader();
33 
35  const float threshold() const { return m_threshold; }
36 
37  virtual bool checkIntersect(const Segment &) const;
38  virtual void shade(Surface &) const;
39 };
40 
42 class LowShader : public Shader {
43  private:
45  float m_threshold;
46  public:
48  static const std::string key_threshold;
49 
51  static const float default_threshold;
52 
56  explicit LowShader(float threshold = default_threshold);
60  explicit LowShader(const Parameters & params);
61  virtual ~LowShader();
62 
64  const float threshold() const { return m_threshold; }
65 
66  virtual bool checkIntersect(const Segment &) const;
67  virtual void shade(Surface &) const;
68 };
69 
71 class BandShader : public Shader {
72  private:
77  public:
79  static const std::string key_lowThreshold;
81  static const std::string key_highThreshold;
82 
84  static const float default_lowThreshold;
86  static const float default_highThreshold;
87 
92  explicit BandShader(float low_threshold = default_lowThreshold,
93  float high_threshold = default_highThreshold);
97  explicit BandShader(const Parameters & params);
98  virtual ~BandShader();
99 
101  const float lowThreshold() const { return m_lowThreshold; }
103  const float highThreshold() const { return m_highThreshold; }
104 
105  virtual bool checkIntersect(const Segment &) const;
106  virtual void shade(Surface &) const;
107 };
108 
109 } // namespace Mercator
110 
111 #endif // MERCATOR_FILL_THRESHOLD_SHADER_H
Mercator::BandShader::default_lowThreshold
static const float default_lowThreshold
Default level above which the shader renders.
Definition: ThresholdShader.h:84
Mercator::Buffer::getSegment
const Segment & getSegment() const
Accessor for the terrain height segment this buffer is associated with.
Definition: Buffer.h:55
Mercator::Segment::getMin
float getMin() const
Accessor for the minimum height value in this Segment.
Definition: Segment.h:181
Mercator::LowShader::checkIntersect
virtual bool checkIntersect(const Segment &) const
Check whether this Shader has any effect on the given Segment.
Definition: ThresholdShader.cpp:89
Mercator::Segment::getSize
const int getSize() const
Accessor for array size of this segment.
Definition: Segment.h:81
Mercator::HighShader::checkIntersect
virtual bool checkIntersect(const Segment &) const
Check whether this Shader has any effect on the given Segment.
Definition: ThresholdShader.cpp:35
Mercator::LowShader
Surface shader that defines the surface below a given level.
Definition: ThresholdShader.h:42
Mercator::Buffer::getChannels
unsigned int getChannels() const
Accessor for the number of data values per height point.
Definition: Buffer.h:65
Mercator::Segment
Class storing heightfield and other data for a single fixed size square area of terrain defined by fo...
Definition: Segment.h:36
Mercator::BandShader::lowThreshold
const float lowThreshold() const
Accessor for the level above which the shader renders.
Definition: ThresholdShader.h:101
Mercator::Surface
Data store for terrain surface data.
Definition: Surface.h:22
Mercator::BandShader::key_highThreshold
static const std::string key_highThreshold
Key string used when specifying the high threshold parameter.
Definition: ThresholdShader.h:81
Mercator::HighShader::default_threshold
static const float default_threshold
Default level above which the shader renders.
Definition: ThresholdShader.h:22
Mercator::HighShader
Surface shader that defines the surface above a given level.
Definition: ThresholdShader.h:13
Mercator::HighShader::m_threshold
float m_threshold
The level above which the shader renders.
Definition: ThresholdShader.h:16
Mercator::HighShader::threshold
const float threshold() const
Accessor for level above which the shader renders.
Definition: ThresholdShader.h:35
Mercator::LowShader::m_threshold
float m_threshold
The level below which the shader renders.
Definition: ThresholdShader.h:45
Mercator::LowShader::shade
virtual void shade(Surface &) const
Populate a Surface with data.
Definition: ThresholdShader.cpp:98
Mercator::LowShader::default_threshold
static const float default_threshold
Default level below which the shader renders.
Definition: ThresholdShader.h:51
Mercator::BandShader::default_highThreshold
static const float default_highThreshold
Default level below which the shader renders.
Definition: ThresholdShader.h:86
Mercator::LowShader::threshold
const float threshold() const
Accessor for level below which the shader renders.
Definition: ThresholdShader.h:64
Mercator::HighShader::key_threshold
static const std::string key_threshold
Key string used when specifying the threshold parameter.
Definition: ThresholdShader.h:19
Mercator::LowShader::LowShader
LowShader(float threshold=default_threshold)
Constructor.
Definition: ThresholdShader.cpp:72
Mercator::Buffer::getData
DataType * getData()
Accessor for a pointer to buffer containing data values.
Definition: Buffer.h:70
Mercator::BandShader::key_lowThreshold
static const std::string key_lowThreshold
Key string used when specifying the low threshold parameter.
Definition: ThresholdShader.h:79
Mercator::BandShader
Surface shader that defines the surface between two levels.
Definition: ThresholdShader.h:71
Mercator::BandShader::m_highThreshold
float m_highThreshold
The level below which the shader renders.
Definition: ThresholdShader.h:76
Mercator::HighShader::HighShader
HighShader(float threshold=default_threshold)
Constructor.
Definition: ThresholdShader.cpp:18
Mercator::Shader
Base class for Shader objects which create surface data for use when rendering terrain.
Definition: Shader.h:29
Mercator::BandShader::m_lowThreshold
float m_lowThreshold
The level above which the shader renders.
Definition: ThresholdShader.h:74
Mercator::BandShader::shade
virtual void shade(Surface &) const
Populate a Surface with data.
Definition: ThresholdShader.cpp:161
Mercator::HighShader::shade
virtual void shade(Surface &) const
Populate a Surface with data.
Definition: ThresholdShader.cpp:44
Mercator::BandShader::checkIntersect
virtual bool checkIntersect(const Segment &) const
Check whether this Shader has any effect on the given Segment.
Definition: ThresholdShader.cpp:151
Mercator::BandShader::highThreshold
const float highThreshold() const
Accessor for the level below which the shader renders.
Definition: ThresholdShader.h:103
Mercator::BandShader::BandShader
BandShader(float low_threshold=default_lowThreshold, float high_threshold=default_highThreshold)
Constructor.
Definition: ThresholdShader.cpp:128
Mercator::Shader::Parameters
std::map< std::string, float > Parameters
STL map of parameter values for a shader constructor.
Definition: Shader.h:63
Mercator::LowShader::key_threshold
static const std::string key_threshold
Key string used when specifying the threshold parameter.
Definition: ThresholdShader.h:48
Mercator::Segment::getPoints
const float * getPoints() const
Accessor for buffer containing height points.
Definition: Segment.h:145
Mercator::Segment::getMax
float getMax() const
Accessor for the maximum height value in this Segment.
Definition: Segment.h:179