QtCraft API C++ classes QML types Handbook

QcSectionLight Struct

Block and sky light of the cells of one meshed section, as the mesher saw them, for shaders that read light per cell (decision E-390; today's shaders read the light baked into the vertices). More...

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

Public Functions

int blockLevel(int index) const
bool isUniform() const
int skyLevel(int index) const
QByteArray texels() const

Public Variables

std::shared_ptr<const QcLightNibbles> block
std::shared_ptr<const QcLightNibbles> sky
quint8 uniformBlock
quint8 uniformSky

Static Public Members

QcSectionLight fromChannels(std::shared_ptr<const QcLightNibbles> block, std::shared_ptr<const QcLightNibbles> sky)
const int texelBytes

Detailed Description

A channel whose cells all have the same level holds no cells, only that level (decision E-389): most sections are dark or fully lit by the sky. Levels are raw (0..15, no time of day).

Member Function Documentation

int QcSectionLight::blockLevel(int index) const

Returns the block light level of the cell index (QcChunkSection::index).

[static] QcSectionLight QcSectionLight::fromChannels(std::shared_ptr<const QcLightNibbles> block, std::shared_ptr<const QcLightNibbles> sky)

Returns the light of the channels block and sky; keeps the nibbles of a channel only when its cells differ.

bool QcSectionLight::isUniform() const

Returns whether both channels are uniform.

int QcSectionLight::skyLevel(int index) const

Returns the sky light level of the cell index (QcChunkSection::index).

QByteArray QcSectionLight::texels() const

Returns the cells as RG8 texels of a 16 x 16 x 16 volume (R block light, G sky light, level × 17 so 15 reads as 1.0), cells in the order of QcChunkSection::index: x fastest, then z, then y, which is a 3D texture of width x, height z and depth y.

Member Variable Documentation

const int QcSectionLight::texelBytes

Bytes per cell of texels(): block light, sky light.

quint8 QcSectionLight::uniformBlock

Block light level of every cell when block is null.

quint8 QcSectionLight::uniformSky

Sky light level of every cell when sky is null.