mercator 0.4.0
A terrain generation library for the Worldforge system.
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#include <memory>
11
12namespace Mercator {
13
14class Surface;
15class Segment;
16
25class Shader {
26 private:
28 const bool m_color;
30 const bool m_alpha;
31 protected:
32 explicit Shader(bool color = false, bool alpha = true);
33 public:
34 virtual ~Shader();
35
37 bool getColor() const {
38 return m_color;
39 }
40
42 bool getAlpha() const {
43 return m_alpha;
44 }
45
46 std::unique_ptr<Surface> newSurface(const Segment &) const;
47
53 virtual bool checkIntersect(const Segment &) const = 0;
54
56 virtual void shade(Surface &) const = 0;
57
59 typedef std::map<std::string, float> Parameters;
60};
61
62} // namespace Mercator
63
64#endif // MERCATOR_SHADER_H
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
bool getColor() const
Accessor for color flag.
Definition: Shader.h:37
std::map< std::string, float > Parameters
STL map of parameter values for a shader constructor.
Definition: Shader.h:59
virtual void shade(Surface &) const =0
Populate a Surface with data.
Shader(bool color=false, bool alpha=true)
Protected constructor for classes which inherit from this one.
Definition: Shader.cpp:16
virtual ~Shader()
Destructor does nothing interesting.
virtual bool checkIntersect(const Segment &) const =0
Check whether this Shader has any effect on the given Segment.
bool getAlpha() const
Accessor for alpha flag.
Definition: Shader.h:42
std::unique_ptr< Surface > newSurface(const Segment &) const
Create a new Surface which matches the requirements of this shader.
Definition: Shader.cpp:27
Data store for terrain surface data.
Definition: Surface.h:23