Skip to content

feat: Integrating navigation 3d controller changes - #41

Merged
ajeetsinghyadav merged 9 commits into
mainfrom
VNE_TESTBED_INTERACTION_FIXING_OBJECT_MOUSE_SYNC
Apr 3, 2026
Merged

ajeetsinghyadav merged 9 commits into
mainfrom
VNE_TESTBED_INTERACTION_FIXING_OBJECT_MOUSE_SYNC

Conversation

@ajeetsinghyadav

@ajeetsinghyadav ajeetsinghyadav commented Apr 1, 2026 •

Copy link
Copy Markdown
Member
  • Changed the navigation controller type from "Navigation" to "Navigation 3D" for improved clarity and consistency in the UI.
  • This update enhances user understanding of the available controller options in the interaction settings.

Description

Release notes: Use a Conventional Commits–style PR title (e.g. feat: add X, fix: resolve Y, docs: update Z) so release-please can include this change in the changelog. If you squash-merge, use the PR title as the commit message.

Checklist

  • Project builds (e.g. cmake -B build and cmake --build build, or platform script).
  • Tests pass (e.g. ctest --test-dir build or script -a test).
  • Code is formatted (e.g. run clang-format as configured for this repo); CI clang-format will check.
  • Docs updated if you changed behavior or public API.

Additional notes

Summary by CodeRabbit

  • New Features

    • Rotation mode for inspect controls (Orbit vs Trackball)
    • Camera debug overlay showing live camera position and direction vectors
    • Scroll zoom tree with adjustable wheel-zoom exponent
  • Improvements

    • Reorganized interaction UI with automatic re-sync when controller type changes
    • Simplified navigation options and clarified disabled hints
    • Improved mouse coordinate handling for ImGui/viewports (more reliable hover/interaction)
  • Chores

    • Updated an internal dependency revision

- Adjusted the navigation mode index range to limit options to "Fps" and "Fly".
- Updated UI text to reflect the removal of the "Game" mode from the navigation options, enhancing clarity in user interactions.
- Updated the vneinteraction subproject reference to the latest commit, ensuring compatibility with recent changes.
- Added support for rotation settings in both Navigation and Inspect controllers, allowing users to enable/disable rotation and select rotation modes (Orbit or Trackball).
- Updated UI elements to reflect these new settings, improving user interaction and control over camera behaviors.
- Enhanced the display of interaction instructions based on the selected controller type, providing clearer guidance for users.
- Removed the "Inspect (Trackball)" option from the controller types, replacing it with "Inspect 3D" for clarity.
- Adjusted the index handling in the controller selection to accommodate the updated options.
- Enhanced UI text to provide clearer instructions for the "Inspect 3D" mode, improving user guidance.
- Updated the vneinteraction subproject to the latest commit for improved compatibility.
- Removed unused rotation settings from the Navigation controller in the InteractionSettingsLayer, streamlining the UI.
- Enhanced user guidance by updating text descriptions related to navigation controls and zoom methods.
- Removed unused rotation settings from the Navigation controller, simplifying the UI.
- Updated text descriptions for navigation controls and zoom methods to enhance user guidance.
- Adjusted the handling of camera position and target display for improved clarity in the debug overlay.
- Changed the navigation controller type from "Navigation" to "Navigation 3D" for improved clarity and consistency in the UI.
- This update enhances user understanding of the available controller options in the interaction settings.
Copilot AI review requested due to automatic review settings April 1, 2026 03:17
@coderabbitai

coderabbitai Bot commented Apr 1, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f1fa281b-6d24-4989-a48a-4db263c67e49

📥 Commits

Reviewing files that changed from the base of the PR and between 4cd0f3d and 12614c0.

📒 Files selected for processing (3)
  • include/vertexnova/testbed/imgui/imgui_layer.h
  • src/vertexnova/testbed/imgui/imgui_event_listener.cpp
  • src/vertexnova/testbed/imgui/imgui_layer.cpp

📝 Walkthrough

Walkthrough

Submodule revision bumped for deps/internal/vneinteraction. Interaction demo UI updated: rotation-mode selection/synchronization, removed one controller option, added scroll-zoom control and camera debug overlay. ImGui layer and event listener now convert GLFW client-area mouse coordinates to ImGui screen coordinates.

Changes

Cohort / File(s) Summary
Dependency Update
deps/internal/vneinteraction
Submodule revision updated from fe614a0aff5d7e to c8830bb57bcd01.
Interaction demo UI
samples/glfw_opengl/03_test_interaction/demo_test_interaction.cpp, samples/glfw_opengl/03_test_interaction/demo_test_interaction.h
Added rotation-mode state and synchronization on detach/controller change; removed Inspect (Trackball) combo entry and mapped to Inspect 3D; added "Rotation mode" combo (Orbit vs Trackball); tightened navigation mode options and added "Scroll zoom" exponent slider; added Camera debug overlay; added rotation_mode_insp_idx and last_manip_synced_controller_kind_ (private) and included <optional>.
ImGui input coord handling
include/vertexnova/testbed/imgui/imgui_layer.h, src/vertexnova/testbed/imgui/imgui_layer.cpp, src/vertexnova/testbed/imgui/imgui_event_listener.cpp
Added ImGuiLayer::clientMouseToImGuiScreen(float&, float&); getHoveredViewportIndex now treats inputs as client-area coordinates and uses converted values; event listener converts client-space mouse coords via clientMouseToImGuiScreen before forwarding to ImGui.

Sequence Diagram

sequenceDiagram
    participant User as User (ImGui)
    participant Event as EventListener
    participant ImGuiLayer as ImGuiLayer
    participant UI as InteractionSettingsLayer
    participant Ctrl as Inspect/Navigation Controller
    participant Cam as Camera

    User->>Event: mouse move (glfw client coords)
    Event->>ImGuiLayer: clientMouseToImGuiScreen(mx,my)
    ImGuiLayer->>ImGuiLayer: convert using window position if viewports enabled
    ImGuiLayer->>ImGui: AddMousePosEvent(converted)
    User->>UI: open settings / change controller or rotation mode
    UI->>UI: detect controller-kind change, sync UI state
    UI->>Ctrl: setRotationMode(Orbit/Trackball) / update zoom exponent
    Ctrl->>Cam: apply rotation / zoom
    UI->>Cam: query position/target
    UI->>UI: compute forward/right (with epsilon checks) and render debug overlay
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐇 I twitch my whiskers, tweak the view,

Orbit or arcball — which to choose?
Wheels whisper zoom with softer tune,
Debug vectors dance beneath the moon,
A tiny rabbit cheers the new.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title describes integrating navigation 3D controller changes, but the raw_summary reveals multiple significant changes beyond navigation controller: submodule updates, manipulator UI synchronization, rotation mode controls, camera debug overlay, mouse coordinate transformations, and ImGui viewport support. Clarify the title to reflect all major changes, or consider if it should focus on the primary objective (e.g., mouse coordinate transformation for viewport support) rather than just navigation controller changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch VNE_TESTBED_INTERACTION_FIXING_OBJECT_MOUSE_SYNC

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the interaction sample UI to present “Navigation 3D” and consolidates Inspect controller presentation while adding additional controller-tuning/debug UI.

Changes:

  • Renamed the controller type label from “Navigation” to “Navigation 3D” and collapsed Inspect entries into a single “Inspect 3D” option.
  • Added an Inspect rotation mode selector (Orbit vs Trackball) and persisted UI state for it.
  • Added Navigation scroll-zoom tuning UI and a camera debug overlay.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
samples/glfw_opengl/03_test_interaction/demo_test_interaction.h Updates controller comment and adds UI state for Inspect rotation mode selection.
samples/glfw_opengl/03_test_interaction/demo_test_interaction.cpp Updates controller selection UI/labels, adds Inspect rotation mode combo, adds Navigation scroll-zoom tuning + camera debug overlay.

Comment on lines +747 to +756
static ControllerKind prev_ctrl_kind = ControllerKind::eInspectOrbit;
static bool first_manip_frame = true;
if (first_manip_frame || cur != prev_ctrl_kind) {
if (auto* insp = il.getInspectController()) {
ui.rotation_enabled_insp = insp->isRotationEnabled();
ui.rotation_mode_insp_idx =
(insp->getRotationMode() == vne::interaction::OrbitRotationMode::eOrbit) ? 0 : 1;
}
prev_ctrl_kind = cur;
first_manip_frame = false;

Copilot AI Apr 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prev_ctrl_kind / first_manip_frame are function-static, so their state is shared across all InteractionSettingsLayer instances and persists across detach/reattach. This can leave the UI out of sync after recreating the layer (it will skip the initial sync) or when multiple windows/layers exist. Prefer storing this state on the InteractionSettingsLayer instance (members) or derive the sync from current controller state each frame/window (e.g., via ImGui::IsWindowAppearing() or by caching in uiSettings()).

Suggested change
static ControllerKind prev_ctrl_kind = ControllerKind::eInspectOrbit;
static bool first_manip_frame = true;
if (first_manip_frame || cur != prev_ctrl_kind) {
if (auto* insp = il.getInspectController()) {
ui.rotation_enabled_insp = insp->isRotationEnabled();
ui.rotation_mode_insp_idx =
(insp->getRotationMode() == vne::interaction::OrbitRotationMode::eOrbit) ? 0 : 1;
}
prev_ctrl_kind = cur;
first_manip_frame = false;
const bool should_sync_from_controller = ImGui::IsWindowAppearing();
if (should_sync_from_controller) {
if (auto* insp = il.getInspectController()) {
ui.rotation_enabled_insp = insp->isRotationEnabled();
ui.rotation_mode_insp_idx =
(insp->getRotationMode() == vne::interaction::OrbitRotationMode::eOrbit) ? 0 : 1;
}

Copilot uses AI. Check for mistakes.
Comment on lines +924 to +925
const auto fwd = (tgt - pos).normalized();
const auto right_v = fwd.cross(vne::math::Vec3f(0.f, 1.f, 0.f)).normalized();

Copilot AI Apr 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The debug overlay normalizes (tgt - pos) and fwd.cross(worldUp) without checking for degenerate vectors. If pos == tgt or fwd is parallel/near-parallel to up, the normalization can produce NaNs (or potentially trigger asserts/div-by-zero depending on Vec3f::normalized() implementation). Consider guarding with epsilon checks before normalizing (similar to SceneTestLayer::drawCameraVisuals in samples/glfw_opengl/02_test_scene/demo_test_scene.cpp:600-608) and skipping/printing a fallback when the basis can’t be constructed.

Suggested change
const auto fwd = (tgt - pos).normalized();
const auto right_v = fwd.cross(vne::math::Vec3f(0.f, 1.f, 0.f)).normalized();
const auto fwd = (tgt - pos);
const auto right_v = fwd.cross(vne::math::Vec3f(0.f, 1.f, 0.f));

Copilot uses AI. Check for mistakes.
Comment thread samples/glfw_opengl/03_test_interaction/demo_test_interaction.cpp
Comment on lines 814 to 820
switch (cur) {
case ControllerKind::eInspectOrbit:
ImGui::TextDisabled("LMB rotate RMB pan Scroll zoom");
break;
case ControllerKind::eInspectTrackball:
ImGui::TextDisabled("LMB rotate RMB pan Scroll zoom (trackball)");
ImGui::TextDisabled("Inspect 3D: Orbit / Trackball selectable below");
break;

Copilot AI Apr 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The controller help text for Inspect differs based on ControllerKind even though the UI now exposes a single "Inspect 3D" type. When selecting "Inspect 3D" the kind will typically be eInspectOrbit, so the hint doesn’t mention that Trackball can be selected below, which is now inaccurate/misleading. Consider making the Inspect hint independent of ControllerKind (or keying it off insp->getRotationMode()), so both orbit/trackball paths show consistent guidance.

Copilot uses AI. Check for mistakes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
samples/glfw_opengl/03_test_interaction/demo_test_interaction.cpp (2)

760-780: Consider deriving combo size from array length to avoid magic numbers.

The value 4 appears in multiple places (loop bound, combo call) and must stay in sync with the types[] and values[] arrays.

♻️ Suggested fix using std::size
         const char* types[] = {"Inspect 3D", "Navigation 3D", "Ortho 2D", "Follow"};
         const ControllerKind values[] = {ControllerKind::eInspectOrbit,
                                          ControllerKind::eNavigation,
                                          ControllerKind::eOrtho2D,
                                          ControllerKind::eFollow};
+        constexpr int kNumControllerTypes = static_cast<int>(std::size(types));
         int idx = 0;
-        for (int i = 0; i < 4; ++i) {
+        for (int i = 0; i < kNumControllerTypes; ++i) {
             if (values[i] == cur) {
                 idx = i;
                 break;
             }
         }
         if (cur == ControllerKind::eInspectTrackball) {
             idx = 0;  // Legacy state maps to Inspect 3D entry.
         }
         // ...
-        if (ImGui::Combo("Type##ctrl", &idx, types, 4)) {
+        if (ImGui::Combo("Type##ctrl", &idx, types, kNumControllerTypes)) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@samples/glfw_opengl/03_test_interaction/demo_test_interaction.cpp` around
lines 760 - 780, The hardcoded "4" should be replaced with a derived array size
to keep types[] and values[] in sync: compute a single constexpr or use
std::size(types) (or std::size(values)) and use that symbol for the loop bound,
the index initialization, and the ImGui::Combo call; update the for-loop that
finds the matching ControllerKind (and any other places using the literal) to
iterate to that derived count, and ensure the Combo call uses the same count and
the types/values arrays referenced remain the same.

747-757: Function-local statics for ImGui state sync are acceptable but create implicit shared state.

This is a common ImGui pattern for tracking state changes between frames. However, if multiple InteractionSettingsLayer instances were ever created, they would share prev_ctrl_kind and first_manip_frame. Consider making these instance members of InteractionSettingsLayer if multi-instance support is ever needed.

The synchronization logic correctly initializes rotation_enabled_insp and rotation_mode_insp_idx from the active inspect controller.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@samples/glfw_opengl/03_test_interaction/demo_test_interaction.cpp` around
lines 747 - 757, The function-local statics prev_ctrl_kind and first_manip_frame
create implicit shared state across instances; make them members of
InteractionSettingsLayer (e.g., add ControllerKind prev_ctrl_kind and bool
first_manip_frame to the class) and update the code that currently references
the statics to use these instance members; keep the existing logic that queries
il.getInspectController() and sets ui.rotation_enabled_insp and
ui.rotation_mode_insp_idx (using insp->isRotationEnabled() and
insp->getRotationMode()) but operate on the per-instance prev_ctrl_kind and
first_manip_frame to avoid cross-instance interference.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@deps/internal/vneinteraction`:
- Line 1: The vneinteraction submodule reference is pointing to a non-existent
commit (c8830bb57bcd01158e37dbe3f968a262d65fd6ea) causing initialization to
fail; fix it by either pushing that commit to the remote
(https://github.com/vertexnova/vneinteraction.git) or updating the submodule
pointer in deps/internal/vneinteraction to a valid commit/branch/tag present in
the remote (e.g., replace the bad SHA with a reachable commit or switch the
submodule to track a branch), then update the superproject's gitlink (git add
deps/internal/vneinteraction && git commit) and verify with git submodule update
--init --recursive.

In `@samples/glfw_opengl/03_test_interaction/demo_test_interaction.cpp`:
- Around line 921-944: The debug overlay can produce NaN when computing right_v
from fwd.cross(vne::math::Vec3f(0.f,1.f,0)).normalized() if fwd is parallel to
the Y axis; to fix, compute a raw right vector (e.g., right_raw = fwd.cross(up))
and test its length (or lengthSquared) against a small epsilon before calling
normalized(); if it is near zero, choose an alternative up vector (e.g.,
Vec3f(1,0,0)) or compute right_raw = fwd.cross(alternateUp) and then normalize
into right_v, updating the existing uses of fwd and right_v (from
il.cameraPosition()/il.cameraTarget()) so the overlay never normalizes a
zero-length vector.

---

Nitpick comments:
In `@samples/glfw_opengl/03_test_interaction/demo_test_interaction.cpp`:
- Around line 760-780: The hardcoded "4" should be replaced with a derived array
size to keep types[] and values[] in sync: compute a single constexpr or use
std::size(types) (or std::size(values)) and use that symbol for the loop bound,
the index initialization, and the ImGui::Combo call; update the for-loop that
finds the matching ControllerKind (and any other places using the literal) to
iterate to that derived count, and ensure the Combo call uses the same count and
the types/values arrays referenced remain the same.
- Around line 747-757: The function-local statics prev_ctrl_kind and
first_manip_frame create implicit shared state across instances; make them
members of InteractionSettingsLayer (e.g., add ControllerKind prev_ctrl_kind and
bool first_manip_frame to the class) and update the code that currently
references the statics to use these instance members; keep the existing logic
that queries il.getInspectController() and sets ui.rotation_enabled_insp and
ui.rotation_mode_insp_idx (using insp->isRotationEnabled() and
insp->getRotationMode()) but operate on the per-instance prev_ctrl_kind and
first_manip_frame to avoid cross-instance interference.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bc164973-fb57-4c6a-bb2c-cda609f0950c

📥 Commits

Reviewing files that changed from the base of the PR and between cf57ae0 and 3feaddf.

📒 Files selected for processing (3)
  • deps/internal/vneinteraction
  • samples/glfw_opengl/03_test_interaction/demo_test_interaction.cpp
  • samples/glfw_opengl/03_test_interaction/demo_test_interaction.h

@@ -1 +1 @@
Subproject commit fe614a0aff5d7e3365eda556e83d49e0fda2ba61
Subproject commit c8830bb57bcd01158e37dbe3f968a262d65fd6ea

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Submodule status =="
git submodule status deps/internal/vneinteraction || true

echo
echo "== Show previous and new submodule SHAs from parent diff =="
git diff -- deps/internal/vneinteraction

echo
echo "== Inspect submodule commit metadata =="
git -C deps/internal/vneinteraction show --no-patch --pretty=fuller c8830bb57bcd01158e37dbe3f968a262d65fd6ea

echo
echo "== Files changed in bumped submodule commit =="
git -C deps/internal/vneinteraction diff-tree --no-commit-id --name-status -r c8830bb57bcd01158e37dbe3f968a262d65fd6ea

echo
echo "== Search for expected interaction-label changes in submodule =="
rg -n --iglob '*.{ts,tsx,js,jsx,json,md}' 'Navigation 3D|Inspect 3D|Trackball|Orbit|Fly|Fps' deps/internal/vneinteraction || true

Repository: vertexnova/vnetestbed

Length of output: 451


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Current git status =="
git status deps/internal/vneinteraction || true

echo
echo "== Check git log for recent changes to submodule pointer =="
git log --oneline -n 20 -- deps/internal/vneinteraction || true

echo
echo "== Show git diff HEAD for submodule =="
git diff HEAD -- deps/internal/vneinteraction || true

echo
echo "== Check if deps/internal/vneinteraction is initialized =="
test -d deps/internal/vneinteraction/.git && echo "Submodule is initialized" || echo "Submodule is NOT initialized"

echo
echo "== List all git refs pointing near the mentioned commit =="
git for-each-ref --contains c8830bb57bcd01158e37dbe3f968a262d65fd6ea 2>/dev/null || echo "Commit not found in any refs"

echo
echo "== Check remote URL for submodule =="
git config --file=.gitmodules --get-regexp "deps/internal/vneinteraction" || true

Repository: vertexnova/vnetestbed

Length of output: 713


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Current submodule pointer in HEAD =="
git cat-file -p HEAD:deps/internal/vneinteraction 2>/dev/null || echo "File not found in HEAD"

echo
echo "== Show .gitmodules content =="
cat .gitmodules | grep -A 3 "vneinteraction" || true

echo
echo "== Check if this is staged as a submodule change =="
git ls-files --stage -- deps/internal/vneinteraction || true

echo
echo "== Check recent commits that mention the submodule =="
git log --oneline --all -- deps/internal/vneinteraction | head -5 || true

echo
echo "== Inspect commit 3feaddf in detail =="
git show --stat 3feaddf || true

Repository: vertexnova/vnetestbed

Length of output: 12566


This submodule bump points to an unreachable commit and will fail to initialize.

The staged change references commit c8830bb57bcd01158e37dbe3f968a262d65fd6ea in the vneinteraction submodule, but this commit does not exist in the remote repository (https://github.com/vertexnova/vneinteraction.git). The submodule cannot be initialized and any clone or build after merge will fail with "fatal: remote error: upload-pack: not our ref".

Ensure the target commit is pushed to the submodule remote before merging, or verify the correct commit hash is referenced.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deps/internal/vneinteraction` at line 1, The vneinteraction submodule
reference is pointing to a non-existent commit
(c8830bb57bcd01158e37dbe3f968a262d65fd6ea) causing initialization to fail; fix
it by either pushing that commit to the remote
(https://github.com/vertexnova/vneinteraction.git) or updating the submodule
pointer in deps/internal/vneinteraction to a valid commit/branch/tag present in
the remote (e.g., replace the bad SHA with a reachable commit or switch the
submodule to track a branch), then update the superproject's gitlink (git add
deps/internal/vneinteraction && git commit) and verify with git submodule update
--init --recursive.

Comment thread samples/glfw_opengl/03_test_interaction/demo_test_interaction.cpp
… in demo_test_interaction

- Added a new optional member to track the last used controller kind for improved synchronization in the UI.
- Updated the rendering logic to handle controller changes more effectively, enhancing user experience.
- Improved forward and right vector calculations in the camera debug display, including handling for degenerate cases.
- Enhanced UI feedback for camera position and movement controls, providing clearer guidance for users.
…test_interaction

- Simplified the logic for detecting controller changes in the InteractionSettingsLayer, enhancing synchronization with the UI.
- Streamlined the rendering of feedback messages for degenerate forward vectors, improving clarity in user guidance.
- Updated text formatting for better readability in the UI, contributing to an overall enhanced user experience.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
samples/glfw_opengl/03_test_interaction/demo_test_interaction.cpp (1)

763-777: Unify inspect mode state instead of splitting it across ControllerKind and setRotationMode().

The combo now presents a single "Inspect 3D" controller, but this later combo can still flip the live controller between orbit and trackball without changing il.getControllerKind(). That makes any cur-based UI branching stale relative to the actual inspect mode. I’d either collapse to one inspect kind or derive all inspect-mode-specific UI from insp->getRotationMode().

Also applies to: 859-864

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@samples/glfw_opengl/03_test_interaction/demo_test_interaction.cpp` around
lines 763 - 777, The UI currently treats Inspect as a single ControllerKind but
elsewhere toggles between orbit/trackball via setRotationMode(), causing cur
(from il.getControllerKind()) to be out of sync; update the combo logic so it no
longer branches on ControllerKind alone: either collapse the two inspect kinds
into one (remove any separate eInspectOrbit/eInspectTrackball usage in the
types/values arrays and always map Inspect 3D to a single ControllerKind), or
change the branching that computes idx to query the live inspect controller's
rotation mode (use insp->getRotationMode() together with
ControllerKind::eInspect... to decide which combo entry to select and to flip
rotation mode when the combo changes). Adjust references to values[], types[],
cur, and any code that calls setRotationMode() so the UI selection always
reflects the actual inspect rotation mode.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@samples/glfw_opengl/03_test_interaction/demo_test_interaction.cpp`:
- Around line 750-760: The resync block for inspect controller state only
refreshes rotation flags, leaving ui.pan_enabled_insp and ui.zoom_enabled_insp
stale after setControllerKind() rebuilds the controller; update the same block
(the condition using last_manip_synced_controller_kind_ and cur and the call to
il.getInspectController()) to also read and assign insp->isPanEnabled() and
insp->isZoomEnabled() into ui.pan_enabled_insp and ui.zoom_enabled_insp so the
checkboxes reflect the rebuilt inspect controller state (also apply the same
change to the similar block around lines 865-869).

---

Nitpick comments:
In `@samples/glfw_opengl/03_test_interaction/demo_test_interaction.cpp`:
- Around line 763-777: The UI currently treats Inspect as a single
ControllerKind but elsewhere toggles between orbit/trackball via
setRotationMode(), causing cur (from il.getControllerKind()) to be out of sync;
update the combo logic so it no longer branches on ControllerKind alone: either
collapse the two inspect kinds into one (remove any separate
eInspectOrbit/eInspectTrackball usage in the types/values arrays and always map
Inspect 3D to a single ControllerKind), or change the branching that computes
idx to query the live inspect controller's rotation mode (use
insp->getRotationMode() together with ControllerKind::eInspect... to decide
which combo entry to select and to flip rotation mode when the combo changes).
Adjust references to values[], types[], cur, and any code that calls
setRotationMode() so the UI selection always reflects the actual inspect
rotation mode.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b9962d60-f50b-4eef-8e83-1170809f5dd6

📥 Commits

Reviewing files that changed from the base of the PR and between 3feaddf and 4cd0f3d.

📒 Files selected for processing (2)
  • samples/glfw_opengl/03_test_interaction/demo_test_interaction.cpp
  • samples/glfw_opengl/03_test_interaction/demo_test_interaction.h
🚧 Files skipped from review as they are similar to previous changes (1)
  • samples/glfw_opengl/03_test_interaction/demo_test_interaction.h

Comment on lines +750 to +760
const bool window_appearing = ImGui::IsWindowAppearing();
const bool controller_changed =
!last_manip_synced_controller_kind_.has_value() || *last_manip_synced_controller_kind_ != cur;
if (window_appearing || controller_changed) {
if (auto* insp = il.getInspectController()) {
ui.rotation_enabled_insp = insp->isRotationEnabled();
ui.rotation_mode_insp_idx =
(insp->getRotationMode() == vne::interaction::OrbitRotationMode::eOrbit) ? 0 : 1;
}
last_manip_synced_controller_kind_ = cur;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Resync the inspect pan/zoom toggles too.

This sync block only refreshes rotation_enabled_insp and rotation_mode_insp_idx. After setControllerKind() rebuilds an inspect controller, ui.pan_enabled_insp / ui.zoom_enabled_insp can keep stale values, so those checkboxes may reopen in the wrong state and push an unexpected flag back on the next click.

Also applies to: 865-869

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@samples/glfw_opengl/03_test_interaction/demo_test_interaction.cpp` around
lines 750 - 760, The resync block for inspect controller state only refreshes
rotation flags, leaving ui.pan_enabled_insp and ui.zoom_enabled_insp stale after
setControllerKind() rebuilds the controller; update the same block (the
condition using last_manip_synced_controller_kind_ and cur and the call to
il.getInspectController()) to also read and assign insp->isPanEnabled() and
insp->isZoomEnabled() into ui.pan_enabled_insp and ui.zoom_enabled_insp so the
checkboxes reflect the rebuilt inspect controller state (also apply the same
change to the similar block around lines 865-869).

…te handling

- Introduced clientMouseToImGuiScreen method to map GLFW client-area mouse coordinates to ImGui screen space, enhancing multi-viewport support.
- Updated getHoveredViewportIndex to utilize the new method for accurate viewport detection based on transformed mouse coordinates.
- Modified ImGuiEventListener to call clientMouseToImGuiScreen when processing mouse movement events, ensuring consistent coordinate handling.
Copilot AI review requested due to automatic review settings April 1, 2026 13:23
@codecov

codecov Bot commented Apr 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 24 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/vertexnova/testbed/imgui/imgui_layer.cpp 0.00% 20 Missing ⚠️
.../vertexnova/testbed/imgui/imgui_event_listener.cpp 0.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment on lines +763 to 767
const char* types[] = {"Inspect 3D", "Navigation 3D", "Ortho 2D", "Follow"};
const ControllerKind values[] = {ControllerKind::eInspectOrbit,
ControllerKind::eInspectTrackball,
ControllerKind::eNavigation,
ControllerKind::eOrtho2D,
ControllerKind::eFollow};

Copilot AI Apr 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The controller type combo no longer exposes an Inspect Trackball option, and the only Inspect entry maps to ControllerKind::eInspectOrbit (values[0]). This makes switching away from Inspect and back always rebuild an Orbit controller and drops any previously selected Trackball rotation mode.

To preserve behavior, consider deriving the Inspect controller kind from ui.rotation_mode_insp_idx (or apply the stored rotation mode immediately after setControllerKind when switching back to Inspect).

Copilot uses AI. Check for mistakes.
Comment on lines +923 to +925
// Debug overlay: live camera state so movement direction can be verified.
if (ImGui::TreeNode("Camera debug##nav")) {
const auto pos = il.cameraPosition();

Copilot AI Apr 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description only mentions renaming "Navigation" to "Navigation 3D", but this hunk also adds new behavior/UI (e.g., the navigation camera debug overlay and other controller settings changes). Please update the PR description/release notes (or split into separate PRs) so the scope matches what’s being merged.

Copilot uses AI. Check for mistakes.
@ajeetsinghyadav
ajeetsinghyadav merged commit 1414964 into main Apr 3, 2026
15 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Apr 27, 2026
4 tasks
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