Repository navigation
cvcgl: add SDL3 dependency (input + peripheral seam foundation) - #440
Conversation
|
Added Verified locally by installing Next (separate, needs the async PR #437's resident machinery): route these InputEvents onto the runtime's per-handler channels so |
Adds SDL3 to cvcGL so it can rely on it for keyboard/mouse/gamepad input (and later audio/microphone/camera), native AND wasm/wasm-mt (verified with VTK). This is the foundation for the §4.6 pointer/input handlers (on_key/on_click/on_drag/…) — a real cross-platform input source, instead of a bespoke Backend key-event API — and for the `.ari` volrover3's later audio/peripheral needs. VR (OpenXR↔WebXR) is future research. - cvcgl recipe: `sdl3` added to depends.build + depends.runtime; cvc_revision 2 -> 3 (the export now links SDL3::SDL3, so a consumer of cvc::cvcGL must have sdl3 in its prefix — a superseding republish). - src/cvcGL/CMakeLists.txt: find_package(SDL3 CONFIG QUIET) behind CVC_ENABLE_SDL (ON), links SDL3::SDL3 + defines CVC_ENABLE_SDL when present; GRACEFULLY ABSENT otherwise (input falls back to the VTK interactor, as today). Mirrors the imgui integration. - cvcGLConfig.cmake.in: @CVCGL_SDL_DEP@ re-finds SDL3 for consumers (find_dependency), like @CVCGL_IMGUI_DEP@. No SDL is CALLED yet — this declares + wires the dependency; the input seam (an SDL-backed Backend feeding the on_* resident handlers) is the next step, built against a real SDL prefix. Verified locally: with no SDL3 in the deps prefix, CVC_ENABLE_SDL is off and cvcGL builds + links unchanged (no regression). The actual SDL3 link is verified by the recipe CI, which installs the declared sdl3 dependency.
Builds on the sdl3 dependency: cvc::gl::SdlInput turns SDL3's OS input events into a
small, SDL-free normalized InputEvent (KeyDown/KeyUp/MouseMove/MouseButton*/MouseWheel with
key/mods/x/y/dx/dy/button/clicks). SDL is confined to SdlInput.cpp — the public header
exposes no SDL types, so a cvcGL consumer needs no SDL headers.
- init() brings up the SDL EVENTS subsystem only (no window/video → headless-safe; a windowed
host that already SDL_Init(VIDEO)'d shares the refcounted subsystem); poll() drains the SDL
queue and returns the translated keyboard/mouse events (other event types left for the host).
- Gated by CVC_ENABLE_SDL: without SDL the source is inert (init() false, poll() empty) and a
host uses the VTK interactor as today. SdlInput.cpp is always compiled (the file glob), SDL
body #ifdef'd — same shape as the imgui integration.
This is the SDL producer for the on_* resident handlers (on_key/on_click/on_drag/on_hover); the
routing of these events onto the Ariadne runtime's per-handler channels is the next step (needs
the resident machinery from the async PR). NB SdlInput.poll() drains the shared SDL queue, so a
host that also lets VTK pump SDL (wasm) will need an event-watch/ownership split — a follow-up.
Verified LOCALLY (sdl3 installed into the deps prefix): +1 test cvcgl_sdl_input pushes synthetic
SDL key/mouse events and confirms the translation ("OK: SDL input translated (3 events)"). The
no-SDL build stays inert. The all-platform SDL link is green in the recipe CI.
1958bab to
9322fd8
Compare
Add SDL3 as a cvcGL dependency — the input + peripheral seam foundation
Wires SDL3 into cvcGL so we can rely on it for keyboard / mouse / gamepad input
(and later audio / microphone / camera), native and wasm/wasm-mt (verified with
VTK). This replaces the earlier plan for a bespoke
Backendkey-event API with a realcross-platform input source, and is the foundation for the §4.6 pointer/input handlers
(
on_key/on_click/on_drag/ …) and the.ariVolRover3's later audio/peripheralneeds. (VR — an OpenXR↔WebXR bridge — is future research.)
What this does (declares + wires the dependency)
cvcpkg/recipes/cvcgl/recipe.yaml):sdl3added todepends.build+depends.runtime;cvc_revision2 → 3 (the export now linksSDL3::SDL3, so a consumer ofcvc::cvcGLmust havesdl3in its prefix — asuperseding republish).
src/cvcGL/CMakeLists.txt:find_package(SDL3 CONFIG QUIET)behindCVC_ENABLE_SDL(ON) — linksSDL3::SDL3+ definesCVC_ENABLE_SDLwhen present;gracefully absent otherwise (input falls back to the VTK interactor, as today).
Mirrors the existing imgui integration exactly.
cvcGLConfig.cmake.in:@CVCGL_SDL_DEP@re-finds SDL3 for downstream consumers(
find_dependency(SDL3)), like@CVCGL_IMGUI_DEP@.Scope
No SDL is called yet — this PR declares + wires the dependency. The input seam (an
SDL-backed
Backendfeeding theon_*resident handlers) is the next step, built againsta real SDL prefix.
Verification
CVC_ENABLE_SDLgracefully off,cvcGLbuilds + linksunchanged (no regression) — confirmed (
cvcGL: SDL3 not found -- input seam falls back to the VTK interactor).sdl3dependency, sofind_package(SDL3)finds itand the
SDL3::SDL3link is exercised on every platform (this is where the actual SDLlink is validated — SDL3 is not in the local dev deps prefix).