QtCraft API C++ classes QML types Handbook

QcRiverDelta Class

The deltas of the rivers (decision E-850): where a wide river runs through flat land into the sea, it spreads into a fan of arms between low islands of sand and mud, with ponds on them and shallow banks reaching out under the sea. More...

Header: #include <worldgen/terrain/QcRiverDelta.h>

Public Types

struct Fan
struct Ground
struct Shape
Land

Public Functions

QcRiverDelta(quint64 seed, const QcRiverField &rivers, int seaLevel, double share)
std::optional<QcRiverDelta::Fan> fanAt(int x, int z, double continent, double riverValue) const
bool hasSiteAt(int x, int z, const QcRiverDelta::Land &land) const
QcRiverDelta::Shape shape(const QcRiverDelta::Fan &fan, const QcRiverDelta::Land &land, QcRiverDelta::Ground own) const

Static Public Members

bool mayReach(double continent, double pad = 0.0)

Detailed Description

The fan opens from its apex on the river towards the mouth on the coast (QcDeltaSites); its arms are a network that branches two or three levels deep from the river (QcDeltaArms), and the fan lies in a low basin that rises gently into the land around it. Deterministic per seed and thread-safe.

Member Type Documentation

[alias] QcRiverDelta::Land

The terrain's maps a delta reads (QcTerrainGenerator).

Member Function Documentation

QcRiverDelta::QcRiverDelta(quint64 seed, const QcRiverField &rivers, int seaLevel, double share)

Builds the delta's noises from seed; seaLevel is the terrain's. rivers must outlive the delta (the terrain generator owns both); share: the share of the wide river mouths that get a delta (0..1).

std::optional<QcRiverDelta::Fan> QcRiverDelta::fanAt(int x, int z, double continent, double riverValue) const

Returns the fan at the column x, z with the continent value continent and the river noise riverValue (QcRiverField::Sample::value, far where the river field was not asked); std::nullopt where no delta can lie. Free: reads no noise.

bool QcRiverDelta::hasSiteAt(int x, int z, const QcRiverDelta::Land &land) const

Returns whether the cell of sites (QcDeltaSites::siteCell blocks) of the column x, z has a delta on land that allows any: a column of a cell without one never lies in a delta (its shape() has no weight). The site is remembered per thread, so reading it again for the columns costs nothing.

[static] bool QcRiverDelta::mayReach(double continent, double pad = 0.0)

Returns whether a column with the value continent (the terrain's, before the coast's smoothstep) can lie in a delta at all: a band along the coasts, widened by pad on both sides for a value read a few blocks away. Free; every other test costs noise.

QcRiverDelta::Shape QcRiverDelta::shape(const QcRiverDelta::Fan &fan, const QcRiverDelta::Land &land, QcRiverDelta::Ground own) const

Returns the delta at the column of fan over its own ground own, by the delta of the river near its cell on land; all zero outside a delta's fan.