QtCraft API C++ classes QML types Handbook

QcLightProbe Class

Sky and block light of the cells around one position, for the debug display (decision E-225): sky light shines with 15 into every cell above the highest cell of its column that stops light coming straight down (QcLightPassage) and spreads like block light, by the same rules as the mesher's light. More...

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

Public Types

struct Levels

Public Functions

QcLightProbe(const QcClientWorld &world, QcBlockPos centre, int radius = 0)
QcLightProbe::Levels at(QcBlockPos pos) const

Static Public Members

const int maxRadius

Detailed Description

Computed once in the constructor over a volume that reaches 15 blocks beyond the cells asked about, so their values are complete (about 30 000 cells for one cell, 43 000 for a radius of 2, half a millisecond and more). Cheap cases skip the volume: no light source within reach means block light 0, and a single cell under the open sky has sky light 15.

Member Function Documentation

QcLightProbe::QcLightProbe(const QcClientWorld &world, QcBlockPos centre, int radius = 0)

Probes the light in world of the cells within radius (Chebyshev, at most maxRadius) of centre.

QcLightProbe::Levels QcLightProbe::at(QcBlockPos pos) const

Returns the light of the cell pos; -1 for both outside the probed cells or below the world.

Member Variable Documentation

const int QcLightProbe::maxRadius

Largest radius of the probed cells.