Skip to content

Ariadne scene: type: ribbon and type: draped_link, lines drawn from data - #1232

Merged
transfix merged 5 commits into
masterfrom
feat/ariadne-ribbon-nodes
Nov 16, 2026
Merged

transfix merged 5 commits into
masterfrom
feat/ariadne-ribbon-nodes

Conversation

@transfix

Copy link
Copy Markdown
Owner

Two custom scene node types over cvcGL's streaming RibbonNode and DrapedLinkNode, so a document can draw these with no host C++:

  • vehicle tracks that grow every tick;
  • routes replaced on each re-plan;
  • links between moving nodes, coloured by a quality value.

Each line is its own node, updated only when its data changes. Data that grows or moves uploads only what changed. Documented in docs/ARIADNE.md §5.4 ("Lines from data").

- node: track_a
  type: ribbon
  source: { state: tracks.a }        # or { data: <name>, item: <output> }, { stream: <token> }, points:
  width: 3
  color: c1                          # [r, g, b], "#rrggbb", or the chart's slots c0..c7
  ground: ground                     # drape on a heightfield / generated_world node
  window: { tail: 300, units: m }    # or { from, to }: numbers or state keys
- node: link_ab
  type: draped_link
  ground: ground
  between: [car_a, car_b]            # or from:/to:, or a source: of x0, y0, x1, y1
  value: links.ab.quality
  ramp: quality

type: ribbon

  • Points. A ribbon takes its points from one of these:

    • a state key: its data() (floats, doubles, float32 bytes or a mesh's points) or the numbers in its value;
    • a dataset output;
    • a stream of float32 frames (appended, or replace: true);
    • literal points:.

    fields: lists each point's numbers: x, y, and any of z, w (width) and v (value).

  • Reads and uploads. A key is read only when it was written. Then:

    • a list that grew appends;
    • a list whose tail changed is rewritten from the first point that differs;
    • only those centres are uploaded, so an appended point costs one quad (48 B), never the whole node.
  • Window. window: moves what is drawn with no upload.

  • Width. Per node (width:) or per point (w).

  • Colour. Per node (color:) or per point by value (ramp:: quality, heat, or up to 8 stops; range:).

  • Ground. ground: drapes the points. When the ground is made again, the ribbon is re-draped.

type: draped_link

  • On the ground. The link hugs the ground's heights in the vertex shader. Every link on a ground shares that ground's height texture.
  • Ends. between: follows two nodes, world entities' vehicle_<id> included.
  • Colour. value: + ramp: colours the link by a quality read each frame.
  • No uploads. Moving or recolouring a link uploads nothing.

Changes in cvcGL

  • RibbonNode::replaceFrom(first, xyz, n, halfWidths, values) rewrites centres from first on and uploads only those; append and assign go through it.
  • RibbonNode takes per-centre half widths.
  • RibbonNode::setValueRamp colours by value. The values are an R32F texture updated by sub-image, at most 3 calls a write; valueStats() counts them.
  • DrapedLinkNode::setHeightField drapes over another texture, for a ground on a new grid.

Changes in the scene core

  • The loader puts a source: the built-ins have no field for ({ state }, { stream }) into a custom node's props.
  • register_scene_node_type takes NodeTypeOptions. With reads_data, a type's source: { data } nodes go to its realizer instead of becoming data nodes.

Tests

New cvcgl_ariadne_ribbons (55 checks, rendered for real; it skips where nothing rasterises unless CVC_REQUIRE_RENDER=1). It checks:

  • Appends. Each appended point uploads one quad and creates nothing, counted by the node and at the driver.
  • Tail. A moved last point rewrites 2 centres.
  • No uploads. Windows and links move with no upload.
  • Pixels. Track, route window, values, widths and links.
  • Mappers. Value colours on both VTK mapper families, classic and low-memory (the WebGL2 path).
  • Sources. The dataset and stream sources.
  • Ground. Draping, and a ground regenerated in place and on a new grid.

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

  • cvcgl_ariadne_ribbons;
  • cvcgl_streaming_geometry, cvcgl_streaming_overlays and cvcgl_streaming_races (RibbonNode and DrapedLinkNode changed);
  • cvcgl_stream_node;
  • cvcgl_ariadne_{data,physics,pick,realize,scenes,views};
  • cvcgl_ari_switch, cvcgl_camera_idle and cvcgl_shadow_casters;
  • ariadne_loader_test (230 tests).

clang++-18 -Wall -Wextra is clean on the new and changed sources.

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

Two custom scene node types over cvcGL's streaming RibbonNode and DrapedLinkNode
(ribbon_nodes.h, registered by register_cvcgl_extensions), so a document draws tracks that grow
every tick, routes replaced on each re-plan and links between moving nodes with no host C++.

- type: ribbon takes its points from source: { state: <key> } (data() floats, doubles, float32
  bytes or a mesh's points, else the value's numbers as text), { data: <name>, item: <output> }
  (a dataset of the document's data: block), { stream: <token> } (float32 frames, each appended,
  or each the whole line with replace: true), or literal points:. fields: says what a point's
  numbers are: x, y and any of z, w (its width) and v (its value).
- A key is read again only when it was written. A list that grew appends, one whose tail changed
  is written from the first point that differs, and only those centres are uploaded: one quad
  (48 bytes) an appended point, never the whole node.
- window: { from, to, tail, units: point | m } moves what is drawn with no upload (each a number
  or a state key read each frame).
- Width per node (width:) or per point (w); colour per node (color: [r, g, b], "#rrggbb", or the
  chart's style slots c0..c7), or per point by value through ramp: (quality, heat, or up to eight
  stops; range:). ground: drapes the points on a heightfield or generated_world node, and a ground
  made again re-drapes them.
- type: draped_link hugs a ground's heights in the vertex shader: between: [a, b] follows two
  nodes (world entities' vehicle_<id> too), or from:/to: or a source: of x0, y0, x1, y1. value: +
  ramp: colour it by a quality read each frame. Moving and recolouring it upload nothing; its
  ground's heights are one texture shared by its links.

cvcGL:
- RibbonNode::replaceFrom(first, xyz, n, halfWidths, values): rewrite centres from `first` on,
  uploading only those (append and assign go through it). Per-centre half widths (a segment
  tapers between them).
- RibbonNode::setValueRamp: colour by each centre's value, interpolated along the segment and
  drawn flat. The values sit in an R32F texture uploaded by sub-image (a write uploads its own
  texels, at most three calls); valueStats() counts them.
- DrapedLinkNode::setHeightField: drape over another height texture (a ground on a new grid).

Scene core:
- The loader keeps a source: the built-ins have no field for ({ state }, { stream }) in a custom
  node's props, as written.
- register_scene_node_type takes NodeTypeOptions; reads_data hands a source: { data } node to its
  realizer instead of drawing it as a data node.

Test cvcgl_ariadne_ribbons (55 checks, rendered for real): per-append uploads counted by the node
and at the driver (one quad, nothing created), a moved last point rewrites two centres, windows
and links moved with no upload, pixels for the track, route window, values, widths and links,
value colours on both VTK mapper families, the dataset and stream sources, draping, and a ground
regenerated in place and on a new grid. Documented in docs/ARIADNE.md §5.4.
…mestamp

A state source was read again only when the key's lastMod() changed. lastMod comes from boost's
microsec_clock, which on Windows ticks coarsely. Two writes within one tick (a track growing a
point a frame) then had the same stamp, and the second was never read. cvcgl_ariadne_ribbons'
append, tail and data() checks failed on package-windows for that reason.

The source now listens to the node's valueChanged and dataChanged signals. The slot only bumps a
shared atomic counter, so it is safe from any writer thread and outlives nothing. It reconnects
when the key resolves to another node or the old node's signal has gone.
@transfix
transfix merged commit 0b92577 into master Nov 16, 2026
29 checks passed
@transfix
transfix deleted the feat/ariadne-ribbon-nodes branch November 16, 2026 06:19
transfix added a commit that referenced this pull request Nov 16, 2026
Conflicts (includes in ariadne.h, ariadne.cpp and ariadne_runtime_test.cpp; three hunks of
#1241's menubar tray in ariadne.cpp) keep both sides. #1241's code meets this branch's groups:

- An action's context keeps master's scope (a quit application's actions stop) and is built by
  this branch's finish_context.
- The notify verbs bind by kind with the backend's (install_backend_verbs is now
  install_host_verbs): host_proxied in an `any` group, as cvc::notify mirrors the feed into
  the app's notify.* subtree raw on the caller's thread.
- What they capture (scope, source, a copy of mount_names) is taken on the host thread when a
  context is made (NotifyScope); a spawned child, made on the thread that pumps its group, binds
  from its parent's copy through its spawn context instead of reading mount_names there.
- quit_app kills the application's actions on current_sched() (the document's group), not
  only on group 0 when this Runtime used it.
- drain_begin runs builtin_event before the handler seam, through this branch's `m`.

Tests: AriadneIsolatedDocs.TheNotifyVerbsRunOnTheFramesThread (the feed is written on the
frame's thread while a worker pumps the program; a spawned child posts as its parent's scope)
and AriadneIsolatedDocs.QuitKillsALoadedDocumentsActionsInItsGroup.
STATE_EXEC_THREADED.md: the notify verbs' row, Quit among the kills that go to the group, and
the spawned child's notify scope.
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