QtCraft API C++ classes QML types Handbook

QcSkyLight Namespace

The light of the open sky in a chunk (for QcLightEngine): the top of each cell column (the highest block that stops sky light), the cells above the tops that the open sky lights, and the cells beside a higher neighbouring column from which the light spreads sideways. More...

Header: #include <common/light/QcSkyLight.h>

Types

Tops

Functions

int columnTop(const QcChunk &blocks, const QcLightTable &table, int lx, int lz)
void forEachEdgeCell(const QcSkyLight::Tops &tops, TopAt topAt, Visit visit)
std::unique_ptr<QcLightNibbles> sectionCells(const QcSkyLight::Tops &tops, int low, int high)
QcSkyLight::Tops tops(const QcChunk &blocks, const QcLightTable &table)

Detailed Description

Type Documentation

[alias] QcSkyLight::Tops

The top of every cell column of a chunk, by QcLightCells::columnIndex; -1 for a column open down to the bottom of the world.

Function Documentation

int QcSkyLight::columnTop(const QcChunk &blocks, const QcLightTable &table, int lx, int lz)

Returns the top of the cell column (lx, lz) of blocks, with the light properties of table; -1 for a column open down to the bottom.

template <typename TopAt, typename Visit> void QcSkyLight::forEachEdgeCell(const QcSkyLight::Tops &tops, TopAt topAt, Visit visit)

Calls visit(lx, y, lz) (visit) for every cell of the chunk above the top of its column in tops and up to the highest top of its four neighbour columns: those cells border darker cells and spread the light. topAt(lx, lz) (topAt) is the top of a column of this chunk or, outside 0..chunkSize - 1, of a neighbour chunk (-1 when it is not loaded).

std::unique_ptr<QcLightNibbles> QcSkyLight::sectionCells(const QcSkyLight::Tops &tops, int low, int high)

Returns the sky light of the section from low to high that tops cut: full above them, dark below.

QcSkyLight::Tops QcSkyLight::tops(const QcChunk &blocks, const QcLightTable &table)

Returns the tops of all cell columns of blocks, with the light properties of table.