QtCraft API C++ classes QML types Handbook

QcWetlandShaper Class

The ground a village over water shapes around itself (decision E-407, E-660, QcVillagePlan::Wetland): within the wetland's margin of its pieces and boardwalks, frayed by noise, the ground lies at the water surface, deep water filled up to it, with pools, mud and grass on it (QcWetlandPattern, decision E-661). More...

Header: #include <worldgen/villages/QcWetlandShaper.h>

Public Types

struct Column

Public Functions

QcWetlandShaper(const QcTerrainGenerator &terrain, quint64 seed)
std::optional<QcWetlandShaper::Column> columnAt(const QcVillagePlan &plan, int x, int z) const
std::optional<int> groundAt(const QcVillagePlan &plan, int x, int z) const
void shape(QcChunk &chunk, const QcVillagePlan &plan) const

Detailed Description

Beyond, the ground returns to the terrain at most a block per block of distance (more than the terrain's own slope only where the edge's noise bends), so no cliff cuts the neighbouring land however high it lies: ground far above the water is only cut a few blocks near the village. The land access beside the stairs stays as it is. A pure function of the seed, the plan and the terrain noise per column, so every chunk shapes its own columns the same in any order. Thread-safe.

Member Function Documentation

QcWetlandShaper::QcWetlandShaper(const QcTerrainGenerator &terrain, quint64 seed)

Shapes the ground over terrain, its noise seeded from seed.

std::optional<QcWetlandShaper::Column> QcWetlandShaper::columnAt(const QcVillagePlan &plan, int x, int z) const

Returns the shaped column x, z of plan with its cover; std::nullopt as for groundAt().

std::optional<int> QcWetlandShaper::groundAt(const QcVillagePlan &plan, int x, int z) const

Returns the height of the ground's top block the column x, z gets from the wetland of plan (a pool's bottom under water); std::nullopt keeps the terrain (no wetland, outside it, in the land access, or dry ground the blend leaves as it is).

void QcWetlandShaper::shape(QcChunk &chunk, const QcVillagePlan &plan) const

Shapes the columns of chunk in the wetland of plan, before the village is built into it: lowered ground is removed (water up to the water surface, air above), raised ground filled with the bottom, the top block is the bottom under water and on mud, else the terrain's surface block; cave air from the water surface down to below the deepest pool is filled with the bottom; the style's plant grows on some columns beside the pools and its floating plant on some pool columns.