From c82c882027f990b257d87eae156bb43a15caf953 Mon Sep 17 00:00:00 2001 From: Marco Hutter Date: Sat, 23 Nov 2024 15:09:34 +0100 Subject: [PATCH] Apply transform to content bounding volume --- specs/TilesetValidationSpec.ts | 7 ++++++ ...ileContentBoundingVolumeWithTransform.json | 25 +++++++++++++++++++ src/validation/TileContentValidator.ts | 2 +- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 specs/data/tilesets/tileContentBoundingVolumeWithTransform.json diff --git a/specs/TilesetValidationSpec.ts b/specs/TilesetValidationSpec.ts index 49c28585..bbd1422d 100644 --- a/specs/TilesetValidationSpec.ts +++ b/specs/TilesetValidationSpec.ts @@ -417,6 +417,13 @@ describe("Tileset validation", function () { expect(result.get(0).type).toEqual("BOUNDING_VOLUMES_INCONSISTENT"); }); + it("detects no issues in tileContentBoundingVolumeWithTransform", async function () { + const result = await Validators.validateTilesetFile( + "specs/data/tilesets/tileContentBoundingVolumeWithTransform.json" + ); + expect(result.length).toEqual(0); + }); + it("detects issues in tileContentGroupInvalidIndex", async function () { const result = await Validators.validateTilesetFile( "specs/data/tilesets/tileContentGroupInvalidIndex.json" diff --git a/specs/data/tilesets/tileContentBoundingVolumeWithTransform.json b/specs/data/tilesets/tileContentBoundingVolumeWithTransform.json new file mode 100644 index 00000000..5ed91743 --- /dev/null +++ b/specs/data/tilesets/tileContentBoundingVolumeWithTransform.json @@ -0,0 +1,25 @@ +{ + "asset" : { + "version" : "1.1" + }, + "geometricError" : 2.0, + "root" : { + "refine": "REPLACE", + "boundingVolume" : { + "box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] + }, + "geometricError" : 1.0, + "transform": [ + 2.0, 0.0, 0.0, 0.0, + 0.0, 3.0, 0.0, 0.0, + 0.0, 0.0, 4.0, 0.0, + 5.0, 6.0, 7.0, 1.0 + ], + "content": { + "uri": "tiles/glTF/Triangle/Triangle.gltf", + "boundingVolume": { + "box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] + } + } + } +} diff --git a/src/validation/TileContentValidator.ts b/src/validation/TileContentValidator.ts index daea00e3..bc4e5823 100644 --- a/src/validation/TileContentValidator.ts +++ b/src/validation/TileContentValidator.ts @@ -96,7 +96,7 @@ export class TileContentValidator { } const tileBoundingVolume = tile.boundingVolume; const outerTransform = tile.transform; - const innerTransform = undefined; + const innerTransform = tile.transform; const errorMessage = BoundingVolumeChecks.checkBoundingVolume( contentBoundingVolume, tileBoundingVolume,