5 #ifndef MERCATOR_TERRAIN_MOD_IMPL_H 6 #define MERCATOR_TERRAIN_MOD_IMPL_H 8 #include <Mercator/TerrainMod.h> 10 #include <Mercator/Segment.h> 14 template <
template <
int>
class Shape>
25 template <
template <
int>
class Shape>
26 bool ShapeTerrainMod<Shape>::checkIntersects(
const Segment& s)
const 28 return WFMath::Intersect(m_shape, s.getRect(),
false) ||
29 WFMath::Contains(s.getRect(), m_shape.getCorner(0),
false);
32 template <
template <
int>
class Shape>
33 void ShapeTerrainMod<Shape>::setShape(
const Shape<2> & s)
36 m_box = m_shape.boundingBox();
39 template <
template <
int>
class Shape> LevelTerrainMod<Shape>::~LevelTerrainMod()
43 template <
template <
int>
class Shape>
46 if (Contains(this->m_shape,WFMath::Point<2>(x,y),
true)) {
47 point = this->m_function(point, m_level);
51 template <
template <
int>
class Shape>
58 template <
template <
int>
class Shape> AdjustTerrainMod<Shape>::~AdjustTerrainMod()
62 template <
template <
int>
class Shape>
65 if (Contains(this->m_shape,WFMath::Point<2>(x,y),
true)) {
70 template <
template <
int>
class Shape>
77 template <
template <
int>
class Shape> SlopeTerrainMod<Shape>::~SlopeTerrainMod()
81 template <
template <
int>
class Shape>
84 if (Contains(this->m_shape,WFMath::Point<2>(x,y),
true)) {
85 float level = m_level + (this->m_shape.getCenter()[0] - x) * m_dx
86 + (this->m_shape.getCenter()[1] - y) * m_dy;
87 point = this->m_function(point, level);
91 template <
template <
int>
class Shape>
101 template <
template <
int>
class Shape> CraterTerrainMod<Shape>::~CraterTerrainMod()
105 template <
template <
int>
class Shape>
108 if (Contains(this->m_shape,WFMath::Point<2>(x,y),
true)) {
113 template <
template <
int>
class Shape>
123 #endif // MERCATOR_TERRAIN_MOD_IMPL_H Terrain modifier that defines an area of sloped height.
Definition: TerrainMod.h:137
virtual void apply(float &point, int x, int y) const
Apply this modifier on a terrain segment.
Definition: TerrainMod_impl.h:44
virtual void apply(float &point, int x, int y) const
Apply this modifier on a terrain segment.
Definition: TerrainMod_impl.h:106
virtual void apply(float &point, int x, int y) const
Apply this modifier on a terrain segment.
Definition: TerrainMod_impl.h:63
Shape< 2 > m_shape
Shape of the modifier.
Definition: TerrainMod.h:70
ShapeTerrainMod(const Shape< 2 > &s)
Constructor.
Definition: TerrainMod_impl.h:15
Terrain modifier that defines a crater.
Definition: TerrainMod.h:173
WFMath::AxisBox< 2 > m_box
The bounding box of the geometric shape.
Definition: Effector.h:70
Terrain modifier that defines an area of adjusted height.
Definition: TerrainMod.h:107
Terrain modifier that defines an area of fixed height.
Definition: TerrainMod.h:78
virtual void apply(float &point, int x, int y) const
Apply this modifier on a terrain segment.
Definition: TerrainMod_impl.h:82
Terrain modifier which is defined by a shape variable.
Definition: TerrainMod.h:56