QtCraft API C++ classes QML types Handbook

QcMapPixel Namespace

One pixel of a map (decision E-799): the top block of its column as the index of its block definition (QcBlockState::type, the same for all states of a block, an index into QcContentRegistry::blocks()) and a shade, in 16 bits as (block + 1) << 2 | shade; 0 is a pixel nobody has looked at yet. More...

Header: #include <common/maps/QcMapPixel.h>

Types

enum class Shade { Dark, Normal, Bright }

Variables

const quint16 blank
const int[3] brightness
const quint32 maxBlock
const int shadeCount

Functions

std::optional<quint32> blockOf(quint16 pixel)
quint16 make(quint32 block, QcMapPixel::Shade shade)
QcMapPixel::Shade shadeOf(quint16 pixel)

Detailed Description

The client finds the colour of the block itself (decision E-801), so texture packs colour maps too. Saves name the blocks (QcMapCodec); the indices never leave a running world.

Type Documentation

enum class QcMapPixel::Shade

How the pixel is shaded (decision E-800): darker where the land climbs towards the north or the water is deep, brighter where it falls.

ConstantValueDescription
QcMapPixel::Shade::Dark0Darker.
QcMapPixel::Shade::Normal1As the block is.
QcMapPixel::Shade::Bright2Brighter.

Variable Documentation

const quint16 QcMapPixel::blank

A pixel nobody has looked at yet.

const int[3] QcMapPixel::brightness

Brightness of each shade, in 255ths (as the reference: 180, 220, 255).

const quint32 QcMapPixel::maxBlock

The largest block index a pixel can name; larger ones (very large mods) leave their pixels blank.

const int QcMapPixel::shadeCount

The number of shades.

Function Documentation

[constexpr] std::optional<quint32> QcMapPixel::blockOf(quint16 pixel)

Returns the block index of pixel, std::nullopt for a blank pixel.

[constexpr] quint16 QcMapPixel::make(quint32 block, QcMapPixel::Shade shade)

Returns the pixel of the block index block with shade; blank for a block beyond maxBlock.

[constexpr] QcMapPixel::Shade QcMapPixel::shadeOf(quint16 pixel)

Returns the shade of pixel; shade bits outside the three shades read as Normal.