From 592a2a81ec1263918b2fc66af8e4e805deaf3ba0 Mon Sep 17 00:00:00 2001 From: Samuel Rothstein Date: Tue, 1 Jun 2021 13:28:51 -0700 Subject: [PATCH 1/4] Added checks for supported 3D tiles extensions --- Source/Scene/Cesium3DTileset.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index 267f502b1bf3..bb412820fdf3 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -1751,6 +1751,8 @@ Cesium3DTileset.prototype.loadTileset = function ( throw new RuntimeError("The tileset must be 3D Tiles version 0.0 or 1.0."); } + Cesium3DTileset.checkSupportedExtensions(this._extensions); + var statistics = this._statistics; var tilesetVersion = asset.tilesetVersion; @@ -2804,6 +2806,26 @@ Cesium3DTileset.prototype.destroy = function () { return destroyObject(this); }; +Cesium3DTileset.supportedExtensions = { + CESIUM_3DTILES_metadata: true, + CESIUM_3DTILES_implicit_tiling: true, + CESIUM_3DTILES_content_gltf: true, + CESIUM_3DTILES_multiple_contents: true, + CESIUM_3DTILES_bounding_volume_S2: true, + CESIUM_3DTILES_batch_table_hierarchy: true, + CESIUM_3DTILES_draco_point_compression: true, +}; + +Cesium3DTileset.checkSupportedExtensions = function (extensionsRequired) { + for (var extension in extensionsRequired) { + if (extensionsRequired.hasOwnProperty(extension)) { + if (!Cesium3DTileset.supportedExtensions[extension]) { + throw new RuntimeError("Unsupported 3D Tiles Extension: " + extension); + } + } + } +}; + /** * Optimization option. Used as a callback when {@link Cesium3DTileset#foveatedScreenSpaceError} is true to control how much to raise the screen space error for tiles outside the foveated cone, * interpolating between {@link Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation} and {@link Cesium3DTileset#maximumScreenSpaceError}. From 9d14db5f9aa4a81c455c0f0ff9dd8e437fdbebad Mon Sep 17 00:00:00 2001 From: Samuel Rothstein Date: Tue, 1 Jun 2021 13:31:35 -0700 Subject: [PATCH 2/4] updated CHANGES log --- CHANGES.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 6686022da7ae..a5ef3e07278e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ # Change Log +### 1.83 - 2021-07-01 + +##### Additions :tada: + +- Added checks for supported 3D tiles extensions.[#9552](https://github.com/CesiumGS/cesium/issues/9552) + ### 1.82 - 2021-06-01 ##### Additions :tada: From c0e632cc689f4a2624bb65ce9e9da29d8e02f7bd Mon Sep 17 00:00:00 2001 From: Samuel Rothstein Date: Tue, 1 Jun 2021 13:32:55 -0700 Subject: [PATCH 3/4] updated CONTRIBUTORS file --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d6fa8cf21660..208e14fac6c4 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -151,6 +151,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu - [Dzung Nguyen](https://github.com/dzungpng) - [Nithin Pranesh](https://github.com/nithinp7) - [Alexander Gallegos](https://github.com/argallegos) + - [Sam Rothstein](https://github.com/srothst1) - [Northrop Grumman](http://www.northropgrumman.com) - [Joseph Stein](https://github.com/nahgrin) - [EOX IT Services GmbH](https://eox.at) From 3b7facf82a6907547d43e1558afe75325a7bbdba Mon Sep 17 00:00:00 2001 From: Samuel Rothstein Date: Tue, 1 Jun 2021 13:56:23 -0700 Subject: [PATCH 4/4] updated spec for unsupported_extension --- Specs/Scene/Cesium3DTilesetSpec.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js index fdb0598d974a..3d639cfa0a1f 100644 --- a/Specs/Scene/Cesium3DTilesetSpec.js +++ b/Specs/Scene/Cesium3DTilesetSpec.js @@ -372,6 +372,28 @@ describe( }); }); + it("rejects readyPromise with unsupported extension", function () { + var tilesetJson = { + asset: { + version: 1.0, + }, + extensionsUsed: ["unsupported_extension"], + extensionsRequired: ["unsupported_extension"], + }; + + var uri = "data:text/plain;base64," + btoa(JSON.stringify(tilesetJson)); + + options.url = uri; + var tileset = scene.primitives.add(new Cesium3DTileset(options)); + return tileset.readyPromise + .then(function () { + fail("should not resolve"); + }) + .otherwise(function (error) { + expect(tileset.ready).toEqual(false); + }); + }); + it("url and tilesetUrl set up correctly given tileset JSON filepath", function () { var path = "Data/Cesium3DTiles/Tilesets/TilesetOfTilesets/tileset.json"; var tileset = new Cesium3DTileset({