mercator  0.4.0
A terrain generation library for the Worldforge system.
Mercator::BasePoint Class Reference

Point on the fundamental grid that is used as the basis for terrain. More...

#include <BasePoint.h>

Public Member Functions

 BasePoint (float h=HEIGHT, float r=ROUGHNESS, float f=FALLOFF)
 Constructor. More...
 
bool operator== (const BasePoint &rhs) const
 
bool operator!= (const BasePoint &rhs) const
 
float height () const
 Accessor for the height at the base point. More...
 
float & height ()
 Accessor for the height at the base point. More...
 
float roughness () const
 Accessor for the roughness at the base point. More...
 
float & roughness ()
 Accessor for the roughness at the base point. More...
 
float falloff () const
 Accessor for the falloff at the base point. More...
 
float & falloff ()
 Accessor for the falloff at the base point. More...
 
unsigned int seed () const
 Calculate the random seed used at this base point. More...
 

Static Public Attributes

static constexpr float HEIGHT = 8.0
 Default height at the base point. More...
 
static constexpr float ROUGHNESS = 1.25
 Default roughness at the base point. More...
 
static constexpr float FALLOFF = 0.25
 Default falloff at the base point. More...
 

Detailed Description

Point on the fundamental grid that is used as the basis for terrain.

The terrain is defined by a sparse grid of evenly spaced points, each of which is defined by an instance of this class. The most fundamental property of each point is its elevation stored as height, as this is also used to seed the random number generators. Additional parameters for roughness and falloff are often specified.

Definition at line 19 of file BasePoint.h.

Constructor & Destructor Documentation

◆ BasePoint()

Mercator::BasePoint::BasePoint ( float  h = HEIGHT,
float  r = ROUGHNESS,
float  f = FALLOFF 
)
inlineexplicit

Constructor.

Parameters
hheight at the base point.
rroughness at the base point.
ffalloff at the base point.

Definition at line 41 of file BasePoint.h.

Member Function Documentation

◆ falloff() [1/2]

float Mercator::BasePoint::falloff ( ) const
inline

Accessor for the falloff at the base point.

Definition at line 61 of file BasePoint.h.

Referenced by Mercator::HeightMap::fill2d().

◆ falloff() [2/2]

float& Mercator::BasePoint::falloff ( )
inline

Accessor for the falloff at the base point.

Definition at line 63 of file BasePoint.h.

References seed().

◆ height() [1/2]

float Mercator::BasePoint::height ( ) const
inline

Accessor for the height at the base point.

Definition at line 51 of file BasePoint.h.

Referenced by Mercator::HeightMap::checkMaxMin().

◆ height() [2/2]

float& Mercator::BasePoint::height ( )
inline

Accessor for the height at the base point.

Definition at line 53 of file BasePoint.h.

◆ roughness() [1/2]

float Mercator::BasePoint::roughness ( ) const
inline

Accessor for the roughness at the base point.

Definition at line 56 of file BasePoint.h.

Referenced by Mercator::HeightMap::checkMaxMin(), and Mercator::HeightMap::fill2d().

◆ roughness() [2/2]

float& Mercator::BasePoint::roughness ( )
inline

Accessor for the roughness at the base point.

Definition at line 58 of file BasePoint.h.

◆ seed()

unsigned int Mercator::BasePoint::seed ( ) const

Calculate the random seed used at this base point.

Definition at line 14 of file BasePoint.cpp.

Referenced by Mercator::HeightMap::checkMaxMin(), falloff(), and Mercator::HeightMap::fill2d().

Member Data Documentation

◆ FALLOFF

constexpr float Mercator::BasePoint::FALLOFF = 0.25
static

Default falloff at the base point.

Definition at line 34 of file BasePoint.h.

Referenced by Mercator::HeightMap::checkMaxMin().

◆ HEIGHT

constexpr float Mercator::BasePoint::HEIGHT = 8.0
static

Default height at the base point.

Definition at line 30 of file BasePoint.h.

◆ ROUGHNESS

constexpr float Mercator::BasePoint::ROUGHNESS = 1.25
static

Default roughness at the base point.

Definition at line 32 of file BasePoint.h.


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