← Back to Docs
  • index.html
  • Clayground
  • Clayground.Canvas3D
  • LabelBatchInstancing
  • Clayground 2026.2
  • LabelBatchInstancing QML Type

    Per-glyph instance table for the batched LabelBatch3D renderer. More...

    Import Statement: import Clayground.Canvas3D

    Properties

    Methods

    Detailed Description

    LabelBatchInstancing shapes each label into a run of glyph quads (single line, QFontMetricsF advances) against a shared LabelGlyphAtlas and packs them into one GPU instance table, one instance per inking glyph. It also builds a per-label pill-background table (consumed by LabelPillInstancing).

    The 80-byte instance layout is frozen; see the header for the field map.

    This type is used internally by LabelBatch3D.

    See also LabelBatch3D, LabelGlyphAtlas, and LabelPillInstancing.

    Property Documentation

    labels : list

    Declarative list of labels to render.

    Each element is an object { position: Qt.vector3d, text: <string>, color: <color>, size: <real>, priority: <int>, opacity: <real> }. Only position and text are required.


    Method Documentation

    list glyphAdvances(string text, real size)

    Per-code-point advance widths of text in world units at render size (advanceBasePx * size / baseSize). Bakes missing glyphs first.


    void setCurvedLabels(list labels)

    Switches the table into per-glyph curved mode (text-on-curve).

    Each element is { text, color, size, opacity, positions: [vector3d per code point], angles: [real per code point] }. Every inking glyph is emitted at its own world anchor rotated by its angle; no pill table is produced.


    void updatePositionsBulk(ByteArray positions, int first)

    Moves labels without re-shaping.

    positions is packed float32 [x, y, z] per label, applied to labels starting at index first. Rewrites the anchor of every glyph of those labels and their pill instance, then triggers a single upload.