QtCraft API C++ classes QML types Handbook

QcMeshLighting Class

Sky and block light of the 3 x 3 chunk neighbourhood around one section, as the chunk mesher reads it. More...

Header: #include <clientcore/meshing/QcMeshLighting.h>

Public Functions

QcMeshLighting(QcMeshNeighbourhood around, const QcMeshInput &input)
int block(int lx, int y, int lz) const
QcSectionLight sectionLight(int sectionIndex) const
int sky(int lx, int y, int lz) const

Static Public Members

const int extent
const int margin
const int maxLevel

Detailed Description

The volume reaches one chunk around the section horizontally and 16 blocks above and below it, which is as far as light travels (levels 15 to 0). Block light comes from the input's light snapshots or, without them, from every source in that volume, so it is complete for the section either way.

Member Function Documentation

QcMeshLighting::QcMeshLighting(QcMeshNeighbourhood around, const QcMeshInput &input)

Floods the light of the section input describes, reading its blocks through around.

int QcMeshLighting::block(int lx, int y, int lz) const

Returns the block light level of the block at chunk-local (lx, y, lz); a missing neighbour chunk counts as dark.

QcSectionLight QcMeshLighting::sectionLight(int sectionIndex) const

Returns both channels of the cells of the section sectionIndex for shaders that read light per cell (decision E-390): block light shares the snapshot of the input when there is one, sky light (and block light flooded here) is copied out of the volume.

int QcMeshLighting::sky(int lx, int y, int lz) const

Returns the sky light level of the block at chunk-local (lx, y, lz); outside the volume counts as dark, above the world as fully lit.

Member Variable Documentation

const int QcMeshLighting::extent

Width and depth of the volume in blocks (three chunks).

const int QcMeshLighting::margin

Blocks the volume reaches below and above the section.

const int QcMeshLighting::maxLevel

The brightest light level.