mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +00:00
ifcviewer: first-person / fly view — share the desktop fly camera with web
DRY the fly camera into ViewportCore so desktop and web share identical math: - flyMove(fwd,back,right,left,up,down,boost,dt): WASD in the view plane, QE along world +Z, forward = eye→target (no snap after orbiting), Shift = 5x, dt clamped to 0.1s. flyLook(dx,dy): turn in place (yaw/pitch, eye pinned, 0.2 deg/px, pitch ±89.9). flyAdjustSpeed(notches): wheel scales speed x1.25. fly_move_speed_ + orbitEye now live in the core (orbitEye's duplicate removed from ViewportWindow). - Desktop ViewportWindow: fpsIntegrate / mouse-look / wheel-speed call the core methods; behaviour unchanged, BonsaiViewer builds clean. - Web main_web: Shift+F (or the Fly toolbar button) enters and pointer-locks the canvas; W/A/S/D/Q/E + Shift are held-tracked (keydown/keyup) and integrated each RAF frame with wall-clock dt; pointer-lock mouse deltas drive flyLook; wheel tunes speed. Exit on Esc OR a canvas click (matches desktop) — a pointerlockchange handler catches the browser eating the first Esc to release the lock (so a single Esc exits), guarded by fly_locked so a denied lock on entry doesn't insta-exit. Fly button reflects/ syncs active state. Verified: web enter→WASD moves→click/Esc exits, 0 GPU errors; 113/113 desktop core + 6/6 web smoke; desktop app builds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -779,12 +779,8 @@ private:
|
||||
Stopwatch fps_last_tick_;
|
||||
Eigen::Vector2i fps_press_center_;
|
||||
bool fps_ignore_next_mouse_move_ = false;
|
||||
// Fly base speed in m/s at no-modifier (Shift gives a 5× boost). Default
|
||||
// 5.0 matches GL fps_move_speed_. Scrollwheel in fly mode adjusts this
|
||||
// by ×1.25 / ×0.8 per notch, Blender-style — wheel does NOT zoom while
|
||||
// in fly mode (which would change camera_distance_ underneath us and
|
||||
// make speed jitter if speed were distance-scaled).
|
||||
float fps_move_speed_ = 5.0f;
|
||||
// Fly base speed (m/s) + wheel adjustment now live in ViewportCore
|
||||
// (fly_move_speed_ / flyAdjustSpeed), shared with the web fly path.
|
||||
// Per-frame [fly] dt log when WGPU_FLY_DEBUG=1. Diagnoses stutter:
|
||||
// print dt of each fpsIntegrate call and the prior render's elapsed
|
||||
// ms. Off by default (env-gated) so the normal log stays clean.
|
||||
|
||||
Reference in New Issue
Block a user