QtCraft API C++ classes QML types Handbook

QcTexturePack Struct

A loaded texture pack (decision E-297): its manifest and the textures it brings, keyed by the content's texture name ("qtcraft:stone"). More...

Header: #include <clientcore/texturepacks/QcTexturePack.h>

Public Types

enum class MapKind { Normal, Specular }
enum class Origin { BuiltIn, User, Mod }

Public Functions

bool holdsMaps() const
bool provides(const QString &key) const

Public Variables

qint64 decodedBytes
QString directory
QString id
QHash<QString, QImage> images
QHash<QString, QList<QImage>> laterFrames
QcTexturePackManifest manifest
QHash<QString, QImage> normalMaps
QcTexturePack::Origin origin
QImage preview
QcTexturePackProblems problems
QHash<QString, QJsonObject> specs
QHash<QString, QImage> specularMaps
qsizetype unreadMaps

Static Public Members

std::optional<QcTexturePack::MapKind> materialMapOf(const QString &key)
QcTexturePackRef
QcTexturePackStack

Detailed Description

Images are checked and decoded at load time and never change afterwards, so a pack is shared between threads as std::shared_ptr<const QcTexturePack>.

Member Type Documentation

enum class QcTexturePack::MapKind

Kind of a material map: normal or specular.

ConstantValueDescription
QcTexturePack::MapKind::Normal0_n: normal, occlusion, height
QcTexturePack::MapKind::Specular1_s: smoothness, reflectance or metal, porosity, emission

enum class QcTexturePack::Origin

Where a pack comes from; part of its id.

ConstantValueDescription
QcTexturePack::Origin::BuiltIn0Shipped with the game
QcTexturePack::Origin::User1In the user's texture pack folder
QcTexturePack::Origin::Mod2Brought by a mod

Member Function Documentation

bool QcTexturePack::holdsMaps() const

Returns whether the pack holds material maps read from its files.

[static] std::optional<QcTexturePack::MapKind> QcTexturePack::materialMapOf(const QString &key)

Returns whether the image key ("qtcraft:stone_n") names a material map: the suffixes _n and _s are reserved for them.

bool QcTexturePack::provides(const QString &key) const

Returns whether the pack has an image or a procedural spec for key.

Member Variable Documentation

qint64 QcTexturePack::decodedBytes

Bytes of all decoded images (checked against the memory budget while loading).

QString QcTexturePack::directory

Absolute path of the pack's folder.

QString QcTexturePack::id

Id of the pack: "builtin:<folder>", "user:<folder>" or "mod:<mod folder>/<folder>".

QHash<QString, QImage> QcTexturePack::images

PNG textures at the pack's resolution (larger ones stored at maxStoredResolution).

QHash<QString, QList<QImage>> QcTexturePack::laterFrames

The frames after the first of the images that are vertical strips of animation frames (decision E-878), at the size of their first frame.

QcTexturePackManifest QcTexturePack::manifest

The pack's manifest.

QcTexturePack::Origin QcTexturePack::origin

Where the pack comes from.

QImage QcTexturePack::preview

Optional preview from the manifest's "preview".

QcTexturePackProblems QcTexturePack::problems

Problems found while loading, for the player.

QHash<QString, QJsonObject> QcTexturePack::specs

Procedural definitions (the fields of content/*/textures/*.json).

qsizetype QcTexturePack::unreadMaps

Material map files the pack has that were not read (loaded without the maps): the pack must be read again when the maps are wanted (decision E-912).

Related Non-Members

[alias] QcTexturePackRef

Shared handle to a loaded pack; packs never change after loading.

[alias] QcTexturePackStack

Active packs, the highest priority first.