QtCraft API C++ classes QML types Handbook

QcBlockRenderTable Class

Per-state data the mesher needs, indexed by runtime block id (block state). More...

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

Public Types

struct Cross
struct Entry
struct Quad
struct SideRect

Public Functions

QcBlockRenderTable()
const QcBlockRenderTable::Entry &entry(QcBlockId id) const
bool hasLightSources() const
const std::shared_ptr<const QcLightTable> &lightTable() const
qsizetype size() const

Static Public Members

std::pair<int, int> axes(QcBlockFace face)
QList<QcBlockRenderTable::Quad> drawnQuads(const QcBlockRenderTable::Entry &entry)
bool hides(const QcBlockRenderTable::Entry &self, QcBlockRenderTable::SideRect rect, QcBlockFace face, const QcBlockRenderTable::Entry &neighbour)
bool isShore(const QcBlockRenderTable::Entry &self, const QcBlockRenderTable::Entry &neighbour)
float liquidHeight(const QcContentRegistry &content, QcBlockId id)
bool liquidStandsFor(const QcBlockRenderTable::Entry &self, QcBlockFace face, const QcBlockRenderTable::Entry &neighbour)
const float liquidSurfaceDrop

Detailed Description

Immutable after construction and shared with meshing threads.

Member Function Documentation

[constexpr noexcept default] QcBlockRenderTable::QcBlockRenderTable()

Default-constructs an instance of QcBlockRenderTable.

[static] std::pair<int, int> QcBlockRenderTable::axes(QcBlockFace face)

Returns the axes (0 = x, 1 = y, 2 = z) along which side rectangles of face are measured.

[static] QList<QcBlockRenderTable::Quad> QcBlockRenderTable::drawnQuads(const QcBlockRenderTable::Entry &entry)

Returns the quads entry is drawn with on its own (an icon, a falling or sliding block): a shape's quads, a full cube's six faces spelled out (their texture turns left aside).

const QcBlockRenderTable::Entry &QcBlockRenderTable::entry(QcBlockId id) const

Returns the entry of state id; unknown ids render as invisible.

bool QcBlockRenderTable::hasLightSources() const

Returns whether any state emits block light.

[static] bool QcBlockRenderTable::hides(const QcBlockRenderTable::Entry &self, QcBlockRenderTable::SideRect rect, QcBlockFace face, const QcBlockRenderTable::Entry &neighbour)

Returns whether the face face of self with rectangle rect on the side towards neighbour is hidden by it.

[static] bool QcBlockRenderTable::isShore(const QcBlockRenderTable::Entry &self, const QcBlockRenderTable::Entry &neighbour)

Returns whether self, a translucent non-liquid block (ice, glass), meets neighbour, a translucent liquid, at a shore: there the liquid keeps its side up to its surface and the block's side starts at that surface, so the liquid stays visible through the block and no two unsorted translucent faces lie on one boundary (decision E-959).

const std::shared_ptr<const QcLightTable> &QcBlockRenderTable::lightTable() const

Returns how the states treat light, as the light engine reads it (the same values as the entries).

[static] float QcBlockRenderTable::liquidHeight(const QcContentRegistry &content, QcBlockId id)

Returns the height of the surface of the liquid id of content in its cell when no liquid lies on top (Entry::liquidHeight); 1 for anything that is not a liquid.

[static] bool QcBlockRenderTable::liquidStandsFor(const QcBlockRenderTable::Entry &self, QcBlockFace face, const QcBlockRenderTable::Entry &neighbour)

Returns whether neighbour, a translucent liquid (water), stands for the boundary instead of the face face (Up or Down) of self, a translucent non-liquid block (ice, glass) next to it: always above the block, below it only over source or falling water (full surface). Translucent faces are drawn unsorted without depth writes, so two faces on one boundary blend in mesh order and the result flips from block to block (E-868).

qsizetype QcBlockRenderTable::size() const

Returns the number of states in the table.

Member Variable Documentation

const float QcBlockRenderTable::liquidSurfaceDrop

How far the surface of a full liquid lies below the top of its cell.