Skip to content

add keep_projection, gpu_instancing rotation#109

Merged
bertt merged 3 commits intomainfrom
keep_projection_add_gpu_instancing_rotation
Feb 26, 2026
Merged

add keep_projection, gpu_instancing rotation#109
bertt merged 3 commits intomainfrom
keep_projection_add_gpu_instancing_rotation

Conversation

@bertt
Copy link
Member

@bertt bertt commented Feb 19, 2026

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 keepProjection through GPU instancing tile generation and saving APIs.
  • Add Cartesian-basis rotation computation (EnuCalculator.GetLocalCartesianBasis) and apply it in GPUTileHandler when keepProjection=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

  • northYUp is 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.GetInstanceTransform still applies ToYUp before 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_instancing via GetExtension<MeshGpuInstancing>(), but Tiles3DExtensions.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.

bertt and others added 2 commits February 26, 2026 13:43
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@bertt bertt merged commit 505c9a2 into main Feb 26, 2026
2 checks passed
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