Mercator
DepthShader.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_DEPTH_SHADER_H
6 #define MERCATOR_FILL_DEPTH_SHADER_H
7 
8 #include <Mercator/Shader.h>
9 
10 namespace Mercator {
11 
19 class DepthShader : public Shader {
20  private:
22  float m_waterLevel;
24  float m_murkyDepth;
25  public:
27  static const std::string key_waterLevel;
29  static const std::string key_murkyDepth;
30 
32  static const float default_waterLevel;
34  static const float default_murkyDepth;
35 
40  explicit DepthShader(float waterLevel = default_waterLevel,
45  explicit DepthShader(const Parameters & params);
46  virtual ~DepthShader();
47 
49  const float waterLevel() const { return m_waterLevel; }
51  const float murkyDepth() const { return m_murkyDepth; }
52 
53  virtual bool checkIntersect(const Segment &) const;
54  virtual void shade(Surface &) const;
55 };
56 
57 } // namespace Mercator
58 
59 #endif // MERCATOR_FILL_DEPTH_SHADER_H
Mercator::DepthShader::key_murkyDepth
static const std::string key_murkyDepth
Key string used when specifying the murky depth parameter.
Definition: DepthShader.h:29
Mercator::Buffer::getSegment
const Segment & getSegment() const
Accessor for the terrain height segment this buffer is associated with.
Definition: Buffer.h:55
Mercator::DepthShader::default_waterLevel
static const float default_waterLevel
Default level of the surface of the water.
Definition: DepthShader.h:32
Mercator::Segment::getMin
float getMin() const
Accessor for the minimum height value in this Segment.
Definition: Segment.h:181
Mercator::DepthShader
Shader to give the appearance of deep murky water.
Definition: DepthShader.h:19
Mercator::Segment::getSize
const int getSize() const
Accessor for array size of this segment.
Definition: Segment.h:81
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::Surface
Data store for terrain surface data.
Definition: Surface.h:22
Mercator::DepthShader::m_waterLevel
float m_waterLevel
The level of the surface of the water.
Definition: DepthShader.h:22
Mercator::DepthShader::waterLevel
const float waterLevel() const
Accessor for the level of the surface of the water.
Definition: DepthShader.h:49
Mercator::Buffer::getData
DataType * getData()
Accessor for a pointer to buffer containing data values.
Definition: Buffer.h:70
Mercator::DepthShader::shade
virtual void shade(Surface &) const
Populate a Surface with data.
Definition: DepthShader.cpp:61
Mercator::DepthShader::key_waterLevel
static const std::string key_waterLevel
Key string used when specifying the water level parameter.
Definition: DepthShader.h:27
Mercator::Shader
Base class for Shader objects which create surface data for use when rendering terrain.
Definition: Shader.h:29
Mercator::DepthShader::DepthShader
DepthShader(float waterLevel=default_waterLevel, float murkyDepth=default_murkyDepth)
Constructor.
Definition: DepthShader.cpp:29
Mercator::DepthShader::default_murkyDepth
static const float default_murkyDepth
Default depth at which the bottom becomes completely obscured.
Definition: DepthShader.h:34
Mercator::DepthShader::murkyDepth
const float murkyDepth() const
Accessor for the depth at which the bottom becomes completely obscured.
Definition: DepthShader.h:51
Mercator::DepthShader::m_murkyDepth
float m_murkyDepth
The depth at which the bottom becomes completely obscured.
Definition: DepthShader.h:24
Mercator::Shader::Parameters
std::map< std::string, float > Parameters
STL map of parameter values for a shader constructor.
Definition: Shader.h:63
Mercator::DepthShader::checkIntersect
virtual bool checkIntersect(const Segment &) const
Check whether this Shader has any effect on the given Segment.
Definition: DepthShader.cpp:52
Mercator::Segment::getPoints
const float * getPoints() const
Accessor for buffer containing height points.
Definition: Segment.h:145