Skip to content

volume_grid: its data on the state tree; Ariadne saves through the app (P8 part 3) - #1423

Merged
transfix merged 13 commits into
masterfrom
p8/volume-grid-data
Nov 21, 2026
Merged

transfix merged 13 commits into
masterfrom
p8/volume-grid-data

Conversation

@transfix

Copy link
Copy Markdown
Owner

P8 part 3 (stacked on #1401). After #1401, Joe asked that a component never load data from a file itself: the outer app loads it, the main scene and the grid's views show one copy, and both update when the data change (a filter, say). He added that this holds for every component that views or operates on in-memory data rendered by scene graphs. This PR does it for volume_grid and adds the app-side pieces other node types can reuse. Moving the remaining node types over (volume_slice, volren, and the others that still read source: { file }) is follow-up work.

What changes

The grid reads and writes no file. Its sources are state-tree locations, resolved into grid.source.volume, .points and .session (paths in the document's scope; editing one follows the new path):

  • source: { data: <name>, item }: a dataset of the document's data: block (default item volume).
  • source: { state: <key> }: a volume a program or a filter wrote.
  • source: { node: <id>, key }: another node's, by default its grid.volume.

The planes cut the app's volume itself. cvc::volume is copy-on-write, so the voxels are shared, and grid.volume holds the very pointer the source held. The grid follows the volume when a new one is written at the key, the dataset loads again, or data-load re-points the name. A host with a file too large to load can put a slice_source on the key, which reads it plane by plane. source: { file } or { sdf } now warns and names the data: entry to write instead.

points: and session: take { data } or { state } the same way. The grid publishes grid.session and keeps it current. The file requests are gone: load, save_classes, load_classes, load_points, save_session, load_session.

Ariadne's data layer (core):

  • Decoders: point_classes (.vgr, the default for that extension) and volume_grid_session.
  • Encoders: per app, with register_data_encoder. The built-ins are bytes, volume (any format libcvc writes, by extension), point_classes and volume_grid_session.
  • Saving: data_save and the (data-save PATH FILE [AS]) verb. A local document writes beside itself; a document loaded from a URL writes nothing; in a browser the file downloads under its name.
  • A generator that writes its own outputs and makes no files now runs no decoder.

cvcGL: the sdf data generator, a mesh's signed distance field made as a dataset's volume. The demo and the goldens get their bunny this way. register_cvcgl_extensions registers it.

The component: Save and Load for classes and sessions go through data-save and data-load. The Probe tab's File field and Load button became a Source line, and Add points is gone (.pts needs the volume's frame, so it isn't a plain decoder). The demo gains a Data menu that makes the volume again at 32³ or 64³; the grid follows each new one.

Data that arrives late:

  • Until its first volume, the grid hides its planes and its surfaces group.
  • Its parameter keys take their defaults on the first tick, so bound widgets read real values while the data is loading.
  • The scene reports pending work while a followed dataset loads, so the golden harness waits for it.
  • shown_bounds now skips hidden nodes, so a view frames once its nodes show.

Tests

Local, MSVC Release:

  • cvcgl_volume_grid (79): the volume at a state key with shared voxels; a grid waiting for its volume; source: { node } sharing; following a new volume, an edited key and a non-volume; points and sessions saved through the app and loaded back as datasets; the sdf generator; encoders and generators per app.
  • cvcgl_ariadne_volume_grid (17): two grids on one data: volume, through AriRuntime, the mouse and the views.
  • ariadne_data_test (16): the decoder and encoder round trips, and the errors.
  • ariadne_host_test: (data-save ...) run as a document program.
  • Also passing: ariadne_loader_test, ariadne_runtime_test, ariadne_registries_test, ariadne_world_dataset_test, multi_app_integration_test, volume_grid_test, and the scene-view tests (cvcgl_ariadne_views, scenes, pick, slice_view, swarm, volume_slice).

The wasm-mt build compiles data.cpp, including its EM_JS download hook.

Goldens: volume_grid.png and volume_grid_quad.png change because the panel changed. The new PNGs come from this PR's CI llvmpipe renders, as in #1401. Locally, on the Intel GPU, the views render as before, and the renders are identical from run to run.

Found: in the 3D view, a point disk lying in a plane can lose the depth test to that plane. Which disk shows depends on draw order, which this change shifts: the old golden showed the XY plane's disk and hid the XZ plane's, and the new render does the opposite. The slice views show every disk in both.

Not done here

  • Moving volume_slice, volren and the other node types to the same rule.
  • A data: decoder that reads a local file plane by plane.
  • A .pts decoder.

…ures, sessions (P8 part 1)

The data side of VolumeGridRover (docs/roadmap/VOLROVER-LIBRARY-PORTS-ROADMAP.md
section 4, P8), with no GL in it, in inc/cvc/volume/volume_grid.h:

- the node's parameter tables: volume_grid_params (view, tool, slice.x/y/z),
  volume_grid_display_params, volume_grid_source_params;
- cvc::point_class_editor: mark, toggle (VolumeGridRover's double-click),
  select by point and rubber band, move the selection (cut short at the edge,
  merging), delete, undo, one plane at a time and only the shown variable and
  timestep's classes;
- cvc::point_class_gestures: a slice view's picks (down, drag, up, Shift /
  Ctrl / Alt) turned into those edits as the legacy slice canvases turned
  mouse events: click marks, drag selects, Shift+Ctrl drag moves, navigate
  moves the other planes;
- the class rows a list: binds, reconciled with the classes as rows are
  edited, added and removed;
- sessions: the keys, the transfer function and the classes in one JSON file.

volume_grid_test (ports lane, native and wasm-mt; and SAN_CXX_TESTS) covers
the tables and rows on the tree (T8), the editor and gestures, sessions with
bad and truncated files (T9, T5), and two editors, threads and apps sharing
nothing (T6). pycvc binds all of it (pycvc_volume_grid.i,
test_pycvc_volume_grid.py).
…t 2)

docs/roadmap/VOLROVER-LIBRARY-PORTS-ROADMAP.md section 4, P8, on part 1's core:

- type: volume_grid (cvc::gl::VolumeGridNode, volume_grid_nodes.h): three
  volume_slice planes of one volume, realized as <id>_slice_xy/_xz/_zy and
  tagged with the grid's id and their names, each drawing its points as disks,
  the selection's rings, crosshairs (in the colour of the axis they run along)
  and a rubber band; an empty <id>_surfaces group for P9 and P10. Keys under
  <node>.grid: the parameter tables, the class rows a list: binds, picks run
  as gestures under the tool, the pointer filling the probe, requests (load,
  save / load classes and points, delete_selected, select_all / none, undo,
  step, save / load session), the job keys; grid.points, grid.selection and
  grid.volume on the data channel; <node>.transfer_function colours all three
  planes and follows a load, display.grey draws them grey.
- The viewport writes a pick's keys as the pointer moves (pointer: <key>,
  phase hover; hover: is the loader's), and a pick names its slice's axis.
- slider_int / slider_float range: key: the range is the bound key's min and
  max properties, read each frame.
- volume_slice_nodes.h exposes transfer_function_prop for both node types.
- volume_grid.ari: the volume_grid window, volume_grid_views and
  volume_grid_tools; the legacy XY / XZ / ZY switch layout (the default) and
  quad; the tool and the Probe, Point classes and Transfer function tabs, the
  tab container ending in slot: tabs (P9's Segmentation tab, P10's Contours).
- The demo examples/ariadne/documents/volume_grid.ari and its gallery entry;
  goldens volume_grid.ari and volume_grid_quad.ari (the golden harness reads
  the source tree's components); an arigl-web case that clicks once through
  state writes and waits for the mark.

Tests: cvcgl_volume_grid (headless picks through state writes, requests, rows,
data channel, sessions, two grids in one document; the overlays rendered),
cvcgl_ariadne_volume_grid (the component over two grids, one per layout, with
real mouse events), ariadne_loader_test's VolumeGrid* and SliderRangeFromKey,
ariadne_runtime_test's SliderRangeFromTheKeysProperties.
… golden

The quad layout's 2 x 2 grid was a table with fixed 200 px columns. A table
with no outer size still spans the rest of the window, so in the window's
horizontal flow it pushed the tools panel past the right edge, behind a
scrollbar (CI's llvmpipe render of volume_grid_quad.ari showed it, and so
did the local one). The quad is now two horizontal rows, XY | XZ over
ZY | 3D, each flowing side by side as the switch layout does, so the panel
sits beside the views.

volume_grid.png is CI's llvmpipe render of volume_grid.ari (Windows,
package-windows / libcvc-release); Linux's (libcvc-release-grpc) matches it
to within 1 per channel. volume_grid_quad.png follows from the next run.
volume_grid_quad.png is CI's llvmpipe render of volume_grid_quad.ari at
7efe873 (package-linux / libcvc-release, LLVM 20): the four views in two
rows with the tools panel beside them. volume_grid.png, taken from the
Windows lane, matched this run's Linux render to within 1 per channel.
Conflicts were both sides adding a neighbour: the demo list and entries,
the extensions header comment, the web smoke cases, the cvcGL test
targets and the node-type registrations. Both kept.
…p (P8 part 3)

The volume_grid node reads and writes no file. It shows data the app holds
on the state tree and follows them as they change, so the main scene and the
grid show one volume and both update when it changes.

- Volume: source: { data: <name> } (a data: entry), { state: <key> } or
  { node: <id> }, resolved to grid.source.volume. The planes cut the app's
  volume itself (voxels shared; grid.volume is the very pointer). A new volume
  at the key, a dataset loaded again, or the key edited is followed. A
  slice_source on the key is a host's large file read plane by plane.
  source: { file } / { sdf } warn and name the data: entry to write.
- Points and sessions: points: / session: { data } or { state }, followed into
  grid.source.points / .session; grid.session is published, kept current.
  The load, save_classes, load_classes, load_points, save_session and
  load_session requests are gone.
- Ariadne data layer: point_classes (.vgr) and volume_grid_session decoders;
  per-app encoders (register_data_encoder: bytes, volume, point_classes,
  volume_grid_session); data_save and (data-save PATH FILE [AS]), written
  beside a local document or downloaded in a browser. A generator that writes
  its own outputs and makes no files runs no decoder.
- cvcGL: the sdf data generator (a mesh's signed distance field as a
  dataset's volume), registered by register_cvcgl_extensions.
- The component's Save and Load use data-save / data-load; the File field
  and Add points are gone. Demo, goldens and the web smoke doc load their
  volume and points through data:.
- Until its first volume the grid hides its planes and surfaces group, its
  keys take their defaults on the first tick, and the scene has work pending
  while a followed dataset loads. shown_bounds skips hidden nodes, so a view
  frames once its nodes show.

Tests: cvcgl_volume_grid (79), cvcgl_ariadne_volume_grid (17),
ariadne_data_test (16), the host data-save case, loader, runtime and the
scene-view tests pass locally. The two volume_grid golden PNGs change (the
panel) and follow from CI's llvmpipe renders.
@transfix
transfix changed the base branch from p8/volume-grid-node to master November 21, 2026 06:26
@transfix transfix closed this Nov 21, 2026
@transfix transfix reopened this Nov 21, 2026
… of uri:

The loader has taken `generate:` (with `params:`) in place of `uri:` since
data generators landed, but the schema still required `uri`, so in builds
with json-schema-validator the volume_grid demo's generated bunny drew a
schema warning and AriadneComponents.VolumeGridDemoLoadsClean failed
(windows-2022 Release recipe). The schema now names generate and params and
requires uri or generate. ADataEntryNamesAUriOrAGenerator checks both, and
that an entry naming neither is still flagged.
…id-data

demos.json lists volume_grid_ari and skeleton_lab_ari and arigl_web_smoke.mjs runs both cases, as on #1401. scene_views.cpp: shown_bounds keeps master's subtree entries and counts a hidden node it lets in, with no bounds, so a view waits while a volume_grid's planes wait for their volume.
…raw in a fixed order

The volume_grid goldens rendered one of two images depending on whether the
points or the volume loaded first.

- shown_bounds dropped any box with no volume (bounding_box::isNull), so
  every plane, and took each tagged node's combined box, which counts hidden
  children and an empty group's default box. The grid's 3D view framed the one
  plane whose empty overlay added the origin, plus the surfaces group's unit
  box; which plane that was turned on the load order. It now adds what each
  node draws: its own box when it has extent (a flat plane counts, a point
  does not), its shown descendants, and a NullGraphicNode's own box only when
  it counts it. The 3D view frames all three planes.
- An overlay hidden while empty joined the renderer when it was first shown,
  so a plane's disks drew over its crosshairs or under them by load order. The
  overlays are now set (empty or not) and shown from the first build, in a
  fixed order; the lines win where they cross a disk.

Ten runs of the two goldens render identical pixels (before: one of two
framings, and one of two crossings). The golden PNGs change and follow from
CI's llvmpipe renders. cvcgl_volume_grid, cvcgl_ariadne_volume_grid and the
scene-view tests pass.
The grid told a new payload at a followed key (the volume, points, session)
by the key's lastMod alone. On the Windows runners the clock ticks in
milliseconds, so a payload written right after another left lastMod as it
was and the grid kept the old one: cvcgl_volume_grid's "something that is no
volume is reported" failed there every run (package-windows, a6548fa). The
grid now also compares the payload's type and, for the pointers it reads, the
object pointed at. With lastMod ignored outright, all 79 checks pass locally.
The volume_grid and volume_grid_quad goldens, re-rendered on CI's llvmpipe
(package-linux libcvc-release-grpc at ce54d89) after shown_bounds began
framing on what each node draws. The 3D view now frames all three planes
(before: one plane and the surfaces group's unit box), and a plane's
crosshairs draw over its point disks.

The Linux and Windows renders of both documents agree within the golden
tolerance (none beyond +-40, largest channel difference 22). The two
documents failed identically in all three attempts on both platforms, so
the render no longer turns on load order.
#1401 landed as a squash; this branch already holds its commits (all but
its own merge of master's P2, which 37a7356 repeated here). The tree is
this branch merged with master's fcee28e, the commit before the squash
(clean, docs/ARIADNE.md the only file both touched), so every conflict
with the squash takes this branch's side. Against master the diff is
exactly #1423's own: the same 31 files and lines as against #1401's head.
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