Repository navigation
cvcGL: CameraController Map mode holds the map pose across update() - #584
Merged
Merged
Conversation
getPose() had no Map branch, so applyToCamera() -- which update() runs whenever
the pose, the camera or the scene moved, and every frame without a scene --
pushed the ORBIT pose onto the map camera. frameMap(100, 200, ...) put the eye
at (100, 200, 1000); one update() later it sat at the default orbit eye,
(4.33, -7.5, 5.0), still in parallel projection. Pans and zooms wrote the
vtkCamera directly and were undone the same way, so the 2-D map in the nav
demos (navdemo::set_ortho_topdown, demo3's 2-D toggle) never held.
Map now has its own pose, like orbit and fly: map.center.{x,y} and map.scale
(the parallel scale), in the state tree and the pose mirror. getPose() returns
it (eye straight above the centre, north up), applyToCamera() applies it with
the parallel projection and scale, and frameMap(), drag-pan, wheel/pinch zoom
and the resize re-fit all move that pose rather than the camera, so update()'s
pose/version change detection from #521 covers Map unchanged (plus the scale).
Mode switches keep each mode's pose: setMode() no longer seeds Orbit/Fly from
a straight-down map camera, so Orbit -> Map -> Orbit returns to the same orbit
and Map -> Orbit -> Map to the same map; leaving Map turns the parallel
projection Map turned on back off (what demo3's setMode(Orbit) "ensure
perspective" assumed); Track entered from Map eases in from the orbit view.
Also fixed on the way:
* readAllFromState() read mode 3 back as Orbit, so any outside state write
while in Map -- a Camera-menu slider -- dropped out of the map;
* the Map drag panned the view WITH the pointer vertically (only x was
negated; VTK display y grows upward), so the grabbed point did not stay
under it as documented;
* frameBounds() in Map re-applied the orbit pose; it now also seeds the map
pose with the box's x/y footprint.
Tests: cvcgl_camera_map (new) pins frameMap + update(), pan/zoom, the
Orbit/Fly/Track <-> Map switches, the state round-trip, the Map idle path with
a scene, and the resize re-fit (skipped when the renderer reports no size).
test_pycvc_gl_camera gains a headless Map section.
transfix
added a commit
that referenced
this pull request
Oct 9, 2026
Patch release carrying the fixes since 3.5.0: the cvcGL M_PI build fix (#582), CameraController Map mode holding its pose (#584), the tag-release / publish workflow fixes (#585, #586), macro-safe public headers after <signal.h> / <sys/param.h> (#588), and the X11 `None` renames (#589: ariadne::BorderShow::None -> Off, gl::Switch::None -> Off). Bumps project(VERSION) 3.5.0 -> 3.5.1 and every cvcpkg recipe's upstream_version to match (cvc_revision stays 1, per the recipe-version gate).
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.
The bug
In Map mode,
update()re-applied the orbit pose. AfterframeMap(100, 200, ...)the camera sat at(100, 200, 1000). Oneupdate()later it was at the default orbit eye,(4.33, -7.5, 5.0), still in parallel projection.getPose()had no Map branch, soapplyToCamera()fell through to the orbit pose.update()runsapplyToCamera()whenever the pose, the camera or the scene moves, and on every frame when there's no scene. Map pan and zoom wrote thevtkCameradirectly, so the next apply undid them too. As a result, the 2-D map in the nav demos (navdemo::set_ortho_topdown, demo3's "2-D map" toggle in cvcdbg) never held. Found onperf/cvcgl-frame-costs(#521), which kept this behaviour as it was.The contract, and the fix
The contract comes from the header, the commit that added Map mode, and its callers: a 2-D map with a parallel projection looking straight down, north up. Drag pans with the grabbed point staying under the pointer, the wheel zooms the parallel scale, and rotation is unreachable (Tab can't leave Map).
map.center.{x,y}plusmap.scale(the parallel scale). Both live in the state tree and in the pose mirror.getPose()returns this pose: the eye straight above the centre, view-up +y.applyToCamera()applies it along withParallelProjectionOnand the scale.frameMap(), drag-pan, wheel/pinch zoom (includingdolly()) and the resize re-fit now move the map pose instead of the camera. That means cvcGL: frame-cost fixes (idle camera, caster-aware bakes, partial texture uploads, metadata mirror, bounds walk) + reship cvc.15 #521's pose/version change detection inupdate()covers Map unchanged. The only addition is a scale comparison inapplyNeeded(), so idle Map frames still cost nothing.setMode()no longer seeds Orbit or Fly from a straight-down map camera, which has no heading to carry over. So Orbit → Map → Orbit returns to the same orbit view, and Map → Orbit → Map to the same map. Fly works the same way.setMode(Orbit); // ensure perspective (ParallelProjectionOff)already assumed this; before this PR it wasn't true. A host's own parallel camera in Orbit is left alone.Also fixed on the way
readAllFromState()readmode = 3back as Orbit. Any outside state write while in Map (for example a Camera-menu slider writingsettings.*) dropped the view out of the map."mode" = 3from state now enters Map, which is what the UI-DSL roadmap'scamera: { mode: map }needs.mouseLook()takes VTK display deltas, where y grows upward;TouchGesturesflips DOM y to match, and the orbit pan negates both axes. So a vertical drag moved the map with the pointer instead of keeping the grabbed point under it. Nobody could see this, becauseupdate()snapped the camera back every frame.frameBounds()in Map re-applied the orbit pose. It now also seeds the map pose with the box's x/y footprint, fitted likeframeMap()with a width. This also gives Map a sensible pose before the firstframeMap().Tests
cvcgl_camera_map(new, headless) covers:frameMapfollowed byupdate()keeps the map pose over many frames.map.*mirror.mode3/0 enter and leave it,map.*moves it, andframeBounds()frames the footprint while in Map.test_pycvc_gl_camera.pysection H: the same contract throughpycvc_gl(frameMap,Mode_Map,get_pose(),state_setofmodeandsettings.*), headless.Verification
The dev box has no VTK, Boost, gtest or GPU, so CI is the build and test gate for this PR. Locally I compiled the real
CameraController.cppand the real test sources against small stand-in VTK,cvc::stateand scene headers (written for this check, not committed):cvcgl_camera_map: 0/54 failures with the fix, 40 failures on master. The first master failure is the reportedgot (4.330, -7.500, 5.000).cvcgl_camera(43 checks) andcvcgl_track_paritygive identical, all-passing results on master and on this branch.cvcgl_camera_idlewas not run locally (too much of the scene graph to stub); CI runs it.Not changed
setUpAxis(). The header now says so instead of "down the up axis". Making Map follow the up axis would be a separate change.kMapEyeHeight). Content above that height is clipped, same as today.volrover3::CameraControllerand doesn't use cvcGL's Map mode. The only callers are the nav demos here and in cvcdbg. Their existing calls (frameMap,setMode(Orbit)followed byframeBounds) need no changes.