5 #ifndef MERCATOR_TERRAIN_MOD_IMPL_H
6 #define MERCATOR_TERRAIN_MOD_IMPL_H
8 #include "TerrainMod.h"
14 template <
template <
int>
class Shape>
23 template <
template <
int>
class Shape>
26 return WFMath::Intersect(m_shape, s.
getRect(),
false) ||
27 WFMath::Contains(s.
getRect(), m_shape.getCorner(0),
false);
30 template <
template <
int>
class Shape>
31 void ShapeTerrainMod<Shape>::setShape(
const Shape<2> & s)
34 m_box = m_shape.boundingBox();
37 template <
template <
int>
class Shape> LevelTerrainMod<Shape>::~LevelTerrainMod() =
default;
39 template <
template <
int>
class Shape>
42 if (Contains(this->m_shape,WFMath::Point<2>(x,z),
true)) {
43 point = this->m_function(point, m_level);
47 template <
template <
int>
class Shape>
54 template <
template <
int>
class Shape> AdjustTerrainMod<Shape>::~AdjustTerrainMod() =
default;
56 template <
template <
int>
class Shape>
59 if (Contains(this->m_shape,WFMath::Point<2>(x,z),
true)) {
64 template <
template <
int>
class Shape>
71 template <
template <
int>
class Shape> SlopeTerrainMod<Shape>::~SlopeTerrainMod() =
default;
73 template <
template <
int>
class Shape>
76 if (Contains(this->m_shape,WFMath::Point<2>(x,z),
true)) {
77 float level = m_level + (this->m_shape.getCenter()[0] - x) * m_dx
78 + (this->m_shape.getCenter()[1] - z) * m_dz;
79 point = this->m_function(point, level);
83 template <
template <
int>
class Shape>
93 template <
template <
int>
class Shape> CraterTerrainMod<Shape>::~CraterTerrainMod() =
default;
95 template <
template <
int>
class Shape>
98 if (Contains(this->m_shape,WFMath::Point<2>(x,z),
true)) {
103 template <
template <
int>
class Shape>
Terrain modifier that defines an area of adjusted height.
virtual void apply(float &point, int x, int z) const
Apply this modifier on a terrain segment.
Terrain modifier that defines a crater.
virtual void apply(float &point, int x, int z) const
Apply this modifier on a terrain segment.
WFMath::AxisBox< 2 > m_box
The bounding box of the geometric shape.
Terrain modifier that defines an area of fixed height.
virtual void apply(float &point, int x, int z) const
Apply this modifier on a terrain segment.
Class storing heightfield and other data for a single fixed size square area of terrain defined by fo...
WFMath::AxisBox< 2 > getRect() const
The 2d area covered by this segment.
Terrain modifier which is defined by a shape variable.
ShapeTerrainMod(const Shape< 2 > &s)
Constructor.
Shape< 2 > m_shape
Shape of the modifier.
Terrain modifier that defines an area of sloped height.
virtual void apply(float &point, int x, int z) const
Apply this modifier on a terrain segment.