Skip to content

Conversation

@WSQS
Copy link
Owner

@WSQS WSQS commented Nov 15, 2025

Summary by CodeRabbit

  • New Features
    • Unified Editor UI with a mode switcher for "Node", "Vertex", and "Fragment" editing.
    • Multiline editors for vertex and fragment shaders with dynamic sizing based on content.
    • Vertex position editing now applies immediately via buffer updates.
    • Removed the separate standalone shader editor; its functionality is integrated into the unified UI.

@coderabbitai
Copy link

coderabbitai bot commented Nov 15, 2025

Warning

Rate limit exceeded

@WSQS has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 2161e0a and 50e2a70.

📒 Files selected for processing (1)
  • main.cpp (1 hunks)

Walkthrough

Replaced per-vertex NodeEditor editors with a single Editor UI that switches between three modes: Node (vertex position editing), Vertex (vertex shader editing), and Fragment (fragment shader editing). Mode changes trigger vertex buffer re-uploads or shader updates immediately.

Changes

Cohort / File(s) Summary
Editor UI Consolidation
main.cpp
Replaced per-vertex drag editors with a unified Editor component and a combo to switch modes. Added Case 0 (Node) to edit vertex positions and re-upload vertex buffer on change. Added Case 1 (Vertex) with a multiline vertex shader editor whose size is computed from line count and updates vertex_shader via pipeline_wrapper. Added Case 2 (Fragment) with a multiline fragment shader editor that updates fragment_shader via pipeline_wrapper. Removed the standalone SourceEditor block; its functionality is now in Case 1.

Sequence Diagram

sequenceDiagram
    actor User
    participant UI as Editor UI
    participant Buffer as Vertex Buffer
    participant Pipeline as Pipeline Wrapper

    User->>UI: Select "Node" Mode
    UI->>UI: Render drag editors for vertices
    User->>UI: Modify vertex position
    UI->>Buffer: Re-upload vertex buffer
    Buffer-->>UI: Buffer updated

    User->>UI: Switch to "Vertex" Mode
    UI->>UI: Render multiline vertex shader editor
    User->>UI: Edit vertex shader
    UI->>Pipeline: Update vertex_shader
    Pipeline-->>UI: Shader compiled & applied

    User->>UI: Switch to "Fragment" Mode
    UI->>UI: Render multiline fragment shader editor
    User->>UI: Edit fragment shader
    UI->>Pipeline: Update fragment_shader
    Pipeline-->>UI: Shader compiled & applied
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review mode-switching logic and case handling in main.cpp
  • Verify buffer re-upload correctness and vertex data consistency
  • Confirm shader update calls via pipeline_wrapper and error handling
  • Check multiline editor sizing and rendering behavior

Poem

🐰 I hopped through code, three doors I found,
Node, Vertex, Fragment — all gathered round.
With buffers refreshed and shaders that sing,
I nibbled a bug and left a bright spring. 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Merge Editor into one' accurately summarizes the main change: consolidating multiple per-vertex drag editors and separate shader editors into a unified Editor UI with mode switching.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@deepsource-io
Copy link
Contributor

deepsource-io bot commented Nov 15, 2025

Here's the code health analysis summary for commits fbcd701..50e2a70. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource C & C++ LogoC & C++❌ Failure
❗ 8 occurences introduced
🎯 94 occurences resolved
View Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

Copy link

@coderabbitai coderabbitai bot left a comment

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 (1)
main.cpp (1)

140-180: Consider adding a default case to the switch statement.

While the combo box constrains current to valid values (0-2), adding a default case improves defensive programming and makes the code more maintainable if modes are added later.

             break;
+        default:
+            break;
         }
         ImGui::End();
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fbcd701 and bb6ec1d.

📒 Files selected for processing (1)
  • main.cpp (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: build (Debug, gcc)
  • GitHub Check: build (windows-latest, Release, gcc)
  • GitHub Check: build (windows-latest, Release, clang)
  • GitHub Check: build (windows-latest, Debug, gcc)
  • GitHub Check: build (Release, clang)
  • GitHub Check: build (windows-latest, Debug, cl)
  • GitHub Check: build (windows-latest, Debug, clang)
  • GitHub Check: build (Release, gcc)
  • GitHub Check: clang-tidy-review
  • GitHub Check: build (Debug, clang)
  • GitHub Check: build (Release, gcc)
  • GitHub Check: build (Release, clang)
  • GitHub Check: build (Debug, clang)
  • GitHub Check: build (Debug, gcc)
  • GitHub Check: build (windows-latest, Debug, cl)
  • GitHub Check: build (windows-latest, Release, clang)
  • GitHub Check: build (windows-latest, Release, cl)
  • GitHub Check: build (windows-latest, Release, gcc)
  • GitHub Check: build (windows-latest, Debug, clang)
  • GitHub Check: build (windows-latest, Debug, gcc)
🔇 Additional comments (2)
main.cpp (2)

137-139: LGTM!

The static variable correctly persists the selected mode across frames, and the combo box setup is appropriate.


142-152: LGTM!

The vertex position editing logic is correct. The change tracking and conditional buffer upload ensure efficient updates only when modifications occur.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (2)
main.cpp (2)

153-164: Critical issue from previous review remains unaddressed.

The shader recompilation on every keystroke issue previously flagged as critical has not been resolved. InputTextMultiline still triggers set_vertex_shader for each character typed, causing expensive recompilation and errors on incomplete syntax.


166-178: Critical issue from previous review remains unaddressed.

The shader recompilation on every keystroke issue previously flagged as critical has not been resolved. InputTextMultiline still triggers set_fragment_shader for each character typed, causing the same performance and stability issues as the vertex shader case.

🧹 Nitpick comments (1)
main.cpp (1)

140-140: Add a default case for defensive coding.

While the combo box constrains current to valid values (0-2), adding a default case improves robustness and addresses the static analysis warning.

Apply this diff:

             switch (current)
             {
             case 0:
                 {
                     auto change = ImGui::DragFloat3("##node1", vertices[0].position(), 0.01f, -1.f, 1.f);
                     change = ImGui::DragFloat3("##node2", vertices[1].position(), 0.01f, -1.f, 1.f) || change;
                     change = ImGui::DragFloat3("##node3", vertices[2].position(), 0.01f, -1.f, 1.f) || change;
                     if (change)
                     {
                         vertex_buffer.upload(&vertices, sizeof(vertices), 0);
                     }
                 }
                 break;
             case 1:
                 {
                     auto line_count = std::count(vertex_source.begin(), vertex_source.end(), '\n');
                     ImVec2 size = ImVec2(
                         ImGui::GetContentRegionAvail().x,
                         std::min(ImGui::GetTextLineHeight() * (line_count + 3), ImGui::GetContentRegionAvail().y));
                     if (ImGui::InputTextMultiline("##vertex editor", &vertex_source, size,
                                                   ImGuiInputTextFlags_AllowTabInput))
                     {
                         pipeline_wrapper.set_vertex_shader(vertex_source);
                     }
                 }
                 break;
             case 2:
                 {
                     auto line_count = std::count(fragment_source.begin(), fragment_source.end(), '\n');
                     ImVec2 size = ImVec2(
                         ImGui::GetContentRegionAvail().x,
                         std::min(ImGui::GetTextLineHeight() * (line_count + 3), ImGui::GetContentRegionAvail().y));
                     if (ImGui::InputTextMultiline("##fragment editor", &fragment_source, size,
                                                   ImGuiInputTextFlags_AllowTabInput))
                     {
                         pipeline_wrapper.set_fragment_shader(fragment_source);
                     }
                 }
                 break;
+            default:
+                break;
             }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bb6ec1d and 2161e0a.

📒 Files selected for processing (1)
  • main.cpp (1 hunks)
🔇 Additional comments (2)
main.cpp (2)

137-139: LGTM! Good use of std::array.

The mode selection combo box is well-implemented using std::array instead of C-style arrays, which addresses the previous static analysis warnings.


142-152: LGTM! Efficient vertex buffer update pattern.

The node editing mode correctly tracks changes across all vertex position editors and only re-uploads the vertex buffer when modifications occur, avoiding unnecessary GPU transfers.

@github-actions
Copy link

clang-tidy review says "All clean, LGTM! 👍"

@WSQS WSQS merged commit 41f3af5 into dev Nov 15, 2025
23 of 24 checks passed
@WSQS WSQS deleted the editor branch November 15, 2025 10:59
@coderabbitai coderabbitai bot mentioned this pull request Nov 20, 2025
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