QtCraft API C++ classes QML types Handbook

QcStructurePlacement Class

One copy of a structure in the world (decision E-219): the structure's north west bottom corner goes to origin after turns quarter turns clockwise seen from above, block states turn along (QcStateRotation). More...

Header: #include <worldgen/structures/QcStructurePlacement.h>

Public Functions

QcBlockPos origin() const
bool overlaps(QcChunkPos chunk) const
int sizeX() const
int sizeZ() const
const QcStructure &structure() const
QcBlockPos toWorld(QcBlockPos local) const
QcVec3 toWorld(const QcVec3 &local) const
int turns() const
std::optional<QcBlockId> worldBlock(QcBlockPos local) const
void writeInto(QcChunk &chunk) const

Detailed Description

Writing into chunks is deterministic and works chunk by chunk, so a structure may span chunk borders; it is safe to call from several threads.

Member Function Documentation

QcBlockPos QcStructurePlacement::origin() const

Returns the north west bottom corner of the turned footprint in the world.

bool QcStructurePlacement::overlaps(QcChunkPos chunk) const

Returns whether the turned footprint covers any column of chunk.

int QcStructurePlacement::sizeX() const

Returns the extent along world x after turning.

int QcStructurePlacement::sizeZ() const

Returns the extent along world z after turning.

const QcStructure &QcStructurePlacement::structure() const

Returns the placed structure.

QcBlockPos QcStructurePlacement::toWorld(QcBlockPos local) const

Returns the world position of the local cell local.

QcVec3 QcStructurePlacement::toWorld(const QcVec3 &local) const

Returns the world position of the local point local (cell centres map to cell centres).

int QcStructurePlacement::turns() const

Returns the quarter turns clockwise, 0 to 3 (the constructor wraps any count).

std::optional<QcBlockId> QcStructurePlacement::worldBlock(QcBlockPos local) const

Returns the state the local cell local gets in the world, turned; std::nullopt keeps what is there.

void QcStructurePlacement::writeInto(QcChunk &chunk) const

Writes the cells inside chunk (cells below or above the world are left out).