QtCraft API C++ classes QML types Handbook

QcWaterLook Namespace

The look of the water in the realistic mode (decision E-906): what does not need the GPU. More...

Header: #include <clientcore/light/QcWaterLook.h>

Variables

const std::array<float, 3> extinction
const double waveLoopSeconds
const double wavePeriod

Functions

bool eyeUnderWater(const QcBlockAccess &world, const QcVec3 &eye)
std::array<float, 3> periodicCamera(const QcVec3 &camera)
QVector3D underwaterColour(double daylight)
QcWaterUniforms uniforms(const QcWaterFrame &frame)
float waveSeconds(double ticks)

Detailed Description

Variable Documentation

const std::array<float, 3> QcWaterLook::extinction

How much of each colour of light the water takes per block (linear): red goes first, then green, so shallow water shows the ground in a light green-blue and deep water turns dark blue.

const double QcWaterLook::waveLoopSeconds

The waves repeat after this many seconds (their frequencies are whole multiples of it), so their time can wrap without a jump.

const double QcWaterLook::wavePeriod

The waves and the caustics repeat every this many blocks, so the shaders take the camera modulo it in floats however far out it is (decision E-883).

Function Documentation

bool QcWaterLook::eyeUnderWater(const QcBlockAccess &world, const QcVec3 &eye)

Returns whether the eye at eye is under water: its cell in world holds water and the eye is below its surface (or water lies on top of it).

std::array<float, 3> QcWaterLook::periodicCamera(const QcVec3 &camera)

Returns camera modulo wavePeriod in [0, wavePeriod) per axis, computed in double; 0 for an axis that is not finite.

QVector3D QcWaterLook::underwaterColour(double daylight)

Returns the colour of the water around a camera under water at daylight (QcSkyState::daylight, 0..1); a value that is not finite counts as night.

QcWaterUniforms QcWaterLook::uniforms(const QcWaterFrame &frame)

Returns the Water block of frame; values that are not finite are 0 (the light's strength too, so no highlight comes from a broken sky).

float QcWaterLook::waveSeconds(double ticks)

Returns the waves' time of the animation clock ticks (QcAnimationClock::ticks), wrapped every waveLoopSeconds; 0 for a value that is not finite.