Skip to content

Ariadne data: a document's datasets (files, https, cvcpkg packages) loaded into the state tree and drawn - #998

Merged
transfix merged 11 commits into
masterfrom
feat/ariadne-scene-data
Nov 5, 2026
Merged

transfix merged 11 commits into
masterfrom
feat/ariadne-scene-data

Conversation

@transfix

@transfix transfix commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

A document can now name its datasets by URI in a data: block. The host loads each one off the frame thread into one shared place in the state tree, and the scene draws from there. Python hosts read the same objects, so nothing is loaded twice. The motivating case is GRL-SNAM's live demos, which find the Austin bundle on disk themselves, load it into the scene, then read it again for the navigator.

data:
  city:
    uri: cvcpkg://cy-pca/scene-austin-south-small    # or a file, a directory, https://, state://
    path: share/cvc-scenes/austin_south
    as: city_bundle
scene:
  nodes:
    - node: city
      source: { data: city }    # drawn when it is in, redrawn when it changes

The design, with the later phases, is in docs/roadmap/ARIADNE_DATA_ROADMAP.md. The reference for documents is docs/ARIADNE.md §5.17.

What's in it

Archive reader (cvc/utility/archive.h)

  • Reads tar (ustar, pax, GNU long names), plain or compressed with gzip or zstd, and zip (stored and deflate), all from memory.
  • Formats are recognized by their bytes. cvcpkg names every archive .tar.zst, but its data packages are gzip tars.
  • It refuses absolute and .. paths and skips links and devices. File count and unpacked bytes are capped.
  • gzip and deflate are decoded here (RFC 1951/1952), so there is no new zlib link (cvcConfig.cmake.in already has to work around zlib for consumers). zstd is the libzstd libcvc already links.

Store (cvc/ariadne/data.h)

  • Each request lives at data.<key>: its status, progress, error, rev, the source's hash and size, its files (bytes on data()), and what its decoder made.
  • The same request is loaded once.
  • A document's data.<name> is a transparent link to that node. Widget binds and state-get read through it.
  • The store lives as long as the app. When the app's state tree goes, it stops and lets any running load end without writing.

Sources

  • A file or directory, relative to the document.
  • https://, through the host's network policy.
  • cvcpkg://ORG/NAME[@VERSION]:
    • looks up the registry's newest noarch build, or the version given (/v1/packages/NAME/latest?org=…&platform=any&arch=noarch&build_type=none&link=none);
    • downloads the archive, checks it against the registry's size and sha256, and caches it by that hash (CVC_DATA_CACHE, else the user's cache dir).
  • state://, where the host registered that scheme.

Decoders

  • files, bytes, text, json, mesh, volume, heightfield, and city_bundle (a world_geometry, its terrain height_field, its buildings geometry, and the bounds).
  • Hosts can add their own with register_data_decoder.

Scene (source: { data: NAME, item: X })

  • The node is an empty group at load, so nothing waits on a download.
  • tick_scene draws the dataset into it once it is ready, and again whenever its rev changes or the link is re-pointed. What it drew before is removed, bodies included.
  • A world becomes its items' nodes (add_world_geometry). Its terrain becomes the node's height field, so ground: works. With body:, its static bodies go into the scene's physics world.

Verbs: (data-load NAME URI [AS [PATH]]) re-points data.NAME and starts the load. Also (data-reload NAME), (data-status NAME), (data-files NAME) and (data-file NAME PATH).

Python

  • pycvc.data_load, data_wait, data_status, data_files, data_file (bytes).
  • pycvc.data_world, data_height_field and data_geometry. These are the objects the scene draws, sharing their arrays.
  • pycvc.data_allow_network, and AriRuntime.enable_net_allow([...]) (what --net-allow does).

Example: examples/ariadne/documents/austin_data.ari draws the Austin scene from cvcpkg.org. Its two buttons swap the small and full cities from the document alone.

Windows TLS fix: the curl client and WebSocket client now verify against the Windows certificate store (CURLSSLOPT_NATIVE_CA). Without it, a native Windows build reached no https URL at all: libcurl/OpenSSL there has no CA bundle to find. Tests didn't catch this because they use fake HTTP clients.

Tested (Windows, Release, cvcpkg prefix)

New tests

  • ariadne_data_test, 13 tests:
    • tar round trip and long names;
    • gzip and zstd tars;
    • inflate on dynamic and fixed Huffman fixtures from Python's zlib, plus 9 MiB of stored blocks;
    • zip with stored and deflated entries;
    • CRC and size-cap refusals, and unsafe paths;
    • a directory, and an archive's path: with the city and JSON decoders;
    • failures, links and lazy loads;
    • a cvcpkg package through a fake registry: wrong hash refused, then fetched, cached (one download across two runs) and decoded;
    • the loader's data: block.
  • cvcgl_ariadne_data (headless): the city and mesh draw once ready, the terrain body lands in the physics world, and re-pointing the link redraws with the old body gone.
  • pycvc_data.

Existing suites: ariadne_loader_test (215), ariadne_runtime_test, ariadne_host_test, ariadne_requires_test, cvcgl_ariadne_realize, cvcgl_ariadne_physics, pycvc_world_geometry, pycvc_state.

Live against cvcpkg.org

  • pycvc.data_load("cvcpkg://cy-pca/scene-austin-south-small", path=…, decoder="city_bundle") resolved 1.0.0+cvc.2 and downloaded 10,108,265 bytes (sha256 d96b19d7…).
  • It decoded to terrain 200×200 and buildings 978,242 faces, over x and y −1500..1500, in 1.9 s. A second run read the cache (1.2 s).
  • austin_data.ari ran offscreen through pycvc_gl.AriRuntime with enable_net_allow(["https://cvcpkg.org"]). The city node drew city_terrain and city_buildings once the data was in, and the City panel showed the resolved package, ready and 100%.

Not in this PR

  • D2: GRL-SNAM's live demos declaring their city in live.ari and reading it back instead of loading the bundle.
  • D3: other libcvc servers as sources.
  • D4: non-blocking browser downloads, and an IndexedDB cache.
  • In-memory readers. The mesh, volume and city decoders hand their files to the existing path-based readers in a temporary directory.
  • The document cannot yet frame the camera on a dataset when it lands. The offscreen run above framed it from Python.

Since opening

0d7687e: the satellite image, its orientation, and textured shadows

  • Satellite texture: a city's satellite.png is decoded with the bundle and draped over its terrain, north up. UV (0, 0) is the image's bottom-left, cvcGL's convention.
  • Orientation setting: material: { uv: { rotate, flip_u, flip_v, scale, offset } } orients a node's texture in texture space, for both the draped image and material: texture.
  • Texture query: GeometryNode::hasTexture / textureWidth / textureHeight, and in Python has_texture / texture_size.
  • Shadow fix for textured surfaces:
    • The bug: VTK's texture code ran in the shadow bake, after the depth was written, and multiplied the stored 1 + exp(c·depth) by each texel's colour. A textured ground therefore read back nearer the light than itself and shadowed itself, darker where the image is darker. That was the dark band over the Austin city.
    • The fix: the bake now takes only the texture's alpha, so cut-outs still cast nothing where they are clear.
    • Terrain still shadows its own valleys and craters, which a deep crater probe checks. terrain_lab.ari's casts_shadow: false on its ground was a workaround for this bug; only its re-bake cost argument remains.
  • Tests: cvcgl_ariadne_data checks the draped image's UVs and the texture query, and covers the UV transform. The cvcGL shadow suites, cvcgl_texture* and cvcgl_ari_golden pass locally.

a2ed211: a document frames its data; in-memory readers

  • Framing:
    • frame: true | first | always on a source: { data } node frames the main view's camera on what the dataset drew, once or on every redraw.
    • It works through a new camera state request, <camera>.frame = "min_x min_y min_z max_x max_y max_z", which CameraController frames as frameBounds does.
    • austin_data.ari uses it, so the document shows its city with no host code.
  • In-memory readers:
    • cvc::read_model_from_memory (Assimp ReadFileFromMemory), and cvc::world::load_city_bundle(reader, label) over a file reader; the directory form is that loader over the directory's files.
    • The city, heightfield and Assimp-format mesh decoders now read the store's bytes. Only libcvc's own path-based formats (.off, .raw* meshes, volumes) still pass through a temporary file.
  • Tested locally:
    • ariadne_data_test 14 (an .obj decoded from an archive in memory), loader 215, runtime 250;
    • world_geometry_test, world_bundle_test, world_buildings_test and nav_world_planes_test, which cover the directory loader through the reader;
    • cvcgl_camera (the frame request), cvcgl_ariadne_data (a frame of the city's bounds, once), cvcgl_ari_golden, and the shadow and texture suites;
    • austin_data.ari offscreen, framed by the document itself, with buildings.glb read from memory.

A document's data: block names its datasets by URI: a file or directory, https://, a cvcpkg
package (cvcpkg://ORG/NAME[@Version]) or state://. The host loads each off the frame thread into
one shared store at the app root (data.<key>, one node per request), and the document's
data.<name> is a transparent link to it, so widgets, programs, the scene and Python hosts read the
same load.

- cvc/utility/archive.h: tar (plain, gzip, zstd) and zip from memory, recognized by their bytes,
  with safe paths and caps; gzip and deflate decoded here (no zlib link).
- cvc/ariadne/data.h: the store, its sources (cvcpkg: the registry's noarch build, checked against
  its sha256 and cached by it), decoders (files, bytes, text, json, mesh, volume, heightfield,
  city_bundle) and register_data_decoder. It lives as long as the app.
- The loader's data: block and source: { data, item }; AppRuntime binds the block before init:
  and adds (data-load), (data-reload), (data-status), (data-files) and (data-file).
- cvcGL: a data node is an empty group until its dataset is ready; tick_scene (sync_scene_data)
  draws it then and again on each new rev or re-pointed link, a world's terrain as the node's
  height field and, with body:, its static bodies.
- pycvc: data_load, data_wait, data_status, data_files, data_file, data_world,
  data_height_field, data_geometry, data_allow_network; AriRuntime.enable_net_allow.
- examples/ariadne/documents/austin_data.ari draws the Austin scene from cvcpkg.org.
- The curl clients verify TLS against the Windows certificate store: native Windows builds
  reached no https URL before.

Design and later phases: docs/roadmap/ARIADNE_DATA_ROADMAP.md; reference: docs/ARIADNE.md 5.17.
…ured casters' shadows

- The city_bundle decoder decodes satellite.png (in memory, off the frame thread) onto
  data.<key>.satellite, and a source: { data } node drapes it over the terrain it draws: UVs over
  the terrain's extent, north up (UV (0, 0) is the image's bottom-left, GeometryNode's
  convention).
- material: { uv: { rotate, flip_u, flip_v, scale, offset } } orients a node's texture in texture
  space (the draped image and material: texture alike); apply_uv_transform.
- GeometryNode::hasTexture / textureWidth / textureHeight (pycvc_gl: has_texture, texture_size).
- Shadows: a textured caster's bake no longer takes its texture's colour. VTK's texture code ran
  after the bake wrote 1 + exp(c * depth) and multiplied it by each texel's colour, so a
  textured ground read back nearer the light than itself and shadowed itself (a dark band over the
  Austin city, darker where the image is). The texture now only contributes alpha to the bake, so
  cut-outs still cast nothing where clear; terrain still shadows its own valleys and craters.
- A dataset's terrain is drawn opaque (no per-texel alpha scan of its image).
transfix added a commit to CVC-Lab/GRL-SNAM that referenced this pull request Nov 3, 2026
…load (#153)

docs/live.ari names the Austin city in a data: block (libcvc's Ariadne data, transfix/libcvc#998):
the scene-austin-south-small package on cvcpkg.org, downloaded once (later runs read the cache),
unpacked into the state tree and decoded. Its city node draws the terrain, the package's aerial
image draped over it, and the buildings.

- _host: load_document (the store may reach the registry; --bundle / GRL_SNAM_SCENE_BUNDLE point
  data.city at a local bundle instead, nothing downloaded), document_city (the loaded world as a
  City; the installed bundle stands in when the package cannot load), city_file (a package file a
  path-based reader needs: the Humvee), DemoHost.city.
- demos._common: City (sample, bounds, occupancy) and open_city: the host's city when it has one,
  else the installed bundle drawn into the lab as before (loaded once for every occupancy grid);
  world_occupancy, shared with bundle_occupancy.
- austin_freedrive / austin_learned / austin_patrol take their terrain sampler, bounds, occupancy
  and SDF from open_city, so under the live port no bundle file is read twice.
- live: --bundle; headless is refused before the document loads (no download for nothing); the
  planner never loads the city; the Humvee comes from the city's package when it carries one.
…ode from memory

frame: true | first | always on a source: { data } node frames the main view's camera on what its
dataset drew (once, or on every redraw), through a new camera state request: <camera>.frame =
"min_x min_y min_z max_x max_y max_z" makes CameraController frame those bounds as frameBounds
does, so a document shows the city it named with no host code (austin_data.ari does).

In-memory readers, so a decoder no longer writes its files to a temporary directory:
- cvc::read_model_from_memory / can_read_model_from_memory (Assimp's ReadFileFromMemory), the
  model built by the same scene conversion as read_model.
- cvc::world::load_city_bundle(reader, label): a bundle's files from a reader (the data store's
  bytes); the directory form is now that loader over the directory's files.
- The city_bundle and heightfield decoders read the store's bytes; the mesh decoder too for every
  Assimp format. Only libcvc's own path-based formats (.off, .raw* meshes, volumes) still take a
  file, briefly.
…valleys

casts_shadow: false on the world's ground worked around the textured-caster bake bug (a textured
ground shadowed itself everywhere), fixed in 0d7687e. With it gone the ground casts like any other
node; the header comment and docs/ARIADNE.md's fast-render-path example say so.
…data

# Conflicts:
#	src/cvcGL/test/cvcgl_camera.cpp
…st (macOS < 13.3 has no to_chars for doubles)
…data

# Conflicts:
#	src/cvcGL/GeometryNode.cpp
…data

# Conflicts:
#	docs/ARIADNE.md
#	src/cvc/ariadne/loader.cpp
@transfix
transfix merged commit 2a0c6bd into master Nov 5, 2026
27 checks passed
@transfix
transfix deleted the feat/ariadne-scene-data branch November 5, 2026 23:28
transfix added a commit that referenced this pull request Nov 6, 2026
Bumps the project version and every recipe's upstream_version from 3.7.10 to 3.7.11, arix and
ariglx included. The v3.7.11 tag on this commit is the first release with the Python host
(#985) and the Ariadne data store (#998), and the first that publishes arix and ariglx.
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