QtCraft API C++ classes QML types Handbook

QcPackedMesh Struct

The lists of a section mesh (QcChunkMesh) packed for the GPU into one vertex and one index range (decision E-813), which the GPU mesh store places in a page shared with other sections (decision E-820). More...

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

Public Types

struct Place
enum class List { Opaque, Cutout, Translucent, Water, Underside }

Public Functions

bool isEmpty() const
const QcPackedMesh::Place &place(QcPackedMesh::List list) const

Public Variables

QByteArray indices
std::array<QcPackedMesh::Place, listCount> places
QByteArray vertices

Static Public Members

const int indexAlignment
const int listCount
QcPackedMesh pack(const QcChunkMesh &mesh)

Detailed Description

A list's indices stay relative to its own first vertex (a draw takes that vertex as base vertex, or binds the vertex buffer at the list's offset); they take two bytes when the list has at most 65536 vertices (QcIndexPacking), otherwise four, and every list starts at a multiple of four bytes in the index data (padding bytes are zero).

Member Type Documentation

enum class QcPackedMesh::List

One list of a section mesh, in the order of the packed data.

ConstantValueDescription
QcPackedMesh::List::Opaque0QcChunkMesh::opaqueVertices
QcPackedMesh::List::Cutout1QcChunkMesh::cutoutVertices
QcPackedMesh::List::Translucent2QcChunkMesh::translucentVertices
QcPackedMesh::List::Water3QcChunkMesh::waterVertices
QcPackedMesh::List::Underside4QcChunkMesh::undersideVertices

Member Function Documentation

bool QcPackedMesh::isEmpty() const

Returns whether no list has an index.

[static] QcPackedMesh QcPackedMesh::pack(const QcChunkMesh &mesh)

Returns mesh packed into one vertex and one index range.

const QcPackedMesh::Place &QcPackedMesh::place(QcPackedMesh::List list) const

Returns where list lies in the packed data.

Member Variable Documentation

const int QcPackedMesh::indexAlignment

Every list starts at a multiple of this many bytes in the index data.

QByteArray QcPackedMesh::indices

Index data of all lists, each list aligned to indexAlignment.

const int QcPackedMesh::listCount

Number of lists.

std::array<QcPackedMesh::Place, listCount> QcPackedMesh::places

Where each list lies, indexed by List.

QByteArray QcPackedMesh::vertices

Vertex data of all lists (QcBlockVertex).