QtCraft API C++ classes QML types Handbook

QcSurfaceBlend Class

The ground around a structure on the surface blended to its floor (decision E-889, the rule's blend): within blend blocks of the footprint the ground may move from the terrain towards the floor by slope blocks per block inward from the blend's outer end, like the wetland of a village (decision E-660), so the ground right beside the walls lies level with the floor wherever the terrain rises less than the freedom there, and returns to the terrain without a cliff. More...

Header: #include <worldgen/surface/QcSurfaceBlend.h>

Public Functions

QcSurfaceBlend(const QcTerrainGenerator &terrain)
void shape(QcChunk &chunk, const QcStructurePlacement &placement, int blend) const
std::optional<int> topAt(const QcStructurePlacement &placement, int blend, int x, int z, int ground) const

Static Public Members

double distanceTo(const QcStructurePlacement &placement, int x, int z)
int levelAt(int floor, int ground, double distance, int blend)
const double slope

Detailed Description

Lowered ground loses its plants, raised ground is filled with the ground below; the top block is the terrain's surface block. Columns under water keep their ground, and no ground is lowered below the sea. A pure function of the placement and the terrain noise per column, the same in any order of the chunks. Thread-safe.

Member Function Documentation

[explicit] QcSurfaceBlend::QcSurfaceBlend(const QcTerrainGenerator &terrain)

Blends with the columns and blocks of terrain.

[static] double QcSurfaceBlend::distanceTo(const QcStructurePlacement &placement, int x, int z)

Returns the horizontal distance in blocks from the column x, z to the nearest column of the footprint of placement (0 inside).

[static] int QcSurfaceBlend::levelAt(int floor, int ground, double distance, int blend)

Returns the top block a column at distance blocks from the footprint gets, whose terrain ground's top block is ground, around a floor whose top block is floor, for a blend of blend blocks: the ground moves towards the floor by at most slope times (blend + 1 − distance) blocks.

void QcSurfaceBlend::shape(QcChunk &chunk, const QcStructurePlacement &placement, int blend) const

Shapes the columns of chunk within blend of the footprint of placement (not the footprint).

std::optional<int> QcSurfaceBlend::topAt(const QcStructurePlacement &placement, int blend, int x, int z, int ground) const

Returns the new top block of the column x, z whose terrain ground's top block is ground, if the blend around placement moves it (within blend of the footprint, outside it, not under water; never below the sea level).

Member Variable Documentation

const double QcSurfaceBlend::slope

How far the ground may differ from the terrain per block of distance inward from the blend's outer end (the wetland's slope).