5#ifndef MERCATOR_TERRAIN_MOD_IMPL_H
6#define MERCATOR_TERRAIN_MOD_IMPL_H
14template <
template <
int>
class Shape>
23template <
template <
int>
class Shape>
26 return WFMath::Intersect(m_shape, s.
getRect(),
false) ||
27 WFMath::Contains(s.
getRect(), m_shape.getCorner(0),
false);
30template <
template <
int>
class Shape>
31void ShapeTerrainMod<Shape>::setShape(
const Shape<2> & s)
34 m_box = m_shape.boundingBox();
37template <
template <
int>
class Shape> LevelTerrainMod<Shape>::~LevelTerrainMod() =
default;
39template <
template <
int>
class Shape>
42 if (Contains(this->m_shape,WFMath::Point<2>(x,z),
true)) {
43 point = this->m_function(point, m_level);
47template <
template <
int>
class Shape>
54template <
template <
int>
class Shape> AdjustTerrainMod<Shape>::~AdjustTerrainMod() =
default;
56template <
template <
int>
class Shape>
59 if (Contains(this->m_shape,WFMath::Point<2>(x,z),
true)) {
64template <
template <
int>
class Shape>
71template <
template <
int>
class Shape> SlopeTerrainMod<Shape>::~SlopeTerrainMod() =
default;
73template <
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);
83template <
template <
int>
class Shape>
93template <
template <
int>
class Shape> CraterTerrainMod<Shape>::~CraterTerrainMod() =
default;
95template <
template <
int>
class Shape>
98 if (Contains(this->m_shape,WFMath::Point<2>(x,z),
true)) {
103template <
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.