Repository navigation
cvcGL: ViewportManager input router — one interactor, N cameras - #387
Merged
Merged
Conversation
The picture-in-picture input problem: one window, one interactor, N per-viewport
CameraControllers (each built detached — never attach()). A file-local interactor
STYLE (priority 0.0, never SetDefaultRenderer, so it coexists with the
ImGuiOverlay/FpsHud priority-1.0 observers) forwards events to PUBLIC,
interactor-free route*() methods on ViewportManager that do the picking and
dispatch — and are therefore unit-testable offscreen with synthetic coordinates,
no live interactor.
* viewportAt(x,y): the topmost visible, input-enabled viewport whose renderer
contains the display pixel (descending layer, later-added wins on a tie);
null over the gutter. Layer-/visibility-aware and null-on-miss, unlike VTK's
FindPokedRenderer (which ignores SetLayer/SetDraw and falls back to primary).
* routeMouseButton/Move/Wheel/Key: mouse + wheel go to the viewport under the
cursor; a drag is LATCHED to its origin viewport for the whole gesture (so it
keeps steering even past the viewport edge); keyboard goes to the ACTIVE
viewport (last clicked), stored in cvc::state at "<prefix>.active_viewport".
* updateCameras(dt): ticks EVERY viewport's controller each frame (held-key fly
motion, Track smoothing, Map refit, pose mirroring) — render() does not, for
parity with SceneRenderer's host-driven loop.
* Viewport::setInputEnabled: a minimap/HUD inset can opt out of input so clicks
fall through to what is beneath it (the DBG minimap is non-interactive).
CameraController collapses orbit-drag and pan onto one internal flag, so the
router owns a single gesture derived from the held-button mask (Middle=pan wins
over Left=orbit) and re-issues it on every transition — releasing one button of
an overlapping chord no longer freezes the survivor. Each viewport's detached
controller is given the render window (setRenderWindow — NOT attach()) so pan
scaling reads a real size and Fly pointer capture works; and the pan math now
scales by the VIEWPORT's pixel height (the renderer's), not the whole window's,
so a PiP inset pans at the correct rate.
New cvcgl_viewport_input test (offscreen, headless): viewportAt layer/visibility/
inputEnabled/gutter, focus-follows-click -> state, keyboard-to-active (both
viewports in Fly so a broadcast would show), drag-latch across the boundary,
wheel-to-hovered, middle-pan magnitude (guards the render-window wiring),
Left+Middle overlap (guards the shared-flag fix), Escape releases capture,
held-key release on focus-out, and single-view no-regression. Full cvcgl suite
(29 tests) green locally. Design and the four fixed defects came out of a
parallel-agent design pass and an adversarial review.
This was referenced Sep 21, 2026
transfix
added a commit
that referenced
this pull request
Sep 21, 2026
…p analysis (#389) Concrete defects a gap-analysis pass found in the merged PiP stack (#384/#386/ #387), fixed before the minimap demo exercises them: * Mirror double-drew 2-D overlays: syncMirrorProps copied EVERY prop, so a mirror of a scene with FpsHud/ScreenTextHud drew the HUD a second time on the inset. It now skips vtkActor2D (a window-space overlay, not scene geometry) — matching the shipping wasm PiP. * Mirror rendered flat: syncMirrorProps copied view props but not lights, so a mirror of a StageLighting-rigged scene lost its lighting. It now copies the source's lights (world-space, correct from the mirror's own camera); with none, the mirror falls back to VTK's automatic headlight. * MB::Right was not the no-op the header claims: its button-down latched a drag target and called setActiveViewport, so a right-click silently stole keyboard focus and released the prior viewport's held keys. routeMouseButton now returns immediately for Right. * CameraController::viewportAspect preferred the WINDOW size over the renderer's for the Map/ortho fit, so a PiP inset in Map mode framed to the wrong aspect; it now prefers the viewport (renderer) size, matching the pan scaling, and falls back to the window before the first frame. * Fixed the stale "addMirrorViewport, a follow-up" comment (it shipped in #386). Tests: cvcgl_viewport gains a check that a 2-D actor on the source does NOT reach the mirror while a source light DOES; cvcgl_viewport_input gains a Right-button no-op check (no focus steal, no camera motion). Full cvcgl suite (29) green locally.
transfix
added a commit
that referenced
this pull request
Sep 21, 2026
…ython (#390) Closes the largest gap the PiP work left: the whole ViewportManager/Viewport/ input-router surface (cvcGL #384/#386/#387) was C++-only, so volrover3 and grl-snam — both Python — could not build multi-viewport or minimap layouts. This wraps it, so the Python API mirrors C++: vm = pycvc_gl.ViewportManager(scene, 1024, 768, False, "main") inset = vm.addSceneViewport("inset", scene2, (0.62, 0.05, 0.97, 0.42), 1) mini = vm.addMirrorViewport("mini", "main", (0.62, 0.58, 0.97, 0.95), 2) inset.camera().setMode(pycvc_gl.CameraController.Mode_Fly) # per-viewport vm.routeMouseButton(pycvc_gl.ViewportManager.MouseButton_Left, True, x, y) vp = vm.viewportAt(x, y) # None over the gutter frame = vm.frameRGB() # bytes Binding details, following the existing pycvc_gl patterns: * frameRGB() -> bytes (a scoped typemap, like SceneRenderer's — the SceneRenderer one does not apply to ViewportManager). * region as a Python 4-sequence in (addSceneViewport/addMirrorViewport) and a 4-tuple out (Viewport.region()), via in/argout typemaps. * Viewport has a private ctor -> %nodefaultctor; it is only ever handed out by the manager. renderer()/renderWindow()/mirrorSource() reuse the existing vtkRenderer*/vtkRenderWindow* -> live vtkmodules typemaps. * KEEPALIVE chain mirrors C++ ownership so a live child pins its parent: the manager keeps its scene(s); every handed-out Viewport (primary/viewport/ viewportAt/activeViewport/add*Viewport) keeps the manager; a Viewport's camera() keeps the Viewport. * MouseButton enum -> ViewportManager.MouseButton_Left/Middle/Right. New test_pycvc_gl_viewport.py exercises the surface end to end: auto primary, addSceneViewport over a second scene + addMirrorViewport, viewportAt (layer/ visibility/inputEnabled/gutter), focus-follows-click into cvc::state, the per-viewport camera (its state under the viewer tree), region tuples, and frameRGB bytes — self-skipping without a GL driver, hard-exiting past cvcGL's static-teardown race like the other pycvc_gl tests. Validated locally by SWIG generation (all 24 ViewportManager + 15 Viewport methods, the MouseButton enum, and both typemaps wrap cleanly); the compiled .pyd + this test run in the cvcpkg pycvc-gl recipe, which builds against the python-enabled VTK the module needs.
transfix
added a commit
that referenced
this pull request
Oct 19, 2026
#716) * wasm-mt SDK: the real Ariadne .ari loader and FTXUI backend, not stubs The published wasm-mt libcvc (publish-cvcgl-wasm.yml) never installed yaml-cpp or ftxui into its deps, so its .ari loader and terminal backend compiled to stubs. A downstream wasm app could not load a .ari document at all. Both are now published for wasm-mt (cy-pca/cvcpkg#378 ftxui, #387 yaml-cpp). - publish-cvcgl-wasm.yml installs yaml-cpp and ftxui for wasm-mt with the rest of the closure, and fails the build if the installed cvcConfig.cmake does not name them. That is the same check it already makes for Jolt, and a configure that misses them silently compiles the stubs. - It also configures with CVC_BUILD_ARI=OFF. The job builds only cvc and cvcGL, then runs `cmake --install`. With `ari` on (the default since #708), that install fails on the missing bin/ari.js, so the next tag's wasm publish would have broken. The browser ari page ships with the gh-pages gallery. - recipes/libcvc: yaml-cpp and ftxui are declared for wasm-mt too. A static libcvc's cvcConfig.cmake runs find_dependency on them, so a consumer's install must bring them. No cvc_revision bump: no 3.6.0 wasm-mt bundle exists (the v3.6.0 wasm publish was refused over the xmlrpc globs, since fixed on master), so the next wasm-mt publish is a fresh bundle. Native bundles are unchanged. Verified locally (emsdk 5.0.7, wasm-mt deps from the catalog, threaded build of the cvc target): - The configure prints "Ariadne: .ari YAML loader ENABLED" and "FTXUI terminal backend ENABLED". - cmake --install succeeds with CVC_BUILD_ARI=OFF (it fails with it on). - The installed cvcConfig.cmake lists yaml-cpp;ftxui;Jolt and names no build-machine path. - A consumer project finds all three through find_package(cvc), links a -pthread module, and under node reports have_yaml=1 and ftxui=1. - The recipe validates against cy-pca/cvcpkg master's recipe set. * publish-cvcgl-wasm: install the gallery's data packages by their real tuple (platform any, x86_64, shared) The cvcgl-examples step installed scene-austin-south-small, grl-snam-weights and vehicle-humvee with --platform wasm-mt. They are published as platform any, link shared, and the scene and vehicle bundles as arch x86_64 (not noarch), so that matched no bundle. The dry run of this branch (run 39214815368) failed there with 'Austin scene not staged for preload', after the libcvc + cvcgl pack had passed. Locally, --platform any --arch x86_64 --config release --link shared installs all three, including the noarch weights. * cvcgl-examples: scope the native bin/ entries to linux/windows (the wasm-mt pack refused them) With the data-package install fixed, the dry run (run 39217076353) built the wasm-mt gallery (terrain_lab, nav_city_swarm, nav_city_drive, nav_fog_ghost) and then failed cvcpkg's strict-glob check. package.files declared bin/lsystem_forest, bin/nav_city_*, bin/nav_fog_ghost, bin/nav_finale and bin/cvcgl-examples-web on every platform, and the wasm-mt column ships only share/cvcgl-examples/web. They are now platforms-scoped to linux and windows, like the nav CLIs already were. Native bundles are unchanged, and no 3.6.0 wasm-mt bundle exists, so there is no revision bump.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cvcGL: ViewportManager input router — one interactor, N cameras
Third piece of the picture-in-picture work, on top of the merged core (#384) and
mirror viewports (#386). Solves the input half: one window, one interactor, N
per-viewport
CameraControllers (each built detached — neverattach()).Approach
A file-local interactor style (priority 0.0, never
SetDefaultRenderer, soit coexists with the
ImGuiOverlay/FpsHudpriority-1.0 observers) forwardsevents to public, interactor-free
route*()methods onViewportManagerthat do the picking and dispatch — so all the routing logic is unit-testable
offscreen with synthetic coordinates, no live interactor.
viewportAt(x,y)— the topmost visible, input-enabled viewport whoserenderer contains the display pixel (descending layer, later-added wins on a
tie);
nullptrover the gutter. Layer-/visibility-aware and null-on-miss,unlike VTK's
FindPokedRenderer(ignoresSetLayer/SetDraw, falls back toprimary).
routeMouseButton/routeMouseMove/routeMouseWheel/routeKey—mouse + wheel go to the viewport under the cursor; a drag is latched to its
origin viewport for the whole gesture (keeps steering past the viewport edge);
keyboard goes to the active viewport (last clicked), stored in
cvc::stateat
"<prefix>.active_viewport".updateCameras(dt)— ticks every viewport's controller each frame (held-keyfly motion, Track smoothing, Map refit, pose mirroring).
render()doesn't, forparity with
SceneRenderer's host-driven loop.Viewport::setInputEnabled— a minimap/HUD inset opts out so clicks fallthrough to what's beneath (a minimap is non-interactive by design).
Correctness (from an adversarial review pass)
CameraControllercollapses orbit-drag andpan onto one internal flag, so the router owns the gesture derived from the
held-button mask (Middle=pan wins over Left=orbit) and re-issues it on every
transition — releasing one button of an overlapping chord no longer freezes the
survivor.
setRenderWindow, notattach()) so pan scaling reads a real size and Fly pointer capture works; andthe pan math now scales by the viewport's pixel height (the renderer's), not
the whole window's, so a PiP inset pans at the correct rate.
Tests
New
cvcgl_viewport_input(offscreen, headless CI):viewportAtlayer/visibility/inputEnabled/gutter; focus-follows-click → state;
keyboard-to-active (both viewports in Fly so a broadcast would be visible);
drag-latch across the boundary; wheel-to-hovered; middle-pan magnitude (guards
the render-window wiring); Left+Middle overlap (guards the shared-flag fix);
Escape releases capture; held-key release on focus-out; single-view
no-regression. Full
cvcglsuite (29 tests) green locally on Windows/MSVC.Follow-ups
State layout (persist region/layer/visible alongside
active_viewport),SceneRenderer→ thin facade over a one-viewport manager, promote the nav-cityminimap demo, and the SWIG bindings + Python
ChaseCamerashim. Also noted: X11pointer-capture recenter across N viewports, and right-button/multitouch, remain
out of scope here.