mercator  0.4.0
A terrain generation library for the Worldforge system.
Mercator::TerrainMod Class Referenceabstract

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

#include <TerrainMod.h>

Inheritance diagram for Mercator::TerrainMod:
Collaboration diagram for Mercator::TerrainMod:

Public Member Functions

void setFunction (effector_func f)
 Change the function used to apply this mod to existing points. More...
 
virtual void apply (float &point, int x, int z) const =0
 Apply this modifier on a terrain segment. More...
 
Contextcontext () const
 
void setContext (std::unique_ptr< Context > context)
 
const WFMath::AxisBox< 2 > & bbox () const
 Accessor for the bounding box of the geometric shape. More...
 
virtual bool checkIntersects (const Segment &s) const =0
 

Protected Attributes

effector_func m_function
 Function used to apply this mod to existing points. More...
 
WFMath::AxisBox< 2 > m_box
 The bounding box of the geometric shape. More...
 
std::unique_ptr< Contextm_context
 The application context of this effector. More...
 

Detailed Description

Base class for modifiers to the procedurally generated terrain.

Anything that modifies the terrain implements this interface.

Definition at line 20 of file TerrainMod.h.

Member Function Documentation

◆ apply()

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

◆ bbox()

const WFMath::AxisBox<2>& Mercator::Effector::bbox ( ) const
inlineinherited

Accessor for the bounding box of the geometric shape.

Definition at line 37 of file Effector.h.

References Mercator::Effector::Effector(), Mercator::Effector::m_box, and Mercator::Effector::operator=().

Referenced by Mercator::Segment::clearMods(), and Mercator::Forest::populate().

◆ setFunction()

void Mercator::TerrainMod::setFunction ( effector_func  f)
inline

Change the function used to apply this mod to existing points.

Definition at line 36 of file TerrainMod.h.

References apply().

Member Data Documentation

◆ m_box

WFMath::AxisBox<2> Mercator::Effector::m_box
protectedinherited

◆ m_context

std::unique_ptr<Context> Mercator::Effector::m_context
protectedinherited

The application context of this effector.

Definition at line 60 of file Effector.h.

Referenced by Mercator::Effector::operator=().

◆ 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()

Definition at line 29 of file TerrainMod.h.

Referenced by Mercator::LevelTerrainMod< Shape >::apply(), and Mercator::SlopeTerrainMod< Shape >::apply().


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