QtCraft API C++ classes QML types Handbook

QcLightPassage Namespace

How light passes block states whose shape is not a full cube (decision E-104): such a state of a light-dimming block lets light into its cell (opacity 0) but not across the faces its shape covers completely. More...

Header: #include <common/world/QcLightPassage.h>

Types

enum class SkyStop { None, Cell, Below }

Functions

quint8 bit(QcBlockFace face)
bool crosses(quint8 fromBlocked, quint8 toBlocked, QcBlockFace face)
QcBlockFace opposite(QcBlockFace face)
QcLightPassage::SkyStop skyStop(int opacity, quint8 blockedFaces)
int skyTop(QcLightPassage::SkyStop stop, int y)

Detailed Description

A bottom slab is lit from above and the sides but keeps the sky from the cell below; a stair passes light through its open quarter. Faces are bits per QcBlockFace.

Type Documentation

enum class QcLightPassage::SkyStop

What a cell does to sky light coming straight down: nothing, keeps it out of the cell itself (dimming full cubes, covered top face), or lets it in but not further down (covered bottom face).

ConstantValueDescription
QcLightPassage::SkyStop::None0Lets it pass.
QcLightPassage::SkyStop::Cell1Keeps it out of the cell.
QcLightPassage::SkyStop::Below2Lets it into the cell, not further down.

Function Documentation

[constexpr] quint8 QcLightPassage::bit(QcBlockFace face)

Returns the bit of face.

[constexpr] bool QcLightPassage::crosses(quint8 fromBlocked, quint8 toBlocked, QcBlockFace face)

Returns whether light leaves a cell whose state blocks the faces fromBlocked across face into the neighbour whose state blocks toBlocked.

[constexpr] QcBlockFace QcLightPassage::opposite(QcBlockFace face)

Returns the face opposite face.

[constexpr] QcLightPassage::SkyStop QcLightPassage::skyStop(int opacity, quint8 blockedFaces)

Returns what a cell of opacity whose state blocks the faces blockedFaces does to sky light coming straight down.

[constexpr] int QcLightPassage::skyTop(QcLightPassage::SkyStop stop, int y)

Returns the highest cell of a column that sky light coming straight down does not reach (cells above it are fully lit) when the cell y stops it as stop; -1 (keep looking further down) for SkyStop::None.