QcRiverField Class
The rivers of the terrain (decision E-840): winding channels along the zero line of their own noise field, bent a second time so they meander. More...
| Header: | #include <worldgen/terrain/QcRiverField.h> |
Public Types
Public Functions
| QcRiverField::Sample | at(int x, int z, const QcTerrainClimate::Point &climate) const |
| QcRiverField::Course | courseAt(int x, int z, double here) const |
| QcRiverField::Cut | cut(int x, int z, const QcTerrainClimate::Point &climate, double height, int seaLevel) const |
| double | patchAt(int x, int z) const |
| double | ringsLeaveOnLine(double bentX, double bentZ) const |
| void | setSmoothRings(bool smooth) |
| bool | smoothRings() const |
| QcRiverField::Point | unbent(double bentX, double bentZ) const |
| double | value(double bentX, double bentZ) const |
| double | valueAt(int x, int z) const |
Static Public Members
| double | carve(double height, const QcRiverField::Sample &sample, int seaLevel) |
| const double | deepestBed |
| const double | far |
| const double | narrowestHalfWidth |
| const double | reach |
| const double | reachDown |
| double | strengthAt(const QcTerrainClimate::Point &climate) |
Detailed Description
Their water stands at the sea level, so a river is one body of water with the sea and the lakes it reaches; the channel and the valley around it are carved into the land, never raised. Through rugged land (mountain ranges) a river runs in a narrow gorge; in dry land (deserts) and where the zero line curves tightly (rings round a hill of the noise) it narrows and ends. Deterministic per seed and thread-safe.
Member Function Documentation
QcRiverField::Sample QcRiverField::at(int x, int z, const QcTerrainClimate::Point &climate) const
Returns the river near the column x, z with the climate point climate.
[static] double QcRiverField::carve(double height, const QcRiverField::Sample &sample, int seaLevel)
Returns the surface height (first air above the ground, unrounded) of a column of height height after the river at sample carved it: the channel down to depth below seaLevel, the banks rising from the water's edge. Never higher than height.
QcRiverField::Course QcRiverField::courseAt(int x, int z, double here) const
Returns where the column x, z lies across the river near it, from the river noise here at the column (valueAt()); the defaults where the noise has no slope.
QcRiverField::Cut QcRiverField::cut(int x, int z, const QcTerrainClimate::Point &climate, double height, int seaLevel) const
Returns the column x, z with the climate point climate and the land height height carved by the river near it, water and bank judged against seaLevel.
double QcRiverField::patchAt(int x, int z) const
Returns a value in [0, 1) at the column x, z that is the same over patches of a few blocks: which block of a river bed or bank lies in a column.
double QcRiverField::ringsLeaveOnLine(double bentX, double bentZ) const
Returns how much of the river the fading of small rings leaves on its middle line at the bent point bentX, bentZ (0..1; times the climate's strengthAt() it is how strongly the river runs there, as at()).
void QcRiverField::setSmoothRings(bool smooth)
Sets whether the fading of small rings changes smoothly to smooth (smoothRings()); set before the field is read, by the generator's version.
See also smoothRings().
bool QcRiverField::smoothRings() const
Returns whether the fading of small rings changes smoothly from column to column (generator version 2 on, decision E-969): at() measures the rings on the middle line (as ringsLeaveOnLine()), not at the column, and blends the searches of the four cells round a point, so a river narrows to its end without a step. False for version 1, which measures at the column and takes each point's own cell.
See also setSmoothRings().
[static] double QcRiverField::strengthAt(const QcTerrainClimate::Point &climate)
Returns how strongly rivers run at the point climate (0..1, by its humidity): none in the driest deserts.
QcRiverField::Point QcRiverField::unbent(double bentX, double bentZ) const
Returns the column whose bent coordinates are bentX, bentZ (within about a quarter block).
double QcRiverField::value(double bentX, double bentZ) const
Returns the river noise at the point bentX, bentZ in coordinates bent by the meander (its zero line is the middle line). value(), unbent() and ringsLeaveOnLine() read the middle lines in bent coordinates, for following a river along them (QcRiverPieces).
double QcRiverField::valueAt(int x, int z) const
Returns the river noise at the column x, z (bent by the meander, as at() reads it).
Member Variable Documentation
const double QcRiverField::deepestBed
The deepest bed a river carves under the sea level.
const double QcRiverField::far
Distance of a column far from every river.
const double QcRiverField::narrowestHalfWidth
Half the width of the narrowest full river (before gorges, dry land and ends narrow it further).
const double QcRiverField::reach
Beyond this many blocks from its middle line a river changes nothing.
const double QcRiverField::reachDown
A river never changes ground deeper than this under the sea level (its deepest bed, 1.2 + 0.45 * 7.5 blocks, plus the smooth seam of the carving).