add keep_projection, gpu_instancing rotation#109
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Cartesian (--keep_projection=true) rotation support for GPU instancing so yaw/pitch/roll are applied in a local XYZ (East/North/Up) frame while still outputting glTF in Y-up space.
Changes:
- Thread
keepProjectionthrough GPU instancing tile generation and saving APIs. - Add Cartesian-basis rotation computation (
EnuCalculator.GetLocalCartesianBasis) and apply it inGPUTileHandlerwhenkeepProjection=true. - Add new NUnit coverage for Cartesian rotation behavior and update documentation/README to reflect the new support.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/CartesianRotationTests.cs | Adds new unit tests for Cartesian-basis rotation and GPU tile output validation. |
| src/ImplicitTiling.cs | Passes keepProjection through to GPU tile creation/saving paths. |
| src/GPUTileHandler.cs | Implements Cartesian-mode rotation/translation handling for GPU instancing; adds keepProjection plumbing. |
| src/EnuCalculator.cs | Introduces GetLocalCartesianBasis to apply yaw/pitch/roll in a local XYZ frame. |
| docs/technical-transforms.md | Updates transform documentation to include GPU instancing Cartesian rotation behavior. |
| README.md | Updates user-facing limitations section to state Cartesian rotation is supported in GPU instancing mode. |
Comments suppressed due to low confidence (3)
src/GPUTileHandler.cs:219
northYUpis computed but never used. This creates unnecessary work and may introduce compiler warnings; consider removing it or using it as part of the basis construction to avoid dead code.
var northYUp = Vector3.Normalize(ToYUp(north));
var upYUp = Vector3.Normalize(ToYUp(up));
docs/technical-transforms.md:71
- In Cartesian mode, the doc says translation is a direct XYZ offset from RTC center "(no Y-up swizzle)", but
GPUTileHandler.GetInstanceTransformstill appliesToYUpbefore subtracting the RTC translation. Update the docs to reflect the actual behavior (Cartesian coordinates are still swizzled to glTF Y-up for output; the key difference is skipping ECEF/ENU conversion).
**Cartesian mode** (`--keep_projection=true`):
1. **Translation**: Direct XYZ offset from RTC center (no Y-up swizzle)
2. **Rotation**: Apply yaw/pitch/roll to Cartesian basis (East=X, North=Y, Up=Z) → map to glTF space → re-orthonormalize → quaternion
3. **Scale**: Uniform or non-uniform (`--use_scale_non_uniform`)
tests/CartesianRotationTests.cs:119
- These tests parse the output GLB and look for
EXT_mesh_gpu_instancingviaGetExtension<MeshGpuInstancing>(), butTiles3DExtensions.RegisterExtensions()is not called in this test class. Other tests register extensions explicitly; without it, results can be null or test outcomes can become order-dependent. Add a[SetUp](or call in each test) to register the 3D Tiles extensions before parsing GLBs.
var model = ModelRoot.ParseGLB(tile);
var instancingNode = model.LogicalNodes.FirstOrDefault(n => n.GetExtension<MeshGpuInstancing>() != null);
Assert.That(instancingNode, Is.Not.Null);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.