mercator 0.4.0
A terrain generation library for the Worldforge system.
Area.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) 2005 Alistair Riddoch
4
5#ifndef MERCATOR_AREA_H
6#define MERCATOR_AREA_H
7
8#include "Effector.h"
9
10#include <wfmath/axisbox.h>
11#include <wfmath/polygon.h>
12
13namespace Mercator
14{
15
16class Segment;
17class Shader;
18
28class Area : public Effector
29{
30public:
35 Area(int layer, bool hole);
36
38 void setShape(const WFMath::Polygon<2>& p);
39
41 bool contains(WFMath::CoordType x, WFMath::CoordType z) const;
42
44 int getLayer() const
45 {
46 return m_layer;
47 }
48
50 bool isHole() const
51 {
52 return m_hole;
53 }
54
56 const WFMath::Polygon<2> & shape() const
57 {
58 return m_shape;
59 }
60
64 bool checkIntersects(const Segment& s) const override;
65
73 WFMath::Polygon<2> clipToSegment(const Segment& s) const;
74private:
75
77 int m_layer;
79 bool m_hole;
81 WFMath::Polygon<2> m_shape;
82};
83
84}
85
86#endif // of MERCATOR_AREA_H
Region of terrain surface which is modified.
Definition: Area.h:29
int getLayer() const
Accessor for the layer number.
Definition: Area.h:44
const WFMath::Polygon< 2 > & shape() const
Accessor for the geometric shape.
Definition: Area.h:56
bool contains(WFMath::CoordType x, WFMath::CoordType z) const
Determine if a point is contained by the shape of this area.
Definition: Area.cpp:237
Area(int layer, bool hole)
Constructor.
Definition: Area.cpp:224
bool isHole() const
Accessor for the flag indicating whether this is a hole.
Definition: Area.h:50
WFMath::Polygon< 2 > clipToSegment(const Segment &s) const
Clip the shape of this area to a given segment.
Definition: Area.cpp:244
bool checkIntersects(const Segment &s) const override
Definition: Area.cpp:259
void setShape(const WFMath::Polygon< 2 > &p)
Set the geometric shape of this area.
Definition: Area.cpp:230
Device which effects a change in the terrain.
Definition: Effector.h:26
Class storing heightfield and other data for a single fixed size square area of terrain defined by fo...
Definition: Segment.h:37