QtCraft API C++ classes QML types Handbook

QcChunkMesh Struct

Triangle mesh of one chunk section. More...

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

Public Functions

bool isEmpty() const

Public Variables

QList<quint32> cutoutIndices
QList<QcBlockVertex> cutoutVertices
QcSectionLight light
QList<quint32> opaqueIndices
QList<QcBlockVertex> opaqueVertices
QcBlockPos origin
QList<quint32> translucentIndices
QList<quint32> translucentRuns
QList<QcBlockVertex> translucentVertices
QList<quint32> undersideIndices
QList<QcBlockVertex> undersideVertices
QList<quint32> waterIndices
QList<QcBlockVertex> waterVertices

Detailed Description

Opaque and translucent geometry are drawn in separate passes. Within the opaque pass the cut-out faces (leaves, plants, torches: QcRenderLayer::Cutout, texels discarded by alpha) have lists of their own, so the solid faces are drawn by a pipeline without discard, which lets the GPU reject hidden fragments before shading them (decision E-756). Translucent liquids (water) have lists of their own, apart from the other translucent faces (glass, ice), so a render mode can give water its own pipeline (decision E-390); today's renderer blends both in one back-to-front pass, within a section in the order the mesher emitted them (translucentRuns). The opaque faces towards the void below the world (the underside of the bottom layer, decision E-288) are kept apart: only a camera below y = 0 can see them, so the renderer skips them otherwise (one such face per column would otherwise add a draw call to every bottom section).

Vertex positions are relative to origin, the section's bottom north-west corner (decision E-883): from 0 to 16 along each axis, exact in a float wherever the section lies; the renderer places the origin relative to the camera (QcRenderOrigin).

Member Function Documentation

bool QcChunkMesh::isEmpty() const

Returns whether the mesh has no faces in any list.

Member Variable Documentation

QList<quint32> QcChunkMesh::cutoutIndices

Indices into cutoutVertices.

QList<QcBlockVertex> QcChunkMesh::cutoutVertices

Vertices of the cut-out faces (leaves, plants, torches).

QcSectionLight QcChunkMesh::light

Light of the section's cells (decision E-390), for shaders that read light per cell; set for every mesh that has faces when the input asks for it (QcMeshInput::sectionLight).

QList<quint32> QcChunkMesh::opaqueIndices

Indices into opaqueVertices, three per triangle.

QList<QcBlockVertex> QcChunkMesh::opaqueVertices

Vertices of the solid opaque faces.

QcBlockPos QcChunkMesh::origin

The corner of the section in the world: chunk x * 16, section index * 16, chunk z * 16.

QList<quint32> QcChunkMesh::translucentIndices

Indices into translucentVertices.

QList<quint32> QcChunkMesh::translucentRuns

Where water and the other translucent faces alternate in the order the mesher emitted them (cell by cell): index counts of runs, water first (possibly 0), then other translucent faces, and so on. Empty when that order is all water before all other translucent faces; drawing the runs in turn blends coplanar and overlapping faces exactly as one mixed list would.

QList<QcBlockVertex> QcChunkMesh::translucentVertices

Vertices of the translucent faces other than water (glass, ice).

QList<quint32> QcChunkMesh::undersideIndices

Indices into undersideVertices.

QList<QcBlockVertex> QcChunkMesh::undersideVertices

Vertices of the opaque faces towards the void below the world.

QList<quint32> QcChunkMesh::waterIndices

Indices into waterVertices.

QList<QcBlockVertex> QcChunkMesh::waterVertices

Vertices of the translucent liquids (water).