Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Render

cinnabar:extension/render@0.1.0

Local custom rendering: sandboxed WGSL post-process passes and bounded world-space primitives.

Grants: render or world_draw for primitives; render or render_post for post passes; render_depth additionally for scene depth.

Imported type vector3: vector3.

Types

rgba

Linear colour; alpha scales coverage.

record rgba {
    r: f32,
    g: f32,
    b: f32,
    a: f32,
}
MemberTypeDescription
rf32
gf32
bf32
af32

decal-style

Procedural ground styles animated by progress in 0–1.

enum decal-style {
    telegraph,
    disc,
    crater,
    shockwave,
    dust,
}
MemberTypeDescription
telegraph
disc
crater
shockwave
dust

decal

A procedural ground primitive whose progress selects its current animated appearance.

record decal {
    center: vector3,
    radius: f32,
    color: rgba,
    progress: f32,
    style: decal-style,
}
MemberTypeDescription
centervector3
radiusf32
colorrgba
progressf32
styledecal-style

Types: decal-style, rgba, vector3.

ribbon

Camera-facing strip that tapers and fades from the first point (head) to the last.

record ribbon {
    points: list<vector3>,
    width: f32,
    color: rgba,
}
MemberTypeDescription
pointslist<vector3>
widthf32
colorrgba

Types: rgba, vector3.

beam

Glowing animated strip from start to end; intensity scales its white-hot core.

record beam {
    start: vector3,
    end: vector3,
    width: f32,
    color: rgba,
    intensity: f32,
}
MemberTypeDescription
startvector3
endvector3
widthf32
colorrgba
intensityf32

Types: rgba, vector3.

billboard-pattern

The host’s procedural coverage patterns for a billboard quad.

enum billboard-pattern {
    solid,
    soft-disc,
    ring,
    spark,
    silhouette,
    sphere,
    aura,
}
MemberTypeDescription
solid
soft-disc
ring
spark
silhouette
sphere
aura

billboard

Camera-facing quad; upright quads keep their vertical axis.

record billboard {
    position: vector3,
    width: f32,
    height: f32,
    color: rgba,
    pattern: billboard-pattern,
    upright: bool,
}
MemberTypeDescription
positionvector3
widthf32
heightf32
colorrgba
patternbillboard-pattern
uprightbool

Types: billboard-pattern, rgba, vector3.

primitives

The world primitives appended by one call; successful callbacks replace prior frame output.

record primitives {
    decals: list<decal>,
    ribbons: list<ribbon>,
    beams: list<beam>,
    billboards: list<billboard>,
}
MemberTypeDescription
decalslist<decal>
ribbonslist<ribbon>
beamslist<beam>
billboardslist<billboard>

Types: beam, billboard, decal, ribbon.

pass-spec

source defines fn effect(uv: vec2<f32>) -> vec3<f32>, the new scene colour, against the host prelude.

record pass-spec {
    name: string,
    order: s32,
    source: string,
    depth: bool,
}
MemberTypeDescription
namestring
orders32
sourcestring
depthbool

line-pattern

Procedural line coverage; width and phase remain host-rendered.

enum line-pattern {
    solid,
    dashed,
    dotted,
}
MemberTypeDescription
solid
dashed
dotted

line

Camera-facing line with width in physical pixels and an original procedural pattern.

record line {
    points: list<vector3>,
    width: f32,
    color: rgba,
    pattern: line-pattern,
}
MemberTypeDescription
pointslist<vector3>
widthf32
colorrgba
patternline-pattern

Types: line-pattern, rgba, vector3.

Functions

register-pass

register-pass: func(spec: pass-spec) -> result<_, string>;

Validates a pass; passes run after the scene and before the HUD, by order then name.

Types: pass-spec.

remove-pass

remove-pass: func(name: string) -> result<_, string>;

Removes this mod’s named post pass after the callback succeeds.

update-pass

update-pass: func(name: string, enabled: bool, params: list<f32>) -> result<_, string>;

Retained enable flag and up to 16 floats exposed to the shader as param(i).

draw

draw: func(primitives: primitives) -> result<_, string>;

Appends to this callback’s primitives; each successful callback replaces the drawn set.

Types: primitives.

draw-lines

draw-lines: func(lines: list<line>) -> result<_, string>;

Appends depth-tested lines with the same authority and shared ribbon budget.

Types: line.