diff --git a/.travis.yml b/.travis.yml index 024b8097b877..42139a1752fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ script: - echo 'makeZipFile' && echo -en 'travis_fold:start:script.makeZipFile\\r' - npm run clean - - npm run makeZipFile + - npm run makeZipFile -- --concurrency 2 - npm pack - echo -en 'travis_fold:end:script.makeZipFile\\r' diff --git a/CHANGES.md b/CHANGES.md index e8f7634f891e..8dc9ee882d44 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,13 +14,16 @@ 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) * Fixed issue where scene would blink when labels were added. [#5537](https://github.com/AnalyticalGraphicsInc/cesium/issues/5537) * Fixed label positioning when height reference changes [#5609](https://github.com/AnalyticalGraphicsInc/cesium/issues/5609) * Fixed crash when using the `Cesium3DTilesInspectorViewModel` and removing a tileset [#5607](https://github.com/AnalyticalGraphicsInc/cesium/issues/5607) * Fixed polygon outline in Polygon Sandcastle demo [#5642](https://github.com/AnalyticalGraphicsInc/cesium/issues/5642) * Fixed label positioning when using `HeightReference.CLAMP_TO_GROUND` and no position [#5648](https://github.com/AnalyticalGraphicsInc/cesium/pull/5648) +* Updated `Billboard`, `Label` and `PointPrimitive` constructors to clone `NearFarScale` parameters [#5654](https://github.com/AnalyticalGraphicsInc/cesium/pull/5654) * Added `FrustumGeometry` and `FrustumOutlineGeometry`. [#5649](https://github.com/AnalyticalGraphicsInc/cesium/pull/5649) * Added an `options` parameter to the constructors of `PerspectiveFrustum`, `PerspectiveOffCenterFrustum`, `OrthographicFrustum`, and `OrthographicOffCenterFrustum` to set properties. [#5649](https://github.com/AnalyticalGraphicsInc/cesium/pull/5649) * Added `ClassificationPrimitive` which defines a volume and draws the intersection of the volume and terrain or 3D Tiles. [#5625](https://github.com/AnalyticalGraphicsInc/cesium/pull/5625) diff --git a/Source/DataSources/GeoJsonDataSource.js b/Source/DataSources/GeoJsonDataSource.js index 2123486fcb1c..854760323b76 100644 --- a/Source/DataSources/GeoJsonDataSource.js +++ b/Source/DataSources/GeoJsonDataSource.js @@ -683,13 +683,19 @@ define([ defineProperties(GeoJsonDataSource.prototype, { /** - * Gets a human-readable name for this instance. + * Gets or sets a human-readable name for this instance. * @memberof GeoJsonDataSource.prototype * @type {String} */ name : { get : function() { return this._name; + }, + set : function(value) { + if (this._name !== value) { + this._name = value; + this._changed.raiseEvent(this); + } } }, /** diff --git a/Source/Scene/Instanced3DModel3DTileContent.js b/Source/Scene/Instanced3DModel3DTileContent.js index 8eeaac92317e..429f51d35200 100644 --- a/Source/Scene/Instanced3DModel3DTileContent.js +++ b/Source/Scene/Instanced3DModel3DTileContent.js @@ -311,6 +311,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/Source/Scene/Model.js b/Source/Scene/Model.js index 6924b9387db1..0bd2a4d638bf 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -4770,6 +4770,11 @@ define([ destroy(this._rendererResources.vertexArrays); } + if (defined(this._removeUpdateHeightCallback)) { + this._removeUpdateHeightCallback(); + this._removeUpdateHeightCallback = undefined; + } + this._rendererResources = undefined; this._cachedRendererResources = this._cachedRendererResources && this._cachedRendererResources.release(); 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/DataSources/GeoJsonDataSourceSpec.js b/Specs/DataSources/GeoJsonDataSourceSpec.js index a19097e85205..18fd511998bd 100644 --- a/Specs/DataSources/GeoJsonDataSourceSpec.js +++ b/Specs/DataSources/GeoJsonDataSourceSpec.js @@ -279,6 +279,19 @@ defineSuite([ expect(dataSource.show).toBe(true); }); + it('setting name raises changed event', function() { + var dataSource = new GeoJsonDataSource(); + + var spy = jasmine.createSpy('changedEvent'); + dataSource.changedEvent.addEventListener(spy); + + var newName = 'chester'; + dataSource.name = newName; + expect(dataSource.name).toEqual(newName); + expect(spy.calls.count()).toEqual(1); + expect(spy).toHaveBeenCalledWith(dataSource); + }); + it('show sets underlying entity collection show.', function() { var dataSource = new GeoJsonDataSource(); 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); }); diff --git a/Specs/Scene/ModelSpec.js b/Specs/Scene/ModelSpec.js index 87f7a76c5346..c7dd2dfec270 100644 --- a/Specs/Scene/ModelSpec.js +++ b/Specs/Scene/ModelSpec.js @@ -2521,6 +2521,23 @@ defineSuite([ }); }); + it('removes the callback on destroy', function() { + scene.globe = createMockGlobe(); + return loadModelJson(texturedBoxModel.gltf, { + heightReference : HeightReference.CLAMP_TO_GROUND, + position : Cartesian3.fromDegrees(-72.0, 40.0), + scene : scene, + show : true + }).then(function(model) { + expect(scene.globe.callback).toBeDefined(); + scene.renderForSpecs(); + + primitives.remove(model); + scene.renderForSpecs(); + expect(scene.globe.callback).toBeUndefined(); + }); + }); + it('changing the terrain provider', function() { scene.globe = createMockGlobe(); return loadModelJson(texturedBoxModel.gltf, { @@ -2566,5 +2583,4 @@ defineSuite([ }); }); }); - }, 'WebGL'); diff --git a/gulpfile.js b/gulpfile.js index b46c2eb1999c..6be3722bd14b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -46,8 +46,10 @@ var noDevelopmentGallery = taskName === 'release' || taskName === 'makeZipFile'; var buildingRelease = noDevelopmentGallery; var minifyShaders = taskName === 'minify' || taskName === 'minifyRelease' || taskName === 'release' || taskName === 'makeZipFile' || taskName === 'buildApps'; -//travis reports 32 cores but only has 3GB of memory, which causes the VM to run out. Limit to 8 cores instead. -var concurrency = Math.min(os.cpus().length, 8); +var concurrency = yargs.argv.concurrency; +if (!concurrency) { + concurrency = os.cpus().length; +} //Since combine and minify run in parallel already, split concurrency in half when building both. //This can go away when gulp 4 comes out because it allows for synchronous tasks.