mercator 0.4.0
A terrain generation library for the Worldforge system.
|
Region of terrain surface which is modified. More...
#include <Area.h>
Public Member Functions | |
Area (int layer, bool hole) | |
Constructor. More... | |
void | setShape (const WFMath::Polygon< 2 > &p) |
Set the geometric shape of this area. More... | |
bool | contains (WFMath::CoordType x, WFMath::CoordType z) const |
Determine if a point is contained by the shape of this area. More... | |
int | getLayer () const |
Accessor for the layer number. More... | |
bool | isHole () const |
Accessor for the flag indicating whether this is a hole. More... | |
const WFMath::Polygon< 2 > & | shape () const |
Accessor for the geometric shape. More... | |
bool | checkIntersects (const Segment &s) const override |
WFMath::Polygon< 2 > | clipToSegment (const Segment &s) const |
Clip the shape of this area to a given segment. More... | |
Context * | context () const |
void | setContext (std::unique_ptr< Context > context) |
const WFMath::AxisBox< 2 > & | bbox () const |
Accessor for the bounding box of the geometric shape. More... | |
Protected Attributes | |
WFMath::AxisBox< 2 > | m_box |
The bounding box of the geometric shape. More... | |
std::unique_ptr< Context > | m_context |
The application context of this effector. More... | |
Region of terrain surface which is modified.
Objects of this class describe regions of the surface which have been changed. Which layers of the shaded terrain is affected by their layer number. For example, if they are below the snow layer then the snow shader will cover them where the area affected by snow intersects with the area, but the lower grass area will be overriden. In order to get the best effect it is important to select the layer carefully.
Mercator::Area::Area | ( | int | layer, |
bool | hole | ||
) |
|
inlineinherited |
Accessor for the bounding box of the geometric shape.
Definition at line 37 of file Effector.h.
References Mercator::Effector::m_box.
Referenced by Mercator::Forest::populate().
|
overridevirtual |
Test if a segment intersects this area
Implements Mercator::Effector.
Definition at line 259 of file Area.cpp.
References Mercator::Segment::getRect().
Referenced by clipToSegment().
WFMath::Polygon< 2 > Mercator::Area::clipToSegment | ( | const Segment & | s | ) | const |
Clip the shape of this area to a given segment.
Determines the intersection of the geometric shape of this area with a square terrain segment, and returns the intersection as a geometric shape.
s | the segment that the shape should be clipped to. |
Definition at line 244 of file Area.cpp.
References checkIntersects(), and Mercator::Segment::getRect().
bool Mercator::Area::contains | ( | WFMath::CoordType | x, |
WFMath::CoordType | z | ||
) | const |
Determine if a point is contained by the shape of this area.
Definition at line 237 of file Area.cpp.
References Mercator::Effector::m_box.
Referenced by Mercator::Forest::populate().
|
inlineinherited |
Definition at line 32 of file Effector.h.
|
inline |
|
inline |
|
inherited |
Definition at line 12 of file Effector.cpp.
void Mercator::Area::setShape | ( | const WFMath::Polygon< 2 > & | p | ) |
Set the geometric shape of this area.
Definition at line 230 of file Area.cpp.
References Mercator::Effector::m_box.
|
inline |
|
protectedinherited |
The bounding box of the geometric shape.
Definition at line 57 of file Effector.h.
Referenced by Mercator::Effector::bbox(), contains(), Mercator::Effector::operator=(), setShape(), and Mercator::ShapeTerrainMod< Shape >::ShapeTerrainMod().
|
protectedinherited |
The application context of this effector.
Definition at line 60 of file Effector.h.
Referenced by Mercator::Effector::operator=().