Skip to content

cvcGL: a 3D scene in the terminal — TerminalScene over the terminal backends - #712

Merged
transfix merged 1 commit into
masterfrom
feat/ariadne-terminal-gl
Oct 19, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/ariadne-terminal-gl

Conversation

@transfix

@transfix transfix commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

A 3D scene in the terminal (roadmap §16.6), built as a cvcGL extension of the terminal backends: the libcvc backends stay GL-free and cvcGL plugs a real renderer into them. It builds on the terminal backends merged in #708, #709 and #711.

What it does

cvc::gl::ariadne::TerminalScene is a cvc::ariadne::SceneAdapter. Hand it to AppRuntime and the document's scene: goes through four steps:

  1. It is realized into the adapter's own SceneGraph.
  2. An offscreen SceneRenderer draws it. There is no window and no display needed: VTK picks X, EGL or OSMesa at run time.
  3. Every tick renders a frame at the terminal's half-block grid (two pixels per cell, 2× supersampled).
  4. The frame is published to the backend and drawn as its background. Widgets, menus and windows draw on top, the way ImGui draws over the GL canvas.

Background drags orbit the camera, middle-drags pan, and the wheel zooms. Anything else still goes to the document's on_key / on_pointer.

The generic hooks it needs in the base backend (libcvc, GL-free)

  • FtxuiBackend::set_background(image) draws a published image behind everything, stretched over the screen. In hosted mode (tvision) it is the desktop background.
    • Publishing a new frame under the same name invalidates the resampled copy, which was a bug the first version of this PR had.
  • screen_width() / screen_height().
  • RunOptions::background_input receives input no widget used, before the document does, and returns true to take it. Both the FTXUI and the tvision loops call it.
  • A click on empty background is no longer reported as consumed, so it reaches that hook (and the document's on_pointer).

Host and example

  • ariadne_terminal (src/cvcGL/examples) is the terminal sibling of ariadne_hello:
    • ariadne_terminal doc.ari [--backend tvision];
    • --snapshot [--ansi] [--png] for headless capture.
  • terminal_scene.ari: the embedded Stanford bunny with a Scene window whose checkbox drives the node's visible: binding.

Verification

  • cvcgl_terminal_scene (new cvcGL test), offscreen box scene:
    • the backdrop is a rendered (non-flat) image under the widgets;
    • press / move / release on the background turn the camera, and the next frame differs;
    • keys are left for the document;
    • passes on Mesa EGL, NVIDIA EGL, and a plain environment.
  • ariadne_ftxui_test 42/42, including the backdrop, the background-click and the frame-invalidation cases.
  • By hand, with DISPLAY unset (EGL), in tmux:
    • FTXUI: the bunny renders behind the Scene window; a background drag orbits; the wheel zooms; the checkbox hides the bunny; Ctrl-C exits 0;
    • tvision: the native Scene window sits over the rendered desktop; a desktop drag orbits; Alt-X exits 0.
  • The offscreen frame from ariadne_terminal --png matches ariadne_hello --png of the same document pixel for pixel, so the adapter realizes and frames exactly like the GL host.

Not in this PR

  • Sixel / Kitty graphics; frames are half-blocks only.
  • The §16.6 golden-image harness for the ImGui backend.

@transfix
transfix force-pushed the feat/ariadne-tvision-backend branch from d004cfd to 98e2372 Compare October 19, 2026 05:09
@transfix
transfix force-pushed the feat/ariadne-terminal-gl branch from f626d6c to d15800e Compare October 19, 2026 05:09
@transfix
transfix force-pushed the feat/ariadne-tvision-backend branch from 98e2372 to 74b1bc9 Compare October 19, 2026 06:15
@transfix
transfix force-pushed the feat/ariadne-terminal-gl branch from d15800e to 141c887 Compare October 19, 2026 06:15
@transfix
transfix force-pushed the feat/ariadne-tvision-backend branch from 74b1bc9 to b553c5f Compare October 19, 2026 06:29
@transfix
transfix force-pushed the feat/ariadne-terminal-gl branch from 141c887 to b2b6837 Compare October 19, 2026 06:29
@transfix
transfix force-pushed the feat/ariadne-tvision-backend branch from b553c5f to fa2e152 Compare October 19, 2026 16:05
@transfix
transfix force-pushed the feat/ariadne-terminal-gl branch from b2b6837 to c098f34 Compare October 19, 2026 16:05
@transfix
transfix changed the base branch from feat/ariadne-tvision-backend to master October 19, 2026 17:31
…ackends

The terminal backends stay GL-free in libcvc; cvcGL extends them (roadmap
§16.6). cvc::gl::ariadne::TerminalScene is a SceneAdapter: it realizes the
document's scene: into its own SceneGraph, renders it with an OFFSCREEN
SceneRenderer (X / EGL / OSMesa, no display) at the terminal's half-block grid
(two pixels a cell, 2x supersampled) every tick, and hands the frame to the
backend as its background, so widgets, menus and windows draw over the scene
as ImGui draws over the GL canvas. handle_input (as
RunOptions::background_input) turns background drags into orbit, middle-drags
into pan and the wheel into zoom.

Generic hooks in the base backend for it: FtxuiBackend::set_background (a
published image behind everything; the desktop in hosted / tvision mode, and a
new frame under the same name invalidates the resampled copy),
screen_width / screen_height, and RunOptions::background_input (input no
widget used, offered before the document; both the FTXUI and tvision loops call
it). A click on empty background is no longer reported as consumed.

Host: ariadne_terminal (the terminal sibling of ariadne_hello, with
--backend tvision and --snapshot [--ansi] [--png]); example
terminal_scene.ari. Test: cvcgl_terminal_scene.
@transfix
transfix force-pushed the feat/ariadne-terminal-gl branch from c098f34 to ee43e8b Compare October 19, 2026 17:32
@transfix
transfix merged commit 381cadc into master Oct 19, 2026
14 of 19 checks passed
@transfix
transfix deleted the feat/ariadne-terminal-gl branch October 29, 2026 20:52
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