-
Notifications
You must be signed in to change notification settings - Fork 0
Transformations #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transformations #43
Conversation
WalkthroughA new C++ module library "logos" providing a templated Mat matrix type and transformation helpers (MakeRotationY, MakeRotationX, Scale) was added and integrated into the build. main.cpp was refactored to use these helpers for uniform uploads; README marked Transformations done; one test add_test() was removed. Changes
Sequence Diagram(s)sequenceDiagram
participant App as main.cpp
participant Logos as logos module
App->>Logos: MakeRotationY(yaw)
Logos-->>App: Mat<float,4,4> rotY
App->>Logos: MakeRotationX(-pitch)
Logos-->>App: Mat<float,4,4> rotX
App->>Logos: Scale(0.1F)
Logos-->>App: Mat<float,4,4> scale
rect rgba(120,180,200,0.12)
note over App: Compose transforms (operator*)
App->>App: rotY * rotX * scale -> composed
end
App->>App: composed.data() → pointer
App-->>GPU: SDL_PushGPUVertexUniformData(pointer, sizeof(matrix))
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
|
Here's the code health analysis summary for commits Analysis Summary
|
There was a problem hiding this 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
There was a problem hiding this 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 (3)
logos/modules/logos.ixx (2)
20-24: Missingconstoverload for single-argumentoperator().The single-argument accessor for column vectors lacks a
constoverload, which prevents read-only access to vector elements.TScalar& operator()(std::uint8_t row) requires(Col == 1) { return m_data[row][0]; } + const TScalar& operator()(std::uint8_t row) const + requires(Col == 1) + { + return m_data[row][0]; + }
25-25: Missingconstoverload fordata()method.Add a
constversion to allow read-only access to the underlying data.TScalar* data() { return m_data[0].data(); } + const TScalar* data() const { return m_data[0].data(); }main.cpp (1)
86-86: Consider removing the unusedcammember variable.The
cammember and its initialization (lines 187-193) are no longer used for storing camera data since the matrix is now computed inline. Thesizeof(cam.m)could be replaced withsizeof(float) * 16or a named constant.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
CMakeLists.txt(1 hunks)README.md(1 hunks)glsl_reflector/CMakeLists.txt(0 hunks)logos/CMakeLists.txt(1 hunks)logos/modules/logos.ixx(1 hunks)main.cpp(2 hunks)
💤 Files with no reviewable changes (1)
- glsl_reflector/CMakeLists.txt
⏰ 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: CodeQL C++ Analysis
- GitHub Check: build (Release, clang)
- GitHub Check: build (Debug, gcc)
- GitHub Check: build (Debug, clang)
- GitHub Check: clang-tidy-review
- GitHub Check: build (windows-latest, Debug, clang)
- GitHub Check: build (windows-latest, Debug, cl)
- GitHub Check: build (windows-latest, Release, clang)
- GitHub Check: build (windows-latest, Release, gcc)
- GitHub Check: build (windows-latest, Release, clang)
- GitHub Check: build (windows-latest, Release, cl)
- GitHub Check: build (windows-latest, Debug, gcc)
- GitHub Check: build (windows-latest, Debug, cl)
- GitHub Check: build (windows-latest, Release, gcc)
- GitHub Check: build (windows-latest, Debug, clang)
- GitHub Check: CodeQL C++ Analysis
- GitHub Check: build (Debug, clang)
- GitHub Check: build (Release, clang)
- GitHub Check: build (Release, gcc)
- GitHub Check: build (Debug, gcc)
🔇 Additional comments (9)
logos/modules/logos.ixx (4)
26-45: Matrix multiplication implementation looks correct.The templated
operator*correctly handles matrix dimension compatibility at compile time and implements standard matrix multiplication with proper accumulation.
48-73: Rotation matrix implementation is correct.The Y-axis rotation matrix follows the standard right-handed coordinate system convention.
75-100: LGTM!The X-axis rotation matrix is correctly implemented.
102-125: LGTM!The uniform scaling matrix is correctly implemented with the homogeneous coordinate preserved.
CMakeLists.txt (2)
123-123: LGTM!The logos subdirectory is correctly added to the build.
126-126: LGTM!The logos library is correctly linked to the SDL_TEST target.
README.md (1)
14-14: LGTM!The track list is correctly updated to reflect the completed transformations feature.
main.cpp (1)
29-29: LGTM!The logos module import is correctly added.
logos/CMakeLists.txt (1)
1-11: LGTM!The CMake configuration correctly sets up a C++20 module library using the modern
FILE_SETapproach for module sources. CMake 3.30 is appropriate for stable C++ modules support.
There was a problem hiding this 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
🧹 Nitpick comments (2)
logos/modules/logos.ixx (2)
20-25: Add const overloads for complete const-correctness.The single-argument
operator()(row)anddata()methods lack const overloads, limiting their use with const Mat instances.Add const overloads:
TScalar& operator()(std::uint8_t row) requires(Col == 1) { return m_data[row][0]; } + const TScalar& operator()(std::uint8_t row) const + requires(Col == 1) + { + return m_data[row][0]; + } TScalar* data() { return m_data[0].data(); } + const TScalar* data() const { return m_data[0].data(); }
102-125: Scale matrix is correctly implemented.The uniform scale matrix correctly applies the scale factor to x, y, and z components while preserving the homogeneous coordinate.
Minor formatting: remove the extra blank line at Line 104.
export Mat<float, 4, 4> Scale(float scale_size) { - Mat<float, 4, 4> R{};
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
logos/modules/logos.ixx(1 hunks)main.cpp(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- main.cpp
⏰ 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: clang-tidy-review
- GitHub Check: build (Release, clang)
- GitHub Check: build (Debug, gcc)
- GitHub Check: build (windows-latest, Debug, cl)
- GitHub Check: build (windows-latest, Release, cl)
- GitHub Check: build (windows-latest, Release, gcc)
- GitHub Check: build (windows-latest, Debug, gcc)
- GitHub Check: build (windows-latest, Release, clang)
- GitHub Check: build (windows-latest, Debug, clang)
- GitHub Check: build (windows-latest, Release, cl)
- GitHub Check: build (windows-latest, Release, clang)
- GitHub Check: build (Debug, gcc)
- GitHub Check: build (windows-latest, Debug, cl)
- GitHub Check: build (windows-latest, Debug, gcc)
- GitHub Check: build (windows-latest, Release, gcc)
- GitHub Check: build (Release, gcc)
- GitHub Check: build (Release, clang)
- GitHub Check: build (windows-latest, Debug, clang)
- GitHub Check: build (Debug, clang)
- GitHub Check: CodeQL C++ Analysis
🔇 Additional comments (4)
logos/modules/logos.ixx (4)
12-13: Mat class is now correctly exported.The
exportkeyword has been added to the Mat class template declaration, addressing the previous review concern. Users can now accesssopho::Mat<...>and chain matrix operations as needed.
26-45: Matrix multiplication implementation is correct.The operator* correctly implements standard matrix multiplication with proper dimension handling and dot product computation.
48-73: Y-axis rotation matrix is correctly implemented.The rotation matrix follows the standard right-handed Y-axis rotation formula with proper placement of cosine and sine terms.
75-100: X-axis rotation matrix is correctly implemented.The rotation matrix follows the standard right-handed X-axis rotation formula with proper placement of cosine and sine terms.
Summary by CodeRabbit
Documentation
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.