Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

manifold:render 0.2.0

Contract reference · Payloads · contract.json (crates/manifold-wasm-abi/wit/contract.json)

Contract 0.2.0, track 0.2: open, unreleased. Nothing on track 0.2 is released yet, so any item may still change in place (spec §7.2).

InterfaceKindConsentSidesOwner
world-overlayimportlistedclientenki

Interface world-overlay

import · consent listed · sides client · owner enki · since 0.2.0

Retained 3D overlays, gizmos and picking for a mod’s client half (Enki B §5). Client side; consent class listed. manifold:render’s interim owner is Enki B until the render extensibility design exists (contract foundation §4.1).

A mod describes a retained scene of nodes (boxes, lines, voxel outlines, ghost blocks, text, markers, images and gizmos) and updates it when it changes; the engine draws it every frame on both renderers, picks the node under the pointer, drives gizmo drags per frame, and reports to the mod at tick rate. Overlays are presentation: never replicated.

The calls work inside the mod’s client systems, where the host lends the client world; elsewhere they fail with outside-system (or answer nothing), and on the server with wrong-side.

Functions

apply

apply: func(ops: list<u8>) -> result<_, overlay-error>

Apply a batch of ops to this mod’s scene: all of it, or none of it. ops is a postcard Vec<OverlayOp> (schema overlay-ops): register and release images; create, set-transform, set-shape, set-style, set-visible, set-pickable, set-order and remove nodes; clear. One crossing per tick whatever the number of changes; voxel buffers are embedded, never expanded into records.

raycast

raycast: func(origin: dvec3, dir: vec3, max: f32, options: ray-options) -> option<list<u8>>

Client ray cast against blocks within max blocks (up to 4,096) and, as options say, this mod’s pickable nodes and entities (Enki B §5.6). The nearest hit (schema ray-hit), or none.

supports-op

supports-op: func(kind: op-kind) -> bool

Whether this host implements op kind (the OverlayOp variant index: 0 register-image, 1 release-image, 2 create, 3 set-transform, 4 set-shape, 5 set-style, 6 set-visible, 7 set-pickable, 8 set-order, 9 remove, 10 clear). False outside a client system.

take-events

take-events: func() -> list<u8>

This mod’s events since the last call, oldest first (schema overlay-events): hover, click press and release, gizmo drag start, update, end and cancel, and an overflow record when the queue was full.

Types

dvec3 (alias)

= core/types.dvec3

op-kind (alias)

= core/ops.op-kind

overlay-error (variant)

Diagnostic text; nothing here is shown to players.

IndexCasePayloadAbout
0invalidstringA malformed op: unknown or duplicate id, non-finite or inverted geometry, a width out of range, too few points, a buffer of the wrong length, an undecodable batch.
1budget-exceededstringThe batch would exceed this mod’s budget (Enki B §5.7).
2unsupportedop-kindAn op this host does not implement: its kind (supports-op).
3wrong-sidenoneCalled on the server side.
4outside-systemnoneCalled outside one of the mod’s client systems.

ray-options (record)

FieldTypeAbout
include-overlaysboolAlso test this mod’s pickable, visible nodes.
include-entitiesboolAlso test entities: posed hit boxes where the client animates them, remote players’ body boxes otherwise.

vec3 (alias)

= core/types.vec3