Mercator
Public Member Functions | Protected Attributes | List of all members
Mercator::TerrainMod Class Referenceabstract

Base class for modifiers to the procedurally generated terrain. More...

#include <TerrainMod.h>

Inheritance diagram for Mercator::TerrainMod:
Mercator::Effector Mercator::ShapeTerrainMod< Shape > Mercator::AdjustTerrainMod< Shape > Mercator::CraterTerrainMod< Shape > Mercator::LevelTerrainMod< Shape > Mercator::SlopeTerrainMod< Shape >

Public Member Functions

int addToSegment (Segment &) const
 
void updateToSegment (Segment &) const
 
void removeFromSegment (Segment &) const
 
void setFunction (effector_func f)
 Change the function used to apply this mod to existing points.
 
virtual void apply (float &point, int x, int y) const =0
 Apply this modifier on a terrain segment. More...
 
- Public Member Functions inherited from Mercator::Effector
Contextcontext () const
 
void setContext (Context *)
 
const WFMath::AxisBox< 2 > & bbox () const
 Accessor for the bounding box of the geometric shape.
 
virtual bool checkIntersects (const Segment &s) const =0
 

Protected Attributes

effector_func m_function
 Function used to apply this mod to existing points. More...
 
- Protected Attributes inherited from Mercator::Effector
WFMath::AxisBox< 2 > m_box
 The bounding box of the geometric shape.
 
Contextm_context
 The application context of this effector.
 

Additional Inherited Members

- Protected Member Functions inherited from Mercator::Effector
 Effector ()
 Constructor.
 
 Effector (const Effector &)
 Copy constructor.
 
Effectoroperator= (const Effector &)
 Assignment.
 

Detailed Description

Base class for modifiers to the procedurally generated terrain.

Anything that modifies the terrain implements this interface.

Member Function Documentation

◆ apply()

virtual void Mercator::TerrainMod::apply ( float &  point,
int  x,
int  y 
) const
pure virtual

Apply this modifier on a terrain segment.

The segment is at x,y in local coordinates. Output is placed into point.

Implemented in Mercator::CraterTerrainMod< Shape >, Mercator::SlopeTerrainMod< Shape >, Mercator::AdjustTerrainMod< Shape >, and Mercator::LevelTerrainMod< Shape >.

Referenced by Mercator::Segment::applyMod().

Member Data Documentation

◆ m_function

effector_func Mercator::TerrainMod::m_function
protected

Function used to apply this mod to existing points.

This makes the basic mods much more powerful without the need for extra classes. It completely obsoletes AdjustTerrainMod, which is now the same as LevelTerrainMod with this function changed from set() to sum()

Referenced by setFunction().


The documentation for this class was generated from the following files: