QtCraft API C++ classes QML types Handbook

QcBlockState Struct

Everything that depends on one concrete block state, derived from the block definition and its shape. More...

Header: #include <common/content/blocks/QcBlockState.h>

Public Functions

QList<QcAabb> targetBoxes() const

Public Variables

QList<bool> boxStretch
QList<QString> boxTextures
QList<QcAabb> boxes
QList<QcAabb> collision
QList<QString> crossTextures
QList<QcAabb> crosses
std::array<QcBlockFace, qcBlockFaceCount> faceSource
std::array<quint8, qcBlockFaceCount> faceUvTurns
quint8 fineTurns
bool fullCube
std::array<bool, qcBlockFaceCount> fullFace
quint32 index
quint8 lightBlockedFaces
int lightOpacity
bool opaque
QList<QcAabb> targets
quint32 type

Detailed Description

Boxes are block-local (0..1, collision up to 1.5 m high).

Member Function Documentation

QList<QcAabb> QcBlockState::targetBoxes() const

Returns the boxes that can be pointed at: the drawn boxes and the regions of crossed planes, or the shape's own target boxes.

Member Variable Documentation

QList<bool> QcBlockState::boxStretch

Whether a box's faces stretch the whole texture over themselves (parallel to boxes).

QList<QString> QcBlockState::boxTextures

Texture slot per box (parallel to boxes); empty means the face textures.

QList<QcAabb> QcBlockState::boxes

Drawn boxes of the state's shape parts, turned into place; the unit cube without a shape.

QList<QcAabb> QcBlockState::collision

Collision boxes: the parts' own collision boxes where they have them, else their drawn boxes; the unit cube without a shape; empty for blocks that are not solid.

QList<QString> QcBlockState::crossTextures

Texture slot per cross (parallel to crosses); empty means the north face texture.

QList<QcAabb> QcBlockState::crosses

Regions of crossed planes (plants), turned into place like boxes.

std::array<QcBlockFace, qcBlockFaceCount> QcBlockState::faceSource

Face of the definition whose texture shows on each world face (turned blocks such as furnaces).

std::array<quint8, qcBlockFaceCount> QcBlockState::faceUvTurns

Quarter turns (0..3, clockwise as the face is seen) of the texture on each world face, for full cubes and the boxes of shapes alike: the top of a turned block (glazed terracotta, the arrow of a repeater) and the bark of a lying log run with the block (decisions E-751, E-874).

quint8 QcBlockState::fineTurns

Sixteenths of a turn (0..3, clockwise seen from above) the drawn faces turn beyond the quarter turns of the boxes: the 16 directions of a standing sign (QcShapeDefinition::spin).

bool QcBlockState::fullCube

The shape is exactly the unit cube.

std::array<bool, qcBlockFaceCount> QcBlockState::fullFace

Whether the boxes cover the whole side of the cell, per QcBlockFace (supports torches).

quint8 QcBlockState::lightBlockedFaces

Faces light cannot cross (bits per QcBlockFace, see QcLightPassage).

int QcBlockState::lightOpacity

Light lost entering the cell; 0 for partial shapes, which block light at covered faces.

bool QcBlockState::opaque

Full cube of an opaque block: hides neighbour faces completely.

QList<QcAabb> QcBlockState::targets

Boxes pointed at instead of the drawn ones (QcShapePart::target); empty when no part has any.