Skip to content

Port step 1 and the raw data viewer to raylib - #576

Merged
JanuszBedkowski merged 3 commits into
mainfrom
mp/step1-raw-viewer-raylib
Oct 23, 2026
Merged

JanuszBedkowski merged 3 commits into
mainfrom
mp/step1-raw-viewer-raylib

Conversation

@michalpelka

Copy link
Copy Markdown
Contributor

Summary

lidar_odometry_step_1 and mandeye_raw_data_viewer now run on raylib + rlImGui instead of GLUT + legacy OpenGL. The GLUT builds stay available as lidar_odometry_step_1_legacy and mandeye_raw_data_viewer_legacy, as was done for step 2 and step 3.

Port (8203aac)

  • Shared drawing helpers: step 3's raylib replacement for <Core/utils.hpp> moves into a shared core_raylib_utils library (Core/raylib_utils.hpp). The ported apps keep their code; only their GL calls change.
  • New in the shared module:
    • a per-vertex-colour point batch, since rlgl has no GL_POINTS
    • draw_ellipse
    • an ortho-aware reshape
    • intensity shading that matches ScanRenderer's FlatIntensity mode
    • dropped-file handling
    • Windows taskbar progress, in its own source file because windows.h clashes with raylib.h
  • Drag & drop:
    • step 1: dropping a data folder starts processing
    • raw viewer: dropped folders and files load
  • Intensity shading is on by default, with a View menu toggle.
  • implot_raylib builds ImPlot for the raw viewer's IMU plots.
  • Wide lines are drawn 1 px wide (the OpenGL core profile doesn't support other widths).

Step 1 follow-ups (fb04077)

  • Safe quit during a run:
    • Closing the window while odometry runs asks "Quit anyway?".
    • On Yes, the run is paused. Once step 2 stops at its pause point (new parked flag on compute_step_2) or finishes, the cache is removed and the process exits with std::_Exit. This keeps the detached worker from crashing in global destructors or reading a deleted cache.
    • mainLoop() takes an optional close_requested callback. The close is cancelled through GLFW's own window handle (glfwGetCurrentContext). raylib's GetWindowHandle() returns the native NSWindow* / HWND, and writing the flag through it corrupts memory.
  • Loading modal: opening data (drag & drop, Ctrl+O, menu) first shows a "Loading data" modal, then runs the blocking step 1. Drops and Ctrl+O are ignored while a load is pending or a run is in progress.
  • Bucket intensity:
    • NDT::Bucket keeps a running mean intensity. It is display only, so odometry results are unchanged, and it fits in existing padding, so the struct size is unchanged.
    • Reference buckets are shaded by intensity under the "Intensity shading" toggle.
    • Indoor buckets are shown by default.

Testing

  • The full release build passes on macOS. clang-format 21 was applied.
  • The quit-during-run crash on macOS (from writing through GetWindowHandle()) is fixed in this branch. The quit flow hasn't been re-run since that fix.
  • Not yet tested on Windows or Linux.

🤖 Generated with Claude Code

michalpelka and others added 2 commits October 22, 2026 13:30
lidar_odometry_step_1 and mandeye_raw_data_viewer now run on raylib +
rlImGui instead of GLUT + legacy OpenGL. The GLUT builds are kept as
lidar_odometry_step_1_legacy and mandeye_raw_data_viewer_legacy, like
step 2 and step 3.

Step 3's raylib replacement for <Core/utils.hpp> (same names, camera in
raylib_widgets::OrbitCamera) moves into a shared core_raylib_utils library
(Core/raylib_utils.hpp), so the ported apps keep their code and only their
GL calls change. Step 3 keeps only its session-rendering helpers. New in
the shared module: a per-vertex-color point batch (rlgl has no GL_POINTS),
draw_ellipse, an ortho-aware reshape, intensity shading matching
ScanRenderer's FlatIntensity mode, dropped-file handling, and the Windows
taskbar progress (own TU, windows.h clashes with raylib.h).

Both apps accept drag and drop (step 1: a data folder starts processing;
raw viewer: folders/files load) and shade points by intensity (View menu
toggle, on by default). implot_raylib builds ImPlot against imgui_raylib
for the raw viewer's IMU plots. Wide lines are drawn 1 px (core profile).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UXL9MhpTVJ1uyhtztVmAoK
- Closing the window while odometry runs asks "Quit anyway?". On yes the
  run is paused; once step 2 is parked at its pause point (new `parked`
  flag on compute_step_2) or has finished, the cache is removed and the
  process ends with std::_Exit, so the detached worker can't crash in the
  global destructors or read a deleted cache. mainLoop() takes an optional
  close_requested callback; the close is cancelled through GLFW's own
  window (glfwGetCurrentContext), not raylib's native GetWindowHandle().
- Opening data (drag & drop, Ctrl+O, menu) first presents a "Loading
  data" modal, then runs the blocking step 1; drops and Ctrl+O are
  ignored while a load is pending or a run is in progress.
- NDT::Bucket keeps a running mean intensity (display only, fits in
  existing padding); reference buckets are intensity-shaded with the
  "Intensity shading" toggle, and indoor buckets are shown by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michalpelka
michalpelka marked this pull request as draft October 22, 2026 15:01
@michalpelka

Copy link
Copy Markdown
Contributor Author

I need to test it on Windows :painful:

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michalpelka

michalpelka commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Done, works on Mac and Windows. Will probably work on Linux.

@michalpelka
michalpelka marked this pull request as ready for review October 22, 2026 22:42
@JanuszBedkowski
JanuszBedkowski merged commit fffc2ed into main Oct 23, 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