Skip to content

feat(codegen): SceneSerializer glm::vec3 Clamp support (#451 slice)#580

Merged
drsnuggles8 merged 2 commits into
masterfrom
feature/codegen-vec3-clamp
Jul 7, 2026
Merged

feat(codegen): SceneSerializer glm::vec3 Clamp support (#451 slice)#580
drsnuggles8 merged 2 commits into
masterfrom
feature/codegen-vec3-clamp

Conversation

@drsnuggles8

@drsnuggles8 drsnuggles8 commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Extends OLO_SERIALIZE(Clamp, Min=…, Max=…) (issue Codegen: SceneSerializer blocks for complex-field components (#380 follow-up) #451's Clamp slice, Add clamping functionality to component serialization and deserializa… #536) to accept glm::vec3 fields, clamped per-component via glm::clamp/glm::max/glm::min — mirroring the hand-written SanitizeVec3Clamped idiom.
  • Migrates BuoyancyComponent (m_ProbeExtents, plus its five scalar float fields onto the existing scalar Clamp) and NoiseAnimationComponent (RotationAmplitude/TranslationAmplitude, plus ChainLength/Octaves/Frequency/Lacunarity/Gain/Weight) fully off kComponentsCustomSerialize and onto the generated SceneSerializer.cpp path — both were excluded solely for this reason.
  • Deletes their now-dead hand-written serialize/deserialize blocks; regenerated .inl files are behaviorally identical to the removed code.
  • Adds Vec3ClampSerializerCodegenTest.cpp mirroring the existing codegen-test pattern (in-range/out-of-range/missing-key/min-only/max-only/non-finite-fallback cases).
  • Updates CLAUDE.md, ComponentReflection.h's doc comment, and issue Codegen: SceneSerializer blocks for complex-field components (#380 follow-up) #451's body (struck through the completed item; left the umbrella issue open for remaining scope).

Test plan

  • ComponentSerializerCoverage.* (existence + disjointness) pass
  • ComponentTupleCoverage.* / ComponentHandlerCoverage.* / SaveGameComponentSerializerCoverage.* pass
  • ComponentRoundTrip.BuoyancyComponentSurvivesYAMLRoundTrip / NoiseAnimationComponentSurvivesYAMLRoundTrip / NoiseAnimationComponentNonFiniteFieldsAreSanitizedOnLoad pass
  • Vec3ClampSerializerCodegen.* (6/6) pass
  • Full OloEngine-Tests suite: 4188 passed, 5 skipped (environment-gated), 0 failed

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added clamped scene serialization/deserialization for 3D vector (vec3) fields, applying per-component bounds during scene loading.
    • Enabled bounded serialization for buoyancy and noise animation settings so editor/authored values stay within defined limits.
  • Bug Fixes
    • Scene loading now preserves existing default vectors when values are missing or non-finite, then enforces clamps afterward.
  • Tests
    • Added unit tests covering vec3 clamp behavior, including min-only/max-only and fallback scenarios.
  • Documentation
    • Updated serializer guidance with expanded vec3 clamp examples and behavior notes.

…ields

Migrates BuoyancyComponent and NoiseAnimationComponent off kComponentsCustomSerialize
by teaching OLO_SERIALIZE(Clamp, Min=..., Max=...) to accept glm::vec3 fields
(clamped per-component via glm::clamp/glm::max/glm::min), closing the vec3-Clamp
gap called out in issue #451 as a natural follow-up to the scalar Clamp slice.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 12f16af0-df17-413e-92c5-fb1b80bb8732

📥 Commits

Reviewing files that changed from the base of the PR and between 59c4df5 and 6e33100.

📒 Files selected for processing (1)
  • tools/OloHeaderTool/main.cpp

📝 Walkthrough

Walkthrough

Extends the OloHeaderTool serialization codegen to support Clamp annotations on glm::vec3 fields, applying per-component clamping via generated glm::clamp/glm::max/glm::min calls. Migrates BuoyancyComponent and NoiseAnimationComponent from hand-written serialization to this generated path, removing their manual code. Adds tests and documentation updates.

Changes

Vec3 Clamp Codegen

Layer / File(s) Summary
OloHeaderTool vec3 clamp eligibility and codegen
tools/OloHeaderTool/main.cpp
Extends kClampEligible to include PropType::Vec3, adds ApplyVec3Clamp generating per-component glm::clamp/glm::max/glm::min expressions, wires the clamp step into the generated Vec3 deserialize path, updates kComponentsCustomSerialize to remove BuoyancyComponent and NoiseAnimationComponent, and revises related comments.
Component field annotations and manual code removal
OloEngine/src/OloEngine/Animation/NoiseAnimationComponent.h, OloEngine/src/OloEngine/Scene/Components.h, OloEngine/src/OloEngine/Scene/SceneSerializer.cpp
Applies OLO_SERIALIZE(Clamp, ...) annotations with explicit min/max bounds to NoiseAnimationComponent and BuoyancyComponent fields, and removes the manual serialize/deserialize blocks for both components from SceneSerializer.cpp.
Codegen tests and documentation
OloEngine/tests/Serialization/Vec3ClampSerializerCodegenTest.cpp, OloEngine/tests/CMakeLists.txt, OloEngine/src/OloEngine/Scene/ComponentReflection.h, CLAUDE.md
Adds a new gtest suite mirroring generated vec3 clamp deserialization behavior (round-trip, min-only/max-only clamps, missing keys, non-finite fallback), registers it in CMake, and updates ComponentReflection.h/CLAUDE.md docs describing vec3 clamp support and component migration.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding glm::vec3 Clamp support to SceneSerializer codegen.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

coderabbitai[bot]

This comment was marked as resolved.

…p/ApplyVec3Clamp

Both helpers had identical both/one-sided/no-op branching, differing only in the
clamp-function namespace and how a bound gets wrapped. Factored the branching
into AssembleClampExpr; regenerated .inl output is byte-identical, confirming
this is behavior-preserving.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@drsnuggles8 drsnuggles8 merged commit 291556b into master Jul 7, 2026
8 of 10 checks passed
@drsnuggles8 drsnuggles8 deleted the feature/codegen-vec3-clamp branch July 7, 2026 09:17
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.

1 participant