QtCraft API C++ classes QML types Handbook

QcPrecipitationField Class

Rain and snow around the camera (decision E-395): up to a budget of particles in a box around the eye, falling, each only where the sky is open above it. More...

Header: #include <clientcore/weather/QcPrecipitationField.h>

Public Types

struct Particle

Public Functions

int budget() const
int columnTop(const QcClientWorld &world, int x, int z)
const QList<QcPrecipitationField::Particle> &particles() const
void update(const QcClientWorld &world, const QcClientWeather &weather, const QcVec3 &eye, double seconds)

Static Public Members

const double columnRefreshSeconds
const int defaultBudget
QcPrecipitationDrop dropOf(const QcPrecipitationField::Particle &particle, float strength, const QcVec3 &origin)
const double flakeSize
const int maxBudget
const int radius
const double rainDrift
const double rainSpeed
QcVec3 rainStreak()
const double rainStreakSeconds
const double reachDown
const double reachUp
int selectedBudget()
const double snowSpeed

Detailed Description

A particle starts above the top of its column (the highest cell that keeps rain out, QcPrecipitationTable, the same rule as the server's) and ends when it reaches that top; columns that are not loaded count as covered. Whether it is a raindrop or a snowflake follows from the climate the server sent and the height it starts at. GUI-free; drawn by the world renderer's QcPrecipitationRenderer, one instance (QcPrecipitationDrop) per particle: a raindrop as a thin streak, a snowflake as a small round dot facing the camera.

Member Function Documentation

int QcPrecipitationField::budget() const

Returns the particles at full strength.

int QcPrecipitationField::columnTop(const QcClientWorld &world, int x, int z)

Returns the highest cell of the column (x, z) of world that keeps rain out (QcPrecipitationTable) as last read; QcWorld::worldHeight for a column that is not loaded.

[static] QcPrecipitationDrop QcPrecipitationField::dropOf(const QcPrecipitationField::Particle &particle, float strength, const QcVec3 &origin)

Returns particle as an instance for the renderer (QcDropPool collects them), its position relative to origin (decision E-883); raindrops and flakes grow more opaque with the strength of the rain.

const QList<QcPrecipitationField::Particle> &QcPrecipitationField::particles() const

Returns the falling particles.

[static] QcVec3 QcPrecipitationField::rainStreak()

Returns the streak of a raindrop: from the drop up to where it was rainStreakSeconds ago.

[static] int QcPrecipitationField::selectedBudget()

Returns the budget of this run: defaultBudget or the test hook.

void QcPrecipitationField::update(const QcClientWorld &world, const QcClientWeather &weather, const QcVec3 &eye, double seconds)

Advances the field by seconds around eye: particles fall, those that landed or left the box start again above an open column; their number follows the rain's strength in weather; world tells open columns.

Member Variable Documentation

const double QcPrecipitationField::columnRefreshSeconds

Column tops are read again after this many seconds (blocks placed or broken under the rain).

const int QcPrecipitationField::defaultBudget

Particles at full strength; the shown number scales with the rain's strength. The test hook QTCRAFT_WEATHER_PARTICLES=<n> overrides it (measurements).

const int QcPrecipitationField::maxBudget

Largest budget the test hook takes.