Mercator  0.4.0
Shader.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_SHADER_H
6 #define MERCATOR_SHADER_H
7 
8 #include <string>
9 #include <map>
10 
11 namespace Mercator {
12 
13 class Surface;
14 class Segment;
15 
24 class Shader {
25  private:
27  const bool m_color;
29  const bool m_alpha;
30  protected:
31  explicit Shader(bool color = false, bool alpha = true);
32  public:
33  virtual ~Shader();
34 
36  bool getColor() const {
37  return m_color;
38  }
39 
41  bool getAlpha() const {
42  return m_alpha;
43  }
44 
45  Surface * newSurface(const Segment &) const;
46 
52  virtual bool checkIntersect(const Segment &) const = 0;
53 
55  virtual void shade(Surface &) const = 0;
56 
58  typedef std::map<std::string, float> Parameters;
59 };
60 
61 } // namespace Mercator
62 
63 #endif // MERCATOR_SHADER_H
virtual bool checkIntersect(const Segment &) const =0
Check whether this Shader has any effect on the given Segment.
Surface * newSurface(const Segment &) const
Create a new Surface which matches the requirements of this shader.
Definition: Shader.cpp:29
Definition: Area.cpp:20
Shader(bool color=false, bool alpha=true)
Protected constructor for classes which inherit from this one.
Definition: Shader.cpp:16
Data store for terrain surface data.
Definition: Surface.h:23
bool getAlpha() const
Accessor for alpha flag.
Definition: Shader.h:41
std::map< std::string, float > Parameters
STL map of parameter values for a shader constructor.
Definition: Shader.h:58
Class storing heightfield and other data for a single fixed size square area of terrain defined by fo...
Definition: Segment.h:36
virtual void shade(Surface &) const =0
Populate a Surface with data.
Base class for Shader objects which create surface data for use when rendering terrain.
Definition: Shader.h:24
bool getColor() const
Accessor for color flag.
Definition: Shader.h:36
virtual ~Shader()
Destructor does nothing interesting.
Definition: Shader.cpp:21