diff --git a/CHANGES.md b/CHANGES.md index 7bb566be6e57..c02e3b4b552e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ Change Log * `Scene/PerspectiveFrustum` is deprecated and will be removed in 1.38. Use `Core/PerspectiveFrustum`. * `Scene/PerspectiveOffCenterFrustum` is deprecated and will be removed in 1.38. Use `Core/PerspectiveOffCenterFrustum`. * Added ability to show tile urls in the 3D Tiles Inspector. [#5592](https://github.com/AnalyticalGraphicsInc/cesium/pull/5592) +* Fixed issue where composite 3D Tiles that contained instanced 3D Tiles with an external model reference would fail to download the model. * Added behavior to `Cesium3DTilesInspector` that selects the first tileset hovered over if no tilest is specified. [#5139](https://github.com/AnalyticalGraphicsInc/cesium/issues/5139) * Added ability to provide a `width` and `height` to `scene.pick`. [#5602](https://github.com/AnalyticalGraphicsInc/cesium/pull/5602) * Added setter for `GeoJsonDataSource.name` to specify a name for the datasource [#5653](https://github.com/AnalyticalGraphicsInc/cesium/issues/5653) diff --git a/Source/Scene/Instanced3DModel3DTileContent.js b/Source/Scene/Instanced3DModel3DTileContent.js index df1de7ca0593..66ad743fc5d2 100644 --- a/Source/Scene/Instanced3DModel3DTileContent.js +++ b/Source/Scene/Instanced3DModel3DTileContent.js @@ -308,6 +308,10 @@ define([ if (gltfFormat === 0) { var gltfUrl = getStringFromTypedArray(gltfView); + + // We need to remove padding from the end of the model URL in case this tile was part of a composite tile. + // This removes all white space and null characters from the end of the string. + gltfUrl = gltfUrl.replace(/[\s\0]+$/, ''); collectionOptions.url = getAbsoluteUri(joinUrls(getBaseUri(content._url, true), gltfUrl)); } else { collectionOptions.gltf = gltfView; diff --git a/Specs/Data/Cesium3DTiles/Composite/CompositeOfInstanced/box.glb b/Specs/Data/Cesium3DTiles/Composite/CompositeOfInstanced/box.glb new file mode 100644 index 000000000000..2bde3c4ee98e Binary files /dev/null and b/Specs/Data/Cesium3DTiles/Composite/CompositeOfInstanced/box.glb differ diff --git a/Specs/Data/Cesium3DTiles/Composite/CompositeOfInstanced/compositeOfInstanced.cmpt b/Specs/Data/Cesium3DTiles/Composite/CompositeOfInstanced/compositeOfInstanced.cmpt new file mode 100644 index 000000000000..99f84f85f092 Binary files /dev/null and b/Specs/Data/Cesium3DTiles/Composite/CompositeOfInstanced/compositeOfInstanced.cmpt differ diff --git a/Specs/Data/Cesium3DTiles/Composite/CompositeOfInstanced/tileset.json b/Specs/Data/Cesium3DTiles/Composite/CompositeOfInstanced/tileset.json new file mode 100644 index 000000000000..9609546a000c --- /dev/null +++ b/Specs/Data/Cesium3DTiles/Composite/CompositeOfInstanced/tileset.json @@ -0,0 +1,29 @@ +{ + "asset": { + "version": "0.0" + }, + "properties": { + "Height": { + "minimum": 20, + "maximum": 20 + } + }, + "geometricError": 70, + "root": { + "refine": "ADD", + "boundingVolume": { + "region": [ + -1.3197004795898053, + 0.6988582109, + -1.3196595204101946, + 0.6988897891, + 0, + 30 + ] + }, + "geometricError": 0, + "content": { + "url": "compositeOfInstanced.cmpt" + } + } +} diff --git a/Specs/Scene/Composite3DTileContentSpec.js b/Specs/Scene/Composite3DTileContentSpec.js index 103ad89ac774..2f0be37c6bed 100644 --- a/Specs/Scene/Composite3DTileContentSpec.js +++ b/Specs/Scene/Composite3DTileContentSpec.js @@ -20,12 +20,13 @@ defineSuite([ var compositeUrl = './Data/Cesium3DTiles/Composite/Composite/'; var compositeOfComposite = './Data/Cesium3DTiles/Composite/CompositeOfComposite/'; + var compositeOfInstanced = './Data/Cesium3DTiles/Composite/compositeOfInstanced/'; beforeAll(function() { scene = createScene(); // One item in each data set is always located in the center, so point the camera there var center = Cartesian3.fromRadians(centerLongitude, centerLatitude); - scene.camera.lookAt(center, new HeadingPitchRange(0.0, -1.57, 30.0)); + scene.camera.lookAt(center, new HeadingPitchRange(0.0, -1.57, 26.0)); }); afterAll(function() { @@ -121,6 +122,10 @@ defineSuite([ return Cesium3DTilesTester.loadTileset(scene, compositeOfComposite).then(expectRenderComposite); }); + it('renders multiple instanced tilesets', function() { + return Cesium3DTilesTester.loadTileset(scene, compositeOfInstanced).then(expectRenderComposite); + }); + it('destroys', function() { return Cesium3DTilesTester.tileDestroys(scene, compositeUrl); });