mercator 0.4.0
A terrain generation library for the Worldforge system.
Mercator::ShapeTerrainMod< Shape > Class Template Referenceabstract

Terrain modifier which is defined by a shape variable. More...

#include <TerrainMod.h>

Inheritance diagram for Mercator::ShapeTerrainMod< Shape >:
Collaboration diagram for Mercator::ShapeTerrainMod< Shape >:

Public Member Functions

 ShapeTerrainMod (const Shape< 2 > &s)
 Constructor. More...
 
bool checkIntersects (const Segment &s) const override
 
void setShape (const Shape< 2 > &s)
 
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...
 

Protected Attributes

Shape< 2 > m_shape
 Shape of the modifier. More...
 
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

template<template< int > class Shape>
class Mercator::ShapeTerrainMod< Shape >

Terrain modifier which is defined by a shape variable.

This template extends TerrainMod by adding the ability to query the bounding box of the shape that defines this modification to the terrain.

Definition at line 52 of file TerrainMod.h.

Constructor & Destructor Documentation

◆ ShapeTerrainMod()

template<template< int > class Shape>
Mercator::ShapeTerrainMod< Shape >::ShapeTerrainMod ( const Shape< 2 > &  s)
explicit

Constructor.

Parameters
sshape of the modifier.

Definition at line 15 of file TerrainMod_impl.h.

References Mercator::Effector::m_box, and Mercator::ShapeTerrainMod< Shape >::m_shape.

Member Function Documentation

◆ apply()

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

Apply this modifier on a terrain segment.

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

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

◆ 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::m_box.

Referenced by Mercator::Forest::populate().

◆ checkIntersects()

template<template< int > class Shape>
bool Mercator::ShapeTerrainMod< Shape >::checkIntersects ( const Segment s) const
overridevirtual

Implements Mercator::Effector.

Definition at line 24 of file TerrainMod_impl.h.

◆ context()

Context * Mercator::Effector::context ( ) const
inlineinherited

Definition at line 32 of file Effector.h.

◆ setContext()

void Mercator::Effector::setContext ( std::unique_ptr< Context context)
inherited

Definition at line 12 of file Effector.cpp.

◆ setFunction()

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

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

Definition at line 36 of file TerrainMod.h.

References Mercator::TerrainMod::m_function.

◆ setShape()

template<template< int > class Shape>
void Mercator::ShapeTerrainMod< Shape >::setShape ( const Shape< 2 > &  s)

Definition at line 31 of file TerrainMod_impl.h.

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
protectedinherited

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::TerrainMod::setFunction().

◆ m_shape

template<template< int > class Shape>
Shape<2> Mercator::ShapeTerrainMod< Shape >::m_shape
protected

Shape of the modifier.

Definition at line 67 of file TerrainMod.h.

Referenced by Mercator::ShapeTerrainMod< Shape >::ShapeTerrainMod().


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