Skip to content

Mp/step3 raylib - #539

Merged
JanuszBedkowski merged 9 commits into
mainfrom
mp/step3_raylib
Sep 24, 2026
Merged

JanuszBedkowski merged 9 commits into
mainfrom
mp/step3_raylib

Conversation

@michalpelka

Copy link
Copy Markdown
Contributor

Port to raylib. Old GLUT code available as _legacy target.

michalpelka and others added 9 commits September 23, 2026 17:52
core_math is compiled once with WITH_GUI=0, but Session's layout depends
on WITH_GUI (GUI builds add ManualPoseGraphLoopClosure, GroundControlPoints
and ControlPoints). NDT::optimize(std::vector<Session>&) in core_math
walked the GUI app's session vector with a 0x1e0 stride instead of 0x250,
reading garbage for sessions[1] and segfaulting in multi_session_registration.

Move that overload to ndt_session.cpp in CORE_BASE_SOURCES so it is built
with the caller's WITH_GUI value; the rest of ndt.cpp stays in core_math
(pose_graph_slam.cpp depends on it). Declare ndt_job in ndt.h for the
split-out file.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
It had been formatted with clang-format 18, whose layout of the std::thread
argument list CI's clang-format 21 rejects. The function body is again
byte-identical to the original in ndt.cpp.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015fZ2YByu6eAyC3Rvi6huo1
Session held ManualPoseGraphLoopClosure + GroundControlPoints + ControlPoints
with WITH_GUI=1 but only PoseGraphLoopClosure with WITH_GUI=0, so core_math
(built WITH_GUI=0) and GUI apps disagreed on sizeof(Session) -- the cause of
the NDT multi-session crash. Data members are now unconditional in all four
classes; only GUI methods stay behind #if. sizeof(Session) is 592 in both.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015fZ2YByu6eAyC3Rvi6huo1
Independent copy of apps/multi_session_registration as it is before the raylib
port, mirroring multi_view_tls_registration_legacy for step 2. Added to the
top-level CMake and to deploy_mandeye.bat's expected binaries.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015fZ2YByu6eAyC3Rvi6huo1
Same approach as step 2: camera/input/picking via raylib_widgets::OrbitCamera
and step 2's helpers, points via core_raylib's ScanRenderer (one per session),
rlImGui + ImGuizmo for the UI. Panels and menus are the GLUT code unchanged
apart from renames. Intentional differences:
- one point size (the loop closure window's value used to override the View
  menu and 1-9 keys every frame)
- View > Points color: session color or step 2's intensity/height/distance
  shader gradients
- index guards in loop closure rendering (GLUT could index with -1)
- drag & drop of .mjp projects and .mjs/.json sessions, like step 2

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015fZ2YByu6eAyC3Rvi6huo1
Session's layout no longer depends on WITH_GUI (09c72a2), so core_math
(WITH_GUI=0) and GUI apps already agree on sizeof(Session) and the split is
not needed. NDT::optimize(std::vector<Session>&) walks sessions with the GUI
apps' 0x250 stride again, and NDT on two forvia sessions solves as before.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015fZ2YByu6eAyC3Rvi6huo1
Each scan's flat render_color shaded by its normalized intensity (sqrt, with a
0.35 floor so dark points keep their hue). Keeps per-session colors apart while
surfaces keep detail. Appended to ScanColorMode, so existing mode values and
step 2 are unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015fZ2YByu6eAyC3Rvi6huo1
Replaces the earlier rewrite. multi_session_registration.cpp is the GLUT file
with only its GL calls changed (~100 lines). New raylib_utils.h/.cpp provide
the names it used from Core/utils.hpp on top of raylib_widgets::OrbitCamera
(the old camera globals are references into it) plus small GL-style helpers
(line strips, 3D text labels) and per-session ScanRenderer drawing.

Also: View > Points color (session color shaded by intensity by default, or
step 2's intensity/height/distance gradients), render downsampling default 2
(GPU buffers; GLUT needed 1000), and session colors red, blue, orange, green,
magenta, cyan, yellow, violet, then a random hue seeded by index.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015fZ2YByu6eAyC3Rvi6huo1
- Drag & drop: *.mjp opens a project; *.mjs/*.json sessions are added and
  loaded right away (appended to already loaded sessions, which keep their
  in-memory state). loadSessions() is split into appendSession() and
  finishLoadingSessions() for this.
- Command line: --mjp <project> and --mjs <session> [...]; bare arguments
  are classified by extension. Added sessions are loaded on startup.
- File menu: "Save project" (Ctrl+S) writes to the opened/last saved project
  file, "Save project as..." (Ctrl+Shift+S) always asks. loadProject() now
  actually sets the window title and resets loaded_sessions (that code was
  unreachable after the return).
- Loop closure: edge list with "Set Active" buttons. setActiveEdge() also
  syncs first/second_session_index and index_loop_closure_source/target
  (which the manipulate-edge view draws) and moves an active edge gizmo,
  which otherwise wrote the previous edge's pose into the new one. Removing
  edge 0 no longer leaves index_active_edge at -1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@JanuszBedkowski
JanuszBedkowski merged commit 3461981 into main Sep 24, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants