Add Packed Math Types & AABB#57
Conversation
|
Warning Review limit reached
Next review available in: 49 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds a packed math module with aligned vector and matrix types, arithmetic, utilities, formatting, module re-exporting, and benchmarks. It also adds an exported AABB type with tests for bounds, expansion, center, size, and vector behavior. ChangesPacked math module
AABB module
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Engine/cpp/Runtime/Core/Math/PackedTypes.cppm`:
- Around line 502-508: Update Float4::operator*=(f32) to multiply the w
component by other, alongside x, y, and z, so its result matches
operator*(Float4, f32).
- Around line 140-173: Replace the runtime (&x)[…] accesses in the Float2 index
and swizzle operators with select()-based member selection, preserving
compile-time and runtime results; apply the same fix to the corresponding Float3
and Float4 overloads. Also update Float4::operator*=(f32) to scale w along with
x, y, and z.
🪄 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: 7e6728c9-c6f0-4268-94db-0a55728e02c0
📒 Files selected for processing (3)
Engine/cpp/Runtime/Core/Math/PackedTypes.bench.cppEngine/cpp/Runtime/Core/Math/PackedTypes.cppmEngine/cpp/Runtime/Core/Math/Types.cppm
* Adds Packed Math Types such as Float2, Float3, Float4 & Float4x4 * Adds benchmarks & tests for Packed Math Types
8c7c1c4 to
2a40e4e
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
Engine/cpp/Runtime/Core/Math/PackedTypes.cppm (1)
345-345: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMake the
Float4constructor explicit to prevent implicit conversions.Since this constructor has a default argument for
w, it can be invoked with a singleFloat3argument. It should be markedexplicitto prevent unintended implicit conversions fromFloat3toFloat4. This ensures consistency with theFloat3(const Float2 &, f32)constructor, which is appropriately markedexplicit.♻️ Proposed refactor
- [[nodiscard]] constexpr Float4(const Float3 &xyz, f32 w = 0.0f) noexcept : x{xyz.x}, y{xyz.y}, z{xyz.z}, w{w} {} + [[nodiscard]] constexpr explicit Float4(const Float3 &xyz, f32 w = 0.0f) noexcept : x{xyz.x}, y{xyz.y}, z{xyz.z}, w{w} {}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Engine/cpp/Runtime/Core/Math/PackedTypes.cppm` at line 345, Mark the Float4 constructor taking const Float3& xyz and optional f32 w as explicit. Keep its initialization and default w value unchanged, matching the conversion-prevention behavior of the Float3 constructor.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Engine/cpp/Runtime/Core/Math/PackedTypes.cppm`:
- Around line 500-507: Correct the third (`z`) component calculation in
Float4::operator* by using columns[1].z for the vector.y term instead of
columns[1].y. Leave the other matrix-vector multiplication components unchanged.
---
Nitpick comments:
In `@Engine/cpp/Runtime/Core/Math/PackedTypes.cppm`:
- Line 345: Mark the Float4 constructor taking const Float3& xyz and optional
f32 w as explicit. Keep its initialization and default w value unchanged,
matching the conversion-prevention behavior of the Float3 constructor.
🪄 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: 9c15a71d-b7c8-4818-ad88-4c5d274ff8c7
📒 Files selected for processing (5)
Engine/cpp/Runtime/Core/Math/AABB.cppmEngine/cpp/Runtime/Core/Math/AABB.test.cppEngine/cpp/Runtime/Core/Math/PackedTypes.bench.cppEngine/cpp/Runtime/Core/Math/PackedTypes.cppmEngine/cpp/Runtime/Core/Math/Types.cppm
🚧 Files skipped from review as they are similar to previous changes (2)
- Engine/cpp/Runtime/Core/Math/Types.cppm
- Engine/cpp/Runtime/Core/Math/PackedTypes.bench.cpp
05fc5fc to
76f12de
Compare
76f12de to
029f4a3
Compare
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Float2,Float3,Float4, andFloat4x4math types with swizzling, vector operations, and utilities like dot/length/normalize (includingFloat3cross product).AABBwith an empty-box constructor plusexpand(),center(), andsize()accessors.Performance
Tests
AABBbehavior and vector layout/utility correctness.