QtCraft API C++ classes QML types Handbook

QcMaterialSynthesizer Namespace

Paints the material maps of one texture from its colour picture (decision E-908). More...

Header: #include <clientcore/materials/QcMaterialSynthesizer.h>

Classes

struct Colours
struct Maps

Variables

const QRgb flatNormal

Functions

QcMaterialSynthesizer::Maps flat(int size)
QImage packEmission(const QImage &specular)
QcMaterialSynthesizer::Maps paint(const QImage &colour, const QcMaterialParams &params, const QcMaterialSynthesizer::Colours &colours)
QColor specularTexel(const QcMaterialParams &params, float emission)

Detailed Description

The maps use the labPBR encoding the texture packs use (docs/Texturpakete.md):

The relief follows the brightness of the colour (darker is lower: mortar, cracks, grain), its neighbours wrap around the tile's edges, so a map tiles as its texture does. Deterministic: the same picture and material give the same maps on every platform (no fused multiply-add).

Classes

class Colours

The colours of the definition that tell an inclusion (the ore) from its ground (the stone). More...

class Maps

The normal and specular maps of one tile, or one mip level of both material atlases (QcMaterialMips::halve). More...

Variable Documentation

const QRgb QcMaterialSynthesizer::flatNormal

The texel of a flat normal map: no tilt, no occlusion, full height.

Function Documentation

QcMaterialSynthesizer::Maps QcMaterialSynthesizer::flat(int size)

Returns the flat maps (QcMaterialParams::flat) of a size x size tile: textures without maps.

QImage QcMaterialSynthesizer::packEmission(const QImage &specular)

Returns the pack's labPBR specular map specular in the atlas's encoding: emission 255 (none) becomes 0.

QcMaterialSynthesizer::Maps QcMaterialSynthesizer::paint(const QImage &colour, const QcMaterialParams &params, const QcMaterialSynthesizer::Colours &colours)

Returns the normal and specular maps of the RGBA picture colour (any square size) with params, telling inclusions by colours; transparent texels get a flat normal.

QColor QcMaterialSynthesizer::specularTexel(const QcMaterialParams &params, float emission)

Returns the specular texel of params with emission, for tests and the flat maps.