QtCraft API C++ classes QML types Handbook

QcEntityMesher Namespace

Builds the triangles of entities: static box models, animated skeleton models with outfits and hair, dropped items and the first-person hand. More...

Header: #include <clientcore/entitymeshes/QcEntityMesher.h>

Classes

struct Attachment
struct BlockPlacement
struct ExtrudedSprite
struct Figure
struct HandView
class HeldItemPainter
struct HeldPlacement
struct ItemFrame
struct ItemLook
struct LyingPlacement
struct ModelLook
struct PartLook
struct Placement
struct Rotate
struct Turn

Types

PlaceFunction
UvLookup

Variables

const double capeBend
const double emptyPunchRise
const QcVec3 heldStrikeShift
const double modelHeight
const char *const orbTexture

Functions

void appendBlock(QcEntityMesh &mesh, const QcEntityMesher::ItemLook &look, const QcEntityMesher::BlockPlacement &placement, QcEntityLight light, const QcEntityMesher::UvLookup &uv)
void appendBlockQuads(QcEntityMesh &mesh, const QList<QcBlockRenderTable::Quad> &quads, const QcEntityMesher::BlockPlacement &placement, QcEntityLight light)
void appendExtrudedSprite(QcEntityMesh &mesh, const QcEntityMesher::ExtrudedSprite &sprite, const QcEntityMesher::PlaceFunction &place)
void appendHand(QcEntityMesh &mesh, const QcEntityMesher::Figure &figure, const QcAnimator::HandPose &hand, const QcEntityMesher::HandView &view, const QcEntityMesher::UvLookup &uv)
void appendItem(QcEntityMesh &mesh, const QcClientEntity &entity, const QcEntityMesher::ItemLook &look, const QcEntityMesher::ItemFrame &frame, const QcEntityMesher::UvLookup &uv)
void appendLyingItem(QcEntityMesh &mesh, const QcEntityMesher::ItemLook &look, const QcEntityMesher::LyingPlacement &placement, const QcEntityMesher::UvLookup &uv)
void appendModel(QcEntityMesh &mesh, const QcEntityMesher::Figure &figure, const QcAnimator::BodyPose &pose, const QcEntityMesher::Placement &placement, const QcEntityMesher::UvLookup &uv)
void appendOrb(QcEntityMesh &mesh, const QcClientEntity &entity, const QcEntityMesher::ItemFrame &frame, const QcEntityMesher::UvLookup &uv)
void appendParts(QcEntityMesh &mesh, const QList<QcMobPart> &parts, const QcEntityMesher::Placement &placement, const QcEntityMesher::UvLookup &uv, const QcEntityMesher::PartLook &look = {})
void appendPlacedItem(QcEntityMesh &mesh, const QcEntityMesher::ItemLook &look, const QcEntityMesher::PlaceFunction &place, QcEntityLight light, const QcEntityMesher::UvLookup &uv)
void appendPlacedParts(QcEntityMesh &mesh, const QList<QcMobPart> &parts, const QcEntityMesher::PlaceFunction &place, QcEntityLight light, const QcEntityMesher::UvLookup &uv)
quint8 boneBit(QcBoneRole role)
const QList<QcMobPart> &minecartParts()
const QList<QcMobPart> &playerParts()
QcVec3 spriteGrip(const QcEntityMesher::ItemLook &look, double size)

Detailed Description

Rebuilt every frame; entities are few.

Classes

class Attachment

An extra textured box worn on a bone of a skeleton model, in model space like the bone's own boxes: it turns with the bone and takes the figure's light and hurt tint. More...

class BlockPlacement

Where a block entity stands (its feet) and how large it is drawn. More...

class ExtrudedSprite

A sprite with thickness: size metres across, in the local space of a flat sprite (x across and centred, y up from 0 to size), one texel thick along z and centred on z = 0. More...

class Figure

A skeleton model as drawn: its look, the item in its right hand and what it wears (both optional, not owned). More...

class HandView

The first-person view the hand is drawn for: the camera at eye looking along yaw/pitch (degrees), and the light there. More...

class HeldItemPainter

Draws held items, in the first-person fist and in a figure's fist. More...

class HeldPlacement

Where a held item sits around the grip (decision E-831), resolved from the content's hold transforms (QcHoldTransform): a point of the item (a sprite one unit across, a block one unit per edge, relative to the grip) is scaled by scale, turned by rotate (degrees: Turn by y, then Rotate by x and z) and moved by translate, in metres in the frame of the fist. More...

class ItemFrame

What a dropped item looks like this frame: alpha interpolates between the last two ticks, seconds is the client clock driving the animation, light the light at the item. More...

class ItemLook

Appearance of an item: a small cube with the block's face textures for placeable cube blocks, otherwise a sprite of the item texture. More...

class LyingPlacement

Where an item lies flat on a block (on a campfire, decision E-772): the middle of its underside, turned by yaw degrees, in light. More...

class ModelLook

What a skeleton model looks like: the model, an outfit, an optional hair style and cape, the colours that tinted layers use, and a uniform scale (models are built for 1.8 m). More...

class PartLook

How a creature of static boxes looks this frame (decision E-480): sitting (each part moves by its QcMobPart::sitOffset) and the colours its tinted parts take (the collar: QcTint::Collar). More...

class Placement

Where the entity stands and how it is lit. More...

class Rotate

Rotation around the X axis (positive moves -Y towards -Z), then around Z (positive moves -Y towards +X) and then around Y (positive moves -Z towards +X), all in degrees. More...

class Turn

Rotation around the Y axis by a yaw in degrees: the model faces -Z; yaw 90 faces +X. More...

Type Documentation

[alias] QcEntityMesher::PlaceFunction

Maps the local space of an item to world space.

[alias] QcEntityMesher::UvLookup

Returns the atlas rectangle of a texture name.

Variable Documentation

const double QcEntityMesher::capeBend

A cape's lower part (below the square emblem part) bends further back than the upper part by this share of the lift, so a flying cape curves.

const double QcEntityMesher::emptyPunchRise

Metres the empty arm rises per metre of its punch forward (HandPose::punch), so the fist strikes ahead over the swing's downward turn instead of dropping onto the hotbar.

const QcVec3 QcEntityMesher::heldStrikeShift

Where the arm holding an item moves at the bottom of a strike (HandPose::reach; metres, camera frame): up, left and a little forward, so the blow travels from the lower right corner towards the middle of the screen and stays above the hotbar (decision E-881).

const double QcEntityMesher::modelHeight

Height the humanoid models are built for.

const char *const QcEntityMesher::orbTexture

The texture of experience orbs, by its full content name (the base pack's "experience_orb").

Function Documentation

void QcEntityMesher::appendBlock(QcEntityMesh &mesh, const QcEntityMesher::ItemLook &look, const QcEntityMesher::BlockPlacement &placement, QcEntityLight light, const QcEntityMesher::UvLookup &uv)

Appends to mesh a falling block (0.98 m) or the block a cart carries at placement: the block's look (ItemLook with cube), textured by uv, in light.

void QcEntityMesher::appendBlockQuads(QcEntityMesh &mesh, const QList<QcBlockRenderTable::Quad> &quads, const QcEntityMesher::BlockPlacement &placement, QcEntityLight light)

Appends to mesh a falling or sliding block at placement, in light, drawn with the quads of its state (QcBlockRenderTable::drawnQuads, texture coordinates in the atlas): shapes keep their boxes, rotation and texture cut-outs.

void QcEntityMesher::appendExtrudedSprite(QcEntityMesh &mesh, const QcEntityMesher::ExtrudedSprite &sprite, const QcEntityMesher::PlaceFunction &place)

Appends to mesh the solid form of sprite (QcSpriteShape::form), each point placed by place.

void QcEntityMesher::appendHand(QcEntityMesh &mesh, const QcEntityMesher::Figure &figure, const QcAnimator::HandPose &hand, const QcEntityMesher::HandView &view, const QcEntityMesher::UvLookup &uv)

Appends to mesh the first-person right arm of figure with its held item in the pose hand, placed in front of the camera of view, textured by uv.

void QcEntityMesher::appendItem(QcEntityMesh &mesh, const QcClientEntity &entity, const QcEntityMesher::ItemLook &look, const QcEntityMesher::ItemFrame &frame, const QcEntityMesher::UvLookup &uv)

Appends to mesh the dropped item entity looking like look in frame, textured by uv, turning slowly about the vertical axis and bobbing: a block in its block form, a sprite as one solid item one texel thick (decision E-991), flat without a shape. Larger stacks show up to three copies.

void QcEntityMesher::appendLyingItem(QcEntityMesh &mesh, const QcEntityMesher::ItemLook &look, const QcEntityMesher::LyingPlacement &placement, const QcEntityMesher::UvLookup &uv)

Appends to mesh an item looking like look lying still at placement, textured by uv: its sprite face up, or a block item as a small cube standing on the spot.

void QcEntityMesher::appendModel(QcEntityMesh &mesh, const QcEntityMesher::Figure &figure, const QcAnimator::BodyPose &pose, const QcEntityMesher::Placement &placement, const QcEntityMesher::UvLookup &uv)

Appends to mesh the animated skeleton model figure in pose at placement, textured by uv, with its held item in the right hand.

void QcEntityMesher::appendOrb(QcEntityMesh &mesh, const QcClientEntity &entity, const QcEntityMesher::ItemFrame &frame, const QcEntityMesher::UvLookup &uv)

Appends to mesh the experience orb entity in frame (decision E-398), textured by uv: the glowing orbTexture as two crossed sprites, larger for larger values, turning and bobbing faster than items.

void QcEntityMesher::appendParts(QcEntityMesh &mesh, const QList<QcMobPart> &parts, const QcEntityMesher::Placement &placement, const QcEntityMesher::UvLookup &uv, const QcEntityMesher::PartLook &look = {})

Appends to mesh the static boxes parts of a mob definition at placement, facing north and turned by its yaw, textured by uv, sitting, tinted and walking as look says.

void QcEntityMesher::appendPlacedItem(QcEntityMesh &mesh, const QcEntityMesher::ItemLook &look, const QcEntityMesher::PlaceFunction &place, QcEntityLight light, const QcEntityMesher::UvLookup &uv)

Appends to mesh the item look in any orientation, each point placed by place, textured by uv, in light (the item in a frame, decision E-790): a block item as a small cube centred on the origin, any other item as a flat sprite standing on it.

void QcEntityMesher::appendPlacedParts(QcEntityMesh &mesh, const QList<QcMobPart> &parts, const QcEntityMesher::PlaceFunction &place, QcEntityLight light, const QcEntityMesher::UvLookup &uv)

Appends to mesh the static boxes parts in any orientation, textured by uv, in light, each corner placed by place (a paddle turning in its oarlock, decision E-920).

[constexpr] quint8 QcEntityMesher::boneBit(QcBoneRole role)

Returns the bit of bone role in Figure::hiddenBones.

const QList<QcMobPart> &QcEntityMesher::minecartParts()

Returns the model of a minecart (decision E-382), facing north like other static parts.

const QList<QcMobPart> &QcEntityMesher::playerParts()

Returns the fallback model for players when the content has no humanoid skeleton.

QcVec3 QcEntityMesher::spriteGrip(const QcEntityMesher::ItemLook &look, double size)

Returns where a hand holds the sprite of look drawn size metres across, in the sprite's local space: the shape's handle (QcHoldGrip::Handle, Base) or the middle of its opaque texels (QcHoldGrip::Middle); without a shape, where a handle drawn from the lower left usually is.