Mercator  0.4.0
Effector.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) 2010 Alistair Riddoch
4 
5 #ifndef MERCATOR_EFFECTOR_H
6 #define MERCATOR_EFFECTOR_H
7 
8 #include <wfmath/axisbox.h>
9 #include <wfmath/polygon.h>
10 
11 #include <string>
12 
13 namespace Mercator
14 {
15 
16 class Segment;
17 class Shader;
18 
25 class Effector
26 {
27  public:
28  class Context {
29  public:
30  Context();
31 
32  virtual ~Context();
33 
34  const std::string & id() { return m_id; }
35 
36  void setId(const std::string &);
37  protected:
38  std::string m_id;
39  };
40 
41  Context * context() const { return m_context; }
42 
43  void setContext(Context *);
44 
46  const WFMath::AxisBox<2> & bbox() const
47  {
48  return m_box;
49  }
50 
51  virtual ~Effector() = 0;
52 
53  virtual bool checkIntersects(const Segment& s) const = 0;
54 
55  protected:
57  Effector();
58 
60  Effector(const Effector &);
61 
63  Effector & operator=(const Effector &);
64 
66  WFMath::AxisBox<2> m_box;
67 
70 };
71 
73 typedef float (*effector_func)(float height, float mod);
74 
75 float set(float, float);
76 float max(float, float);
77 float min(float, float);
78 float sum(float, float);
79 float dif(float, float);
80 
81 }
82 
83 #endif // of MERCATOR_EFFECTOR_H
Device which effects a change in the terrain.
Definition: Effector.h:25
Definition: Area.cpp:20
Definition: Effector.h:28
Class storing heightfield and other data for a single fixed size square area of terrain defined by fo...
Definition: Segment.h:36
const WFMath::AxisBox< 2 > & bbox() const
Accessor for the bounding box of the geometric shape.
Definition: Effector.h:46
WFMath::AxisBox< 2 > m_box
The bounding box of the geometric shape.
Definition: Effector.h:66
Context * m_context
The application context of this effector.
Definition: Effector.h:69
Effector()
Constructor.
Definition: Effector.cpp:30
Effector & operator=(const Effector &)
Assignment.
Definition: Effector.cpp:40