mercator 0.4.0
A terrain generation library for the Worldforge system.
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
13namespace Mercator
14{
15
16class Segment;
17class Shader;
18
26{
27 public:
28 struct Context {
29 std::string m_id;
30 };
31
32 Context * context() const { return m_context.get(); }
33
34 void setContext(std::unique_ptr<Context> context);
35
37 const WFMath::AxisBox<2> & bbox() const
38 {
39 return m_box;
40 }
41
42 virtual ~Effector() = 0;
43
44 virtual bool checkIntersects(const Segment& s) const = 0;
45
46 protected:
49
51 Effector(const Effector &);
52
54 Effector & operator=(const Effector &);
55
57 WFMath::AxisBox<2> m_box;
58
60 std::unique_ptr<Context> m_context;
61};
62
64typedef float (*effector_func)(float height, float mod);
65
66float set(float, float);
67float max(float, float);
68float min(float, float);
69float sum(float, float);
70float dif(float, float);
71
72}
73
74#endif // of MERCATOR_EFFECTOR_H
Device which effects a change in the terrain.
Definition: Effector.h:26
WFMath::AxisBox< 2 > m_box
The bounding box of the geometric shape.
Definition: Effector.h:57
std::unique_ptr< Context > m_context
The application context of this effector.
Definition: Effector.h:60
Effector & operator=(const Effector &)
Assignment.
Definition: Effector.cpp:25
const WFMath::AxisBox< 2 > & bbox() const
Accessor for the bounding box of the geometric shape.
Definition: Effector.h:37
Effector()
Constructor.
Class storing heightfield and other data for a single fixed size square area of terrain defined by fo...
Definition: Segment.h:37