mirror of
https://github.com/DeeJanuz/frametop.git
synced 2026-10-06 04:04:09 +02:00
Pointer helper: one function per main loop section
Structure only, no behaviour change: every frame does the same work in the
same order. main() now sets up and runs a short loop that calls the
sections, each a Pointer member named after its comment:
HeadsetOff, GazeAwake, RelayCommands, ReadFrame, ClaimPulse,
PauseOverlayList, LaserMode, HandRole, LastUsedWins, Recenter, GazeMode,
Hands, GazePrecisionButtons, KeyboardClicks, CalPanelOpened, HeadSteer,
PinchesAndGrips, HandsStopped, MarkHeld, HeadFollow, SlowWork, Cursor,
HeldBackPress, KeyboardClickHold, Click, PollControllerButtons,
SteamVRQuit
- The values the sections share within a frame (the poses, hmdRaw, tnow,
eye, and handOk from PinchesAndGrips for HandsStopped) are in a Frame,
read by ReadFrame at the same point as before. eye moved there from just
after "last used wins"; it only depends on the poses, read once.
Sections open with local aliases (hmd, hm, tnow, eye), so the bodies are
the old code, dedented.
- None of the loop's 43 continues skipped the rest of a frame: 25 were in
the relay's recvfrom loop and 18 in the controller, press, and overlay
scans. The recvfrom loop's body is now Command(), where they're returns.
The quit event's "return 0" is SteamVRQuit() returning true.
- The loop's lambdas are members too: HandAngles, EndHold, StartHold,
Steer, BeginHold, HeadAngles (taking tnow or the HMD pose as a parameter),
and Nearest with its Hit type.
- The cursor section is Cursor(): Tilt() while tilting; otherwise
FindCursor() (collision, drag lock, occlusion; returns a Spot), DrawDot()
(SteamVR Settings, our dot), and SendRay() (the controller pose).
Built with -Wextra -Wshadow too: no warnings. The three shadowing warnings
the old main() had ("from" twice, "now") are gone with the separate scopes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a000725021
commit
7066b591ff
1 file changed
+1264
-1030
+1264
-1030
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user