Skip to content

Ariadne scene: label: on any node, and entity_labels: for world entities - #1234

Merged
transfix merged 2 commits into
masterfrom
feat/ariadne-node-labels
Nov 14, 2026
Merged

transfix merged 2 commits into
masterfrom
feat/ariadne-node-labels

Conversation

@transfix

@transfix transfix commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Any scene node can now carry a screen-space label: text over the node, such as a vehicle's name tag. World entities can get their names as labels too. Documented in docs/ARIADNE.md §5.21, a section of its own (so it does not collide with #1232's §5.4 addition).

- node: car_a
  source: { box: [4, 2, 1.5] }
  label:
    text: Alpha                        # or bind: <state key>, read as it draws
    offset: 2                          # metres above the top of the node (or [x, y, z])
    color: [1, 1, 1]                   # [r, g, b], "#rrggbb" or c0..c7
    backdrop: [0.05, 0.05, 0.07]       # or none; backdrop_opacity
    edge: c0                           # a frame round the backdrop
    size: 14
    scale: 1                           # a number or a state key
    focus: { key: cam.follow, scale: 1.4 }   # larger while the key holds this node's id
    fade: [300, 600]                   # whole to 300 m, gone past 600 m
scene:
  entity_labels: { offset: 2.5, fade: [300, 600], focus: cam.follow }   # each world entity, "{name}"

How labels are drawn

  • One node per scene. A cvc::gl::LabelLayerNode (LabelLayer.h) draws all of a scene's labels. Its prop draws in the overlay pass through 2-D text actors that no renderer holds, so mirror viewports, which skip 2-D actors, still copy it.
  • Each draw, per renderer. In each renderer, every label:
    • reads its anchor from its node's world transform (the top or centre of the node's bounds, or its origin), plus offset:;
    • is skipped if its node is hidden, or if this renderer leaves the node out (a view's tags:);
    • fades and is culled by the distance from that renderer's camera;
    • is drawn in depth order, farthest first, so a nearer label lies on top.
  • No state writes. Bound keys (bind:, scale:, focus:) are read at draw time.
  • Cheap when still. Text is rasterised again only when its text, size or opacity (in 32 steps) changes. A still label is a projection and a quad.
  • Entities. entity_labels: labels each world entity's node (vehicle_<id>) as it is drawn. The text fills in {name}, {id}, {archetype} and {team}; an unnamed entity shows its node's id.
  • The existing label stays. A graphics node's plain VTK label (show_label / label_text) is unchanged.

What changed

  • New: LabelLayer.{h,cpp} (cvcGL), and scene_labels.{h,cpp} (Ariadne) for label: and entity_labels:.
  • realize_scene applies a node's label: in its shared tail, so custom types and data nodes get one too.
  • Scene::entity_labels and RealizedScene::entity_labels are new. The loader reads scene: entity_labels:, and sync_vehicle_markers labels each entity's node.

Tests

New cvcgl_ariadne_labels (rendered for real; it skips where nothing rasterises unless CVC_REQUIRE_RENDER=1) covers:

  • the fade rule and cull past far;
  • the pixels: red text on a blue backdrop inside a green edge, above its node, nothing below;
  • the depth order;
  • bound text, scale: and focus:, following the key each frame;
  • hidden nodes, and a renderer that leaves a node out (and puts it back);
  • labels following a moved node;
  • no text rasterised again on a still frame;
  • entity labels, both directly and through a spawned, named world entity.

Run locally on Linux (GCC 13, Release, Mesa, Jolt) with CVC_REQUIRE_RENDER=1; all pass:

  • cvcgl_ariadne_labels, 37/37, including the spawned entity labelled "Alpha Refactor & Modernize code #1";
  • cvcgl_ariadne_{physics,data,pick,realize,scenes,views};
  • cvcgl_ari_switch, cvcgl_camera_idle, cvcgl_shadow_casters and cvcgl_stream_node;
  • ariadne_loader_test (230 tests).

Not run locally: Windows, macOS and the wasm lanes (CI covers them).

A scene node's `label:` draws text over the node in screen space, such as a vehicle's name tag.
It is offset above the node, faded and culled by the camera's distance, on a backdrop with an
edge, at a per-label scale, with nearer labels over farther ones. `scene: entity_labels:` gives
each world entity (WorldVehicles) its name as a label in the same keys.

- cvcGL LabelLayerNode (LabelLayer.h): one node per scene draws its labels in the overlay pass,
  through 2-D text actors no renderer holds, so mirror viewports copy its prop like any other.
  Each draw, per renderer:
  - the anchor comes from the node's world transform (top or centre of its bounds, or its
    origin) plus the offset;
  - a hidden node, or one the renderer leaves out (a view's tags), has no label there;
  - fade and cull go by that renderer's camera distance (label_fade);
  - labels are drawn farthest first.
  Bound keys (text, scale, focus) are read at draw time; nothing is written to state. Text is
  rasterised again only when its text, size or opacity (32 steps) changes.
- label: { text | bind, offset, anchor, color, backdrop, backdrop_opacity, edge, edge_width,
  size, scale, focus: { key, value, scale }, fade: [near, far], bold } (or label: <text>).
  realize_scene applies it in its shared tail (scene_labels.h), so custom types and data nodes
  get one too.
- entity_labels: (Scene, RealizedScene): sync_vehicle_markers labels each entity's node
  (vehicle_<id>). The text fills {name}, {id}, {archetype} and {team}; an unnamed entity shows
  its node's id.

Test cvcgl_ariadne_labels (rendered for real) covers:
- the fade rule and the cull past far;
- red text on a blue backdrop in a green edge, above its node;
- depth order;
- bound text, scale and focus;
- hidden nodes, and a renderer that leaves a node out;
- labels following a moved node;
- no rasterising on a still frame;
- entity labels, directly and through a spawned, named world entity (Jolt builds).
Documented in docs/ARIADNE.md §5.4.
@transfix
transfix enabled auto-merge (squash) November 14, 2026 19:32
@transfix
transfix merged commit 61e2cff into master Nov 14, 2026
28 of 29 checks passed
@transfix
transfix deleted the feat/ariadne-node-labels branch November 14, 2026 23:45
transfix added a commit that referenced this pull request Nov 15, 2026
Master's #1217 keeps nothing per thread in state_exec: a native's context (call_args::context())
carries its group, registry and stream, async_host::call and begin_external take it, and the pool
drops in_pump_all() and the one-argument run_on_host.

- async_host.h: begin_external takes the context, as on master, and keeps this branch's note that
  a call is finished through the host it was made on.
- script_engine.cpp: the sliced form finds the calling program's group from the call's context
  (exec_group::current(ctx)), else group 0, and reads its data step from the context.
- ariadne.cpp: file-pick opens its picker through run_on_host for the group its verbs were bound
  for (the env's, as its host is), and inline in group 0 and the init lane.
- exec_pool: in_pump_all() is back, for the host-thread calls' debug assertion and
  ScriptLane::run's refusal, read from the pool's calls (their callers' and pumpers' thread ids)
  under its mutex rather than from thread-locals.
- ariadne_runtime_test: the init lane's cycles test no longer compares against the calling
  thread's own registry, which master removed; it is AriadneInit.RunsAScriptThatLeavesCycles.
- ci.yml: the sanitizer's required list names the test by its new name.
- STATE_EXEC_THREADED.md: B29-B31 and the file-pick and sliced-call notes name the context-based
  calls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant