From 41b5b94f8141d1a5be8093d5effd05dd1b374492 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 9 Nov 2015 16:52:59 -0500 Subject: [PATCH 01/59] Initial terrain exaggeration done in the vertex shader. --- Apps/Sandcastle/gallery/Terrain.html | 19 +++++++++++++++++++ Source/Scene/Globe.js | 4 ++++ Source/Scene/GlobeSurfaceTileProvider.js | 11 +++++++++++ Source/Shaders/GlobeVS.glsl | 12 ++++++++++-- 4 files changed, 44 insertions(+), 2 deletions(-) diff --git a/Apps/Sandcastle/gallery/Terrain.html b/Apps/Sandcastle/gallery/Terrain.html index a24491646484..26c4d2043fa7 100644 --- a/Apps/Sandcastle/gallery/Terrain.html +++ b/Apps/Sandcastle/gallery/Terrain.html @@ -27,6 +27,15 @@
+ + + + + +
Exaggeration + + +
- + \ No newline at end of file diff --git a/Source/Scene/Globe.js b/Source/Scene/Globe.js index d4da1eff6084..24c4ea8478cf 100644 --- a/Source/Scene/Globe.js +++ b/Source/Scene/Globe.js @@ -269,7 +269,6 @@ define([ */ this.depthTestAgainstTerrain = false; - //this.terrainExaggeration = 0.0; this.terrainExaggeration = 1.0; this._oceanNormalMap = undefined; diff --git a/Source/Scene/GlobeSurfaceTileProvider.js b/Source/Scene/GlobeSurfaceTileProvider.js index 6e55786ab31f..3b6748bdb49f 100644 --- a/Source/Scene/GlobeSurfaceTileProvider.js +++ b/Source/Scene/GlobeSurfaceTileProvider.js @@ -122,7 +122,6 @@ define([ this.oceanNormalMap = undefined; this.zoomedOutOceanSpecularIntensity = 0.5; this.enableLighting = false; - this.exaggeration = 0.0; this._quadtree = undefined; this._terrainProvider = options.terrainProvider; @@ -720,12 +719,6 @@ define([ u_center3D : function() { return this.center3D; }, - u_normal3D : function() { - return this.normal3D; - }, - u_exaggeration : function() { - return this.exaggeration; - }, u_tileRectangle : function() { return this.tileRectangle; }, @@ -781,8 +774,6 @@ define([ lightingFadeDistance : new Cartesian2(6500000.0, 9000000.0), center3D : undefined, - normal3D : undefined, - exaggeration : 0.0, modifiedModelView : new Matrix4(), tileRectangle : new Cartesian4(), @@ -1068,8 +1059,6 @@ define([ uniformMap.zoomedOutOceanSpecularIntensity = tileProvider.zoomedOutOceanSpecularIntensity; uniformMap.center3D = surfaceTile.center; - uniformMap.normal3D = frameState.mapProjection.ellipsoid.geodeticSurfaceNormal(surfaceTile.center); - uniformMap.exaggeration = tileProvider.exaggeration; Cartesian4.clone(tileRectangle, uniformMap.tileRectangle); uniformMap.southAndNorthLatitude.x = southLatitude; @@ -1209,4 +1198,4 @@ define([ } return GlobeSurfaceTileProvider; -}); +}); \ No newline at end of file diff --git a/Source/Shaders/GlobeVS.glsl b/Source/Shaders/GlobeVS.glsl index 326a80a75808..2a5b619af319 100644 --- a/Source/Shaders/GlobeVS.glsl +++ b/Source/Shaders/GlobeVS.glsl @@ -2,8 +2,6 @@ attribute vec4 position3DAndHeight; attribute vec3 textureCoordAndEncodedNormals; uniform vec3 u_center3D; -uniform vec3 u_normal3D; -uniform float u_exaggeration; uniform mat4 u_modifiedModelView; uniform vec4 u_tileRectangle; @@ -30,12 +28,7 @@ float get2DYPositionFraction(); vec4 getPosition3DMode(vec3 position3DWC) { - float height = position3DAndHeight.w; - float exaggeration = u_exaggeration * height - height; - - vec3 position = (u_modifiedModelView * vec4(position3DAndHeight.xyz, 1.0)).xyz; - position += (u_modifiedModelView * vec4(u_normal3D, 0.0)).xyz * exaggeration; - return czm_projection * vec4(position, 1.0); + return czm_projection * (u_modifiedModelView * vec4(position3DAndHeight.xyz, 1.0)); } float get2DMercatorYPositionFraction() @@ -80,8 +73,7 @@ vec4 getPosition2DMode(vec3 position3DWC) vec4 getPositionColumbusViewMode(vec3 position3DWC) { - float height = position3DAndHeight.w; - return getPositionPlanarEarth(position3DWC, u_exaggeration * height); + return getPositionPlanarEarth(position3DWC, position3DAndHeight.w); } vec4 getPositionMorphingMode(vec3 position3DWC) @@ -119,4 +111,4 @@ void main() v_rayleighColor = atmosColor.rayleigh; v_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz); #endif -} +} \ No newline at end of file From 3c5bc698c0546ab457a124c8d1a41c886b14ac21 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 10 Nov 2015 14:37:29 -0500 Subject: [PATCH 03/59] Add terrain exaggeration by modifying the mesh. --- Source/Core/HeightmapTerrainData.js | 7 +++++-- Source/Core/HeightmapTessellator.js | 3 ++- Source/Core/QuantizedMeshTerrainData.js | 7 +++++-- Source/Scene/FrameState.js | 2 ++ Source/Scene/Globe.js | 3 --- Source/Scene/GlobeSurfaceTile.js | 14 +++++++------- Source/Scene/GlobeSurfaceTileProvider.js | 2 +- Source/Scene/Scene.js | 18 +++++++++++++++++- Source/Scene/TileTerrain.js | 16 ++++++++-------- .../createVerticesFromQuantizedTerrainMesh.js | 3 ++- 10 files changed, 49 insertions(+), 26 deletions(-) diff --git a/Source/Core/HeightmapTerrainData.js b/Source/Core/HeightmapTerrainData.js index c82da0e9ac5a..7afba446359c 100644 --- a/Source/Core/HeightmapTerrainData.js +++ b/Source/Core/HeightmapTerrainData.js @@ -153,11 +153,12 @@ define([ * @param {Number} x The X coordinate of the tile for which to create the terrain data. * @param {Number} y The Y coordinate of the tile for which to create the terrain data. * @param {Number} level The level of the tile for which to create the terrain data. + * @param {Number} [exaggeration] The scale used to exaggerate the terrain. * @returns {Promise.|undefined} A promise for the terrain mesh, or undefined if too many * asynchronous mesh creations are already in progress and the operation should * be retried later. */ - HeightmapTerrainData.prototype.createMesh = function(tilingScheme, x, y, level) { + HeightmapTerrainData.prototype.createMesh = function(tilingScheme, x, y, level, exaggeration) { //>>includeStart('debug', pragmas.debug); if (!defined(tilingScheme)) { throw new DeveloperError('tilingScheme is required.'); @@ -176,6 +177,7 @@ define([ var ellipsoid = tilingScheme.ellipsoid; var nativeRectangle = tilingScheme.tileXYToNativeRectangle(x, y, level); var rectangle = tilingScheme.tileXYToRectangle(x, y, level); + exaggeration = defaultValue(exaggeration, 1.0); // Compute the center of the tile for RTC rendering. var center = ellipsoid.cartographicToCartesian(Rectangle.center(rectangle)); @@ -195,7 +197,8 @@ define([ relativeToCenter : center, ellipsoid : ellipsoid, skirtHeight : Math.min(thisLevelMaxError * 4.0, 1000.0), - isGeographic : tilingScheme instanceof GeographicTilingScheme + isGeographic : tilingScheme instanceof GeographicTilingScheme, + exaggeration : exaggeration }); if (!defined(verticesPromise)) { diff --git a/Source/Core/HeightmapTessellator.js b/Source/Core/HeightmapTessellator.js index db1c326719e7..2bd94bc9d0da 100644 --- a/Source/Core/HeightmapTessellator.js +++ b/Source/Core/HeightmapTessellator.js @@ -179,6 +179,7 @@ define([ } var relativeToCenter = defaultValue(options.relativeToCenter, Cartesian3.ZERO); + var exaggeration = defaultValue(options.exaggeration, 1.0); var structure = defaultValue(options.structure, HeightmapTessellator.DEFAULT_STRUCTURE); var heightScale = defaultValue(structure.heightScale, HeightmapTessellator.DEFAULT_STRUCTURE.heightScale); @@ -273,7 +274,7 @@ define([ } } - heightSample = heightSample * heightScale + heightOffset; + heightSample = (heightSample * heightScale + heightOffset) * exaggeration; maximumHeight = Math.max(maximumHeight, heightSample); minimumHeight = Math.min(minimumHeight, heightSample); diff --git a/Source/Core/QuantizedMeshTerrainData.js b/Source/Core/QuantizedMeshTerrainData.js index 33260e797059..987516d4f73c 100644 --- a/Source/Core/QuantizedMeshTerrainData.js +++ b/Source/Core/QuantizedMeshTerrainData.js @@ -235,11 +235,12 @@ define([ * @param {Number} x The X coordinate of the tile for which to create the terrain data. * @param {Number} y The Y coordinate of the tile for which to create the terrain data. * @param {Number} level The level of the tile for which to create the terrain data. + * @param {Number} [exaggeration] The scale used to exaggerate the terrain. * @returns {Promise.|undefined} A promise for the terrain mesh, or undefined if too many * asynchronous mesh creations are already in progress and the operation should * be retried later. */ - QuantizedMeshTerrainData.prototype.createMesh = function(tilingScheme, x, y, level) { + QuantizedMeshTerrainData.prototype.createMesh = function(tilingScheme, x, y, level, exaggeration) { //>>includeStart('debug', pragmas.debug); if (!defined(tilingScheme)) { throw new DeveloperError('tilingScheme is required.'); @@ -257,6 +258,7 @@ define([ var ellipsoid = tilingScheme.ellipsoid; var rectangle = tilingScheme.tileXYToRectangle(x, y, level); + exaggeration = defaultValue(exaggeration, 1.0); var verticesPromise = createMeshTaskProcessor.scheduleTask({ minimumHeight : this._minimumHeight, @@ -274,7 +276,8 @@ define([ northSkirtHeight : this._northSkirtHeight, rectangle : rectangle, relativeToCenter : this._boundingSphere.center, - ellipsoid : ellipsoid + ellipsoid : ellipsoid, + exaggeration : exaggeration }); if (!defined(verticesPromise)) { diff --git a/Source/Scene/FrameState.js b/Source/Scene/FrameState.js index d81711d57657..d85f5ac77029 100644 --- a/Source/Scene/FrameState.js +++ b/Source/Scene/FrameState.js @@ -156,6 +156,8 @@ define([ */ sse : undefined }; + + this.terrainExaggeration = undefined; }; /** diff --git a/Source/Scene/Globe.js b/Source/Scene/Globe.js index 24c4ea8478cf..64f251d393ca 100644 --- a/Source/Scene/Globe.js +++ b/Source/Scene/Globe.js @@ -269,8 +269,6 @@ define([ */ this.depthTestAgainstTerrain = false; - this.terrainExaggeration = 1.0; - this._oceanNormalMap = undefined; this._zoomedOutOceanSpecularIntensity = 0.5; this._lightingFadeDistance = new Cartesian2(this.lightingFadeOutDistance, this.lightingFadeInDistance); @@ -822,7 +820,6 @@ define([ tileProvider.hasWaterMask = hasWaterMask; tileProvider.oceanNormalMap = this._oceanNormalMap; tileProvider.enableLighting = this.enableLighting; - tileProvider.exaggeration = this.terrainExaggeration; surface.update(frameState); } diff --git a/Source/Scene/GlobeSurfaceTile.js b/Source/Scene/GlobeSurfaceTile.js index 752f2912e3b2..e9caed04ad97 100644 --- a/Source/Scene/GlobeSurfaceTile.js +++ b/Source/Scene/GlobeSurfaceTile.js @@ -295,7 +295,7 @@ define([ } }; - GlobeSurfaceTile.processStateMachine = function(tile, context, commandList, terrainProvider, imageryLayerCollection) { + GlobeSurfaceTile.processStateMachine = function(tile, frameState, terrainProvider, imageryLayerCollection) { var surfaceTile = tile.data; if (!defined(surfaceTile)) { surfaceTile = tile.data = new GlobeSurfaceTile(); @@ -307,7 +307,7 @@ define([ } if (tile.state === QuadtreeTileLoadState.LOADING) { - processTerrainStateMachine(tile, context, terrainProvider); + processTerrainStateMachine(tile, frameState, terrainProvider); } // The terrain is renderable as soon as we have a valid vertex array. @@ -345,7 +345,7 @@ define([ } } - var thisTileDoneLoading = tileImagery.processStateMachine(tile, context, commandList); + var thisTileDoneLoading = tileImagery.processStateMachine(tile, frameState.context, frameState.commandList); isDoneLoading = isDoneLoading && thisTileDoneLoading; // The imagery is renderable as soon as we have any renderable imagery for this region. @@ -433,14 +433,14 @@ define([ Cartesian3.normalize(northNormal, surfaceTile.northNormal); } - function processTerrainStateMachine(tile, context, terrainProvider) { + function processTerrainStateMachine(tile, frameState, terrainProvider) { var surfaceTile = tile.data; var loaded = surfaceTile.loadedTerrain; var upsampled = surfaceTile.upsampledTerrain; var suspendUpsampling = false; if (defined(loaded)) { - loaded.processLoadStateMachine(context, terrainProvider, tile.x, tile.y, tile.level); + loaded.processLoadStateMachine(frameState, terrainProvider, tile.x, tile.y, tile.level); // Publish the terrain data on the tile as soon as it is available. // We'll potentially need it to upsample child tiles. @@ -450,7 +450,7 @@ define([ // If there's a water mask included in the terrain data, create a // texture for it. - createWaterMaskTextureIfNeeded(context, surfaceTile); + createWaterMaskTextureIfNeeded(frameState.context, surfaceTile); propagateNewLoadedDataToChildren(tile); } @@ -473,7 +473,7 @@ define([ } if (!suspendUpsampling && defined(upsampled)) { - upsampled.processUpsampleStateMachine(context, terrainProvider, tile.x, tile.y, tile.level); + upsampled.processUpsampleStateMachine(frameState, terrainProvider, tile.x, tile.y, tile.level); // Publish the terrain data on the tile as soon as it is available. // We'll potentially need it to upsample child tiles. diff --git a/Source/Scene/GlobeSurfaceTileProvider.js b/Source/Scene/GlobeSurfaceTileProvider.js index 3b6748bdb49f..8c87228258e2 100644 --- a/Source/Scene/GlobeSurfaceTileProvider.js +++ b/Source/Scene/GlobeSurfaceTileProvider.js @@ -423,7 +423,7 @@ define([ * @exception {DeveloperError} loadTile must not be called before the tile provider is ready. */ GlobeSurfaceTileProvider.prototype.loadTile = function(frameState, tile) { - GlobeSurfaceTile.processStateMachine(tile, frameState.context, frameState.commandList, this._terrainProvider, this._imageryLayers); + GlobeSurfaceTile.processStateMachine(tile, frameState, this._terrainProvider, this._imageryLayers); }; var boundingSphereScratch = new BoundingSphere(); diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 5d929beecf59..97db7d116ee6 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -172,7 +172,9 @@ define([ * @param {Element} [options.creditContainer] The HTML element in which the credits will be displayed. * @param {MapProjection} [options.mapProjection=new GeographicProjection()] The map projection to use in 2D and Columbus View modes. * @param {Boolean} [options.orderIndependentTranslucency=true] If true and the configuration supports it, use order independent translucency. - * @param {Boolean} [options.scene3DOnly=false] If true, optimizes memory use and performance for 3D mode but disables the ability to use 2D or Columbus View. * + * @param {Boolean} [options.scene3DOnly=false] If true, optimizes memory use and performance for 3D mode but disables the ability to use 2D or Columbus View. + * @param {Number} [options.terrainExaggeration=1.0] A scalar used to exaggerate the terrain. + * * @see CesiumWidget * @see {@link http://www.khronos.org/registry/webgl/specs/latest/#5.2|WebGLContextAttributes} * @@ -514,6 +516,8 @@ define([ */ this.fog = new Fog(); + this._terrainExaggeration = defaultValue(options.terrainExaggeration, 1.0); + this._performanceDisplay = undefined; this._debugVolume = undefined; @@ -924,6 +928,17 @@ define([ get : function() { return this._frustumCommandsList.length; } + }, + + /** + * Gets the scalar used to exaggerate the terrain. + * @memberof Scene.prototype + * @type {Number} + */ + terrainExaggeration : { + get : function() { + return this._terrainExaggeration; + } } }); @@ -982,6 +997,7 @@ define([ frameState.camera = camera; frameState.cullingVolume = camera.frustum.computeCullingVolume(camera.positionWC, camera.directionWC, camera.upWC); frameState.occluder = getOccluder(scene); + frameState.terrainExaggeration = scene._terrainExaggeration; clearPasses(frameState.passes); } diff --git a/Source/Scene/TileTerrain.js b/Source/Scene/TileTerrain.js index f00ace57aae8..b604901bad62 100644 --- a/Source/Scene/TileTerrain.js +++ b/Source/Scene/TileTerrain.js @@ -96,17 +96,17 @@ define([ this.vertexArray = undefined; }; - TileTerrain.prototype.processLoadStateMachine = function(context, terrainProvider, x, y, level) { + TileTerrain.prototype.processLoadStateMachine = function(frameState, terrainProvider, x, y, level) { if (this.state === TerrainState.UNLOADED) { requestTileGeometry(this, terrainProvider, x, y, level); } if (this.state === TerrainState.RECEIVED) { - transform(this, context, terrainProvider, x, y, level); + transform(this, frameState, terrainProvider, x, y, level); } if (this.state === TerrainState.TRANSFORMED) { - createResources(this, context, terrainProvider, x, y, level); + createResources(this, frameState.context, terrainProvider, x, y, level); } }; @@ -150,7 +150,7 @@ define([ doRequest(); } - TileTerrain.prototype.processUpsampleStateMachine = function(context, terrainProvider, x, y, level) { + TileTerrain.prototype.processUpsampleStateMachine = function(frameState, terrainProvider, x, y, level) { if (this.state === TerrainState.UNLOADED) { var upsampleDetails = this.upsampleDetails; @@ -183,19 +183,19 @@ define([ } if (this.state === TerrainState.RECEIVED) { - transform(this, context, terrainProvider, x, y, level); + transform(this, frameState, terrainProvider, x, y, level); } if (this.state === TerrainState.TRANSFORMED) { - createResources(this, context, terrainProvider, x, y, level); + createResources(this, frameState.context, terrainProvider, x, y, level); } }; - function transform(tileTerrain, context, terrainProvider, x, y, level) { + function transform(tileTerrain, frameState, terrainProvider, x, y, level) { var tilingScheme = terrainProvider.tilingScheme; var terrainData = tileTerrain.data; - var meshPromise = terrainData.createMesh(tilingScheme, x, y, level); + var meshPromise = terrainData.createMesh(tilingScheme, x, y, level, frameState.terrainExaggeration); if (!defined(meshPromise)) { // Postponed. diff --git a/Source/Workers/createVerticesFromQuantizedTerrainMesh.js b/Source/Workers/createVerticesFromQuantizedTerrainMesh.js index 2a5f354e1daf..5ed45fc6b36b 100644 --- a/Source/Workers/createVerticesFromQuantizedTerrainMesh.js +++ b/Source/Workers/createVerticesFromQuantizedTerrainMesh.js @@ -44,6 +44,7 @@ define([ var minimumHeight = parameters.minimumHeight; var maximumHeight = parameters.maximumHeight; var center = parameters.relativeToCenter; + var exaggeration = parameters.exaggeration; var rectangle = parameters.rectangle; var west = rectangle.west; @@ -72,7 +73,7 @@ define([ cartographicScratch.longitude = CesiumMath.lerp(west, east, u); cartographicScratch.latitude = CesiumMath.lerp(south, north, v); - cartographicScratch.height = height; + cartographicScratch.height = height * exaggeration; ellipsoid.cartographicToCartesian(cartographicScratch, cartesian3Scratch); From aaa83f603b571fde3edf45fdaaa5a7d4c8c94083 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 10 Nov 2015 14:49:37 -0500 Subject: [PATCH 04/59] Add terrain exaggeration option to viewer. --- Source/Widgets/CesiumWidget/CesiumWidget.js | 4 +++- Source/Widgets/Viewer/Viewer.js | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/Widgets/CesiumWidget/CesiumWidget.js b/Source/Widgets/CesiumWidget/CesiumWidget.js index 9d285cc0078e..397f9a265e0b 100644 --- a/Source/Widgets/CesiumWidget/CesiumWidget.js +++ b/Source/Widgets/CesiumWidget/CesiumWidget.js @@ -153,6 +153,7 @@ define([ * @param {Object} [options.contextOptions] Context and WebGL creation properties corresponding to options passed to {@link Scene}. * @param {Element|String} [options.creditContainer] The DOM element or ID that will contain the {@link CreditDisplay}. If not specified, the credits are added * to the bottom of the widget itself. + * @param {Number} [terrainExaggeration] The scalar amount to exaggerate the terrain. * * @exception {DeveloperError} Element with id "container" does not exist in the document. * @@ -242,7 +243,8 @@ define([ creditContainer : creditContainer, mapProjection : options.mapProjection, orderIndependentTranslucency : options.orderIndependentTranslucency, - scene3DOnly : defaultValue(options.scene3DOnly, false) + scene3DOnly : defaultValue(options.scene3DOnly, false), + terrainExaggeration : options.terrainExaggeration }); this._scene = scene; diff --git a/Source/Widgets/Viewer/Viewer.js b/Source/Widgets/Viewer/Viewer.js index 74001f284302..531d6023a01b 100644 --- a/Source/Widgets/Viewer/Viewer.js +++ b/Source/Widgets/Viewer/Viewer.js @@ -218,7 +218,8 @@ define([ * @param {Boolean} [options.orderIndependentTranslucency=true] If true and the configuration supports it, use order independent translucency. * @param {Element|String} [options.creditContainer] The DOM element or ID that will contain the {@link CreditDisplay}. If not specified, the credits are added to the bottom of the widget itself. * @param {DataSourceCollection} [options.dataSources=new DataSourceCollection()] The collection of data sources visualized by the widget. If this parameter is provided, - the instance is assumed to be owned by the caller and will not be destroyed when the viewer is destroyed. + * the instance is assumed to be owned by the caller and will not be destroyed when the viewer is destroyed. + * @param {Number} The scalar amount to exaggerate the terrain. * * @exception {DeveloperError} Element with id "container" does not exist in the document. * @exception {DeveloperError} options.imageryProvider is not available when using the BaseLayerPicker widget, specify options.selectedImageryProviderViewModel instead. @@ -348,7 +349,8 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to targetFrameRate : options.targetFrameRate, showRenderLoopErrors : options.showRenderLoopErrors, creditContainer : defined(options.creditContainer) ? options.creditContainer : bottomContainer, - scene3DOnly : scene3DOnly + scene3DOnly : scene3DOnly, + terrainExaggeration : options.terrainExaggeration }); var dataSourceCollection = options.dataSources; From e38761a7e6e2eec9b822015e04999603b40af889 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Tue, 10 Nov 2015 16:16:43 -0500 Subject: [PATCH 05/59] Added getBaseUri --- Source/Core/getBaseUri.js | 38 +++++++++++++++++++++++++++++++ Source/Core/getFilenameFromUri.js | 2 +- Source/Scene/Model.js | 14 +++--------- Specs/Core/getBaseUriSpec.js | 22 ++++++++++++++++++ 4 files changed, 64 insertions(+), 12 deletions(-) create mode 100644 Source/Core/getBaseUri.js create mode 100644 Specs/Core/getBaseUriSpec.js diff --git a/Source/Core/getBaseUri.js b/Source/Core/getBaseUri.js new file mode 100644 index 000000000000..b14876fcdfae --- /dev/null +++ b/Source/Core/getBaseUri.js @@ -0,0 +1,38 @@ +/*global define*/ +define([ + './defined', + './DeveloperError' + ], function( + defined, + DeveloperError) { + "use strict"; + + /** + * Given a URI, returns the base path of the URI. + * @exports getBaseUri + * + * @param {String} uri The Uri. + * @returns {String} The base path of the Uri. + * + * @example + * // basePath will be "/Gallery/"; + * var basePath = Cesium.getBaseUri('/Gallery/simple.czml?value=true&example=false'); + */ + var getBaseUri = function(uri) { + //>>includeStart('debug', pragmas.debug); + if (!defined(uri)) { + throw new DeveloperError('uri is required.'); + } + //>>includeEnd('debug'); + + var basePath = ''; + var i = uri.lastIndexOf('/'); + if (i !== -1) { + basePath = uri.substring(0, i + 1); + } + + return basePath; + }; + + return getBaseUri; +}); diff --git a/Source/Core/getFilenameFromUri.js b/Source/Core/getFilenameFromUri.js index a08ee2c26be6..09f7cd4ab8de 100644 --- a/Source/Core/getFilenameFromUri.js +++ b/Source/Core/getFilenameFromUri.js @@ -38,4 +38,4 @@ define([ }; return getFilenameFromUri; -}); \ No newline at end of file +}); diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 53e1732d5238..0a667b7d1662 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -15,6 +15,7 @@ define([ '../Core/DeveloperError', '../Core/Event', '../Core/FeatureDetection', + '../Core/getBaseUri', '../Core/getMagic', '../Core/getStringFromTypedArray', '../Core/IndexDatatype', @@ -70,6 +71,7 @@ define([ DeveloperError, Event, FeatureDetection, + getBaseUri, getMagic, getStringFromTypedArray, IndexDatatype, @@ -738,16 +740,6 @@ define([ } }); - function getBasePath(url) { - var basePath = ''; - var i = url.lastIndexOf('/'); - if (i !== -1) { - basePath = url.substring(0, i + 1); - } - - return basePath; - } - function getAbsoluteURL(url) { var docUri = new Uri(document.location.href); var modelUri = new Uri(url); @@ -886,7 +878,7 @@ define([ var cacheKey = defaultValue(options.cacheKey, getAbsoluteURL(url)); options = clone(options); - options.basePath = getBasePath(url); + options.basePath = getBaseUri(url); options.cacheKey = cacheKey; var model = new Model(options); diff --git a/Specs/Core/getBaseUriSpec.js b/Specs/Core/getBaseUriSpec.js new file mode 100644 index 000000000000..cd45ddf19913 --- /dev/null +++ b/Specs/Core/getBaseUriSpec.js @@ -0,0 +1,22 @@ +/*global defineSuite*/ +defineSuite([ + 'Core/getBaseUri' + ], function( + getBaseUri) { + "use strict"; + /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ + + it('works as expected', function() { + var result = getBaseUri('http://www.mysite.com/awesome?makeitawesome=true'); + expect(result).toEqual('http://www.mysite.com/'); + + result = getBaseUri('http://www.mysite.com/somefolder/awesome.png#makeitawesome'); + expect(result).toEqual('http://www.mysite.com/somefolder/'); + }); + + it('throws with undefined parameter', function() { + expect(function() { + getBaseUri(undefined); + }).toThrowDeveloperError(); + }); +}); From bb5cfa3aa8e127a2186a7bce45a93a372d04155e Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Tue, 10 Nov 2015 16:40:59 -0500 Subject: [PATCH 06/59] Replaced name with id in Model --- Source/Scene/Model.js | 244 +++++++++++++++++++-------------------- Specs/Scene/ModelSpec.js | 4 +- 2 files changed, 123 insertions(+), 125 deletions(-) diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 0a667b7d1662..36fadef5b72d 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -13,7 +13,6 @@ define([ '../Core/deprecationWarning', '../Core/destroyObject', '../Core/DeveloperError', - '../Core/Event', '../Core/FeatureDetection', '../Core/getBaseUri', '../Core/getMagic', @@ -69,7 +68,6 @@ define([ deprecationWarning, destroyObject, DeveloperError, - Event, FeatureDetection, getBaseUri, getMagic, @@ -156,7 +154,7 @@ define([ this.createUniformMaps = true; this.createRuntimeNodes = true; - this.skinnedNodesNames = []; + this.skinnedNodesIds = []; } LoadResources.prototype.getBuffer = function(bufferView) { @@ -251,9 +249,9 @@ define([ var animationIds = []; if (defined(cachedGltf) && defined(cachedGltf.gltf)) { var animations = cachedGltf.gltf.animations; - for (var name in animations) { - if (animations.hasOwnProperty(name)) { - animationIds.push(name); + for (var id in animations) { + if (animations.hasOwnProperty(id)) { + animationIds.push(id); } } } @@ -1063,30 +1061,30 @@ define([ }; } - function bufferLoad(model, name) { + function bufferLoad(model, id) { return function(arrayBuffer) { var loadResources = model._loadResources; - loadResources.buffers[name] = new Uint8Array(arrayBuffer); + loadResources.buffers[id] = new Uint8Array(arrayBuffer); --loadResources.pendingBufferLoads; }; } function parseBuffers(model) { var buffers = model.gltf.buffers; - for (var name in buffers) { - if (buffers.hasOwnProperty(name)) { - var buffer = buffers[name]; + for (var id in buffers) { + if (buffers.hasOwnProperty(id)) { + var buffer = buffers[id]; - if (name === 'CESIUM_binary_glTF' || name === 'KHR_binary_glTF') { + if (id === 'CESIUM_binary_glTF' || id === 'KHR_binary_glTF') { // Buffer is the binary glTF file itself that is already loaded var loadResources = model._loadResources; - loadResources.buffers[name] = model._cachedGltf.bgltf; + loadResources.buffers[id] = model._cachedGltf.bgltf; } else if (buffer.type === 'arraybuffer') { ++model._loadResources.pendingBufferLoads; var uri = new Uri(buffer.uri); var bufferPath = uri.resolve(model._baseUri).toString(); - loadArrayBuffer(bufferPath).then(bufferLoad(model, name)).otherwise(getFailedLoadFunction(model, 'buffer', bufferPath)); + loadArrayBuffer(bufferPath).then(bufferLoad(model, id)).otherwise(getFailedLoadFunction(model, 'buffer', bufferPath)); } else if (buffer.type === 'text') { // GLTF_SPEC: Load compressed .bin with loadText. https://github.com/KhronosGroup/glTF/issues/230 } @@ -1096,19 +1094,19 @@ define([ function parseBufferViews(model) { var bufferViews = model.gltf.bufferViews; - for (var name in bufferViews) { - if (bufferViews.hasOwnProperty(name)) { - if (bufferViews[name].target === WebGLConstants.ARRAY_BUFFER) { - model._loadResources.buffersToCreate.enqueue(name); + for (var id in bufferViews) { + if (bufferViews.hasOwnProperty(id)) { + if (bufferViews[id].target === WebGLConstants.ARRAY_BUFFER) { + model._loadResources.buffersToCreate.enqueue(id); } } } } - function shaderLoad(model, name) { + function shaderLoad(model, id) { return function(source) { var loadResources = model._loadResources; - loadResources.shaders[name] = { + loadResources.shaders[id] = { source : source, bufferView : undefined }; @@ -1118,13 +1116,13 @@ define([ function parseShaders(model) { var shaders = model.gltf.shaders; - for (var name in shaders) { - if (shaders.hasOwnProperty(name)) { - var shader = shaders[name]; + for (var id in shaders) { + if (shaders.hasOwnProperty(id)) { + var shader = shaders[id]; // Shader references either uri (external or base64-encoded) or bufferView if (defined(shader.extras) && defined(shader.extras.source)) { - model._loadResources.shaders[name] = { + model._loadResources.shaders[id] = { source : shader.extras.source, bufferView : undefined }; @@ -1139,7 +1137,7 @@ define([ binary = shader.extensions.KHR_binary_glTF; } - model._loadResources.shaders[name] = { + model._loadResources.shaders[id] = { source : undefined, bufferView : binary.bufferView }; @@ -1147,7 +1145,7 @@ define([ ++model._loadResources.pendingShaderLoads; var uri = new Uri(shader.uri); var shaderPath = uri.resolve(model._baseUri).toString(); - loadText(shaderPath).then(shaderLoad(model, name)).otherwise(getFailedLoadFunction(model, 'shader', shaderPath)); + loadText(shaderPath).then(shaderLoad(model, id)).otherwise(getFailedLoadFunction(model, 'shader', shaderPath)); } } } @@ -1155,19 +1153,19 @@ define([ function parsePrograms(model) { var programs = model.gltf.programs; - for (var name in programs) { - if (programs.hasOwnProperty(name)) { - model._loadResources.programsToCreate.enqueue(name); + for (var id in programs) { + if (programs.hasOwnProperty(id)) { + model._loadResources.programsToCreate.enqueue(id); } } } - function imageLoad(model, name) { + function imageLoad(model, id) { return function(image) { var loadResources = model._loadResources; --loadResources.pendingTextureLoads; loadResources.texturesToCreate.enqueue({ - name : name, + id : id, image : image, bufferView : undefined }); @@ -1177,9 +1175,9 @@ define([ function parseTextures(model) { var images = model.gltf.images; var textures = model.gltf.textures; - for (var name in textures) { - if (textures.hasOwnProperty(name)) { - var gltfImage = images[textures[name].source]; + for (var id in textures) { + if (textures.hasOwnProperty(id)) { + var gltfImage = images[textures[id].source]; // Image references either uri (external or base64-encoded) or bufferView if (defined(gltfImage.extensions) && @@ -1192,7 +1190,7 @@ define([ binary = gltfImage.extensions.KHR_binary_glTF; } model._loadResources.texturesToCreateFromBufferView.enqueue({ - name : name, + id : id, image : undefined, bufferView : binary.bufferView, mimeType : binary.mimeType @@ -1201,7 +1199,7 @@ define([ ++model._loadResources.pendingTextureLoads; var uri = new Uri(gltfImage.uri); var imagePath = uri.resolve(model._baseUri).toString(); - loadImage(imagePath).then(imageLoad(model, name)).otherwise(getFailedLoadFunction(model, 'image', imagePath)); + loadImage(imagePath).then(imageLoad(model, id)).otherwise(getFailedLoadFunction(model, 'image', imagePath)); } } } @@ -1227,12 +1225,12 @@ define([ var runtimeNodesByName = {}; var skinnedNodes = []; - var skinnedNodesNames = model._loadResources.skinnedNodesNames; + var skinnedNodesIds = model._loadResources.skinnedNodesIds; var nodes = model.gltf.nodes; - for (var name in nodes) { - if (nodes.hasOwnProperty(name)) { - var node = nodes[name]; + for (var id in nodes) { + if (nodes.hasOwnProperty(id)) { + var node = nodes[id]; var runtimeNode = { // Animation targets @@ -1268,13 +1266,13 @@ define([ // Publicly-accessible ModelNode instance to modify animation targets publicNode : undefined }; - runtimeNode.publicNode = new ModelNode(model, node, runtimeNode, name, getTransform(node)); + runtimeNode.publicNode = new ModelNode(model, node, runtimeNode, id, getTransform(node)); - runtimeNodes[name] = runtimeNode; + runtimeNodes[id] = runtimeNode; runtimeNodesByName[node.name] = runtimeNode; if (defined(node.skin)) { - skinnedNodesNames.push(name); + skinnedNodesIds.push(id); skinnedNodes.push(runtimeNode); } } @@ -1286,44 +1284,44 @@ define([ } function parseMaterials(model) { - var runtimeMaterials = {}; + var runtimeMaterialsByName = {}; var runtimeMaterialsById = {}; var materials = model.gltf.materials; var uniformMaps = model._uniformMaps; - for (var name in materials) { - if (materials.hasOwnProperty(name)) { + for (var id in materials) { + if (materials.hasOwnProperty(id)) { // Allocated now so ModelMaterial can keep a reference to it. - uniformMaps[name] = { + uniformMaps[id] = { uniformMap : undefined, values : undefined, jointMatrixUniformName : undefined }; - var material = materials[name]; - var modelMaterial = new ModelMaterial(model, material, name); - runtimeMaterials[material.name] = modelMaterial; - runtimeMaterialsById[name] = modelMaterial; + var material = materials[id]; + var modelMaterial = new ModelMaterial(model, material, id); + runtimeMaterialsByName[material.name] = modelMaterial; + runtimeMaterialsById[id] = modelMaterial; } } - model._runtime.materialsByName = runtimeMaterials; + model._runtime.materialsByName = runtimeMaterialsByName; model._runtime.materialsById = runtimeMaterialsById; } function parseMeshes(model) { - var runtimeMeshes = {}; + var runtimeMeshesByName = {}; var runtimeMaterialsById = model._runtime.materialsById; var meshes = model.gltf.meshes; - for (var name in meshes) { - if (meshes.hasOwnProperty(name)) { - var mesh = meshes[name]; - runtimeMeshes[mesh.name] = new ModelMesh(mesh, runtimeMaterialsById, name); + for (var id in meshes) { + if (meshes.hasOwnProperty(id)) { + var mesh = meshes[id]; + runtimeMeshesByName[mesh.name] = new ModelMesh(mesh, runtimeMaterialsById, id); } } - model._runtime.meshesByName = runtimeMeshes; + model._runtime.meshesByName = runtimeMeshesByName; } function parse(model) { @@ -1354,8 +1352,8 @@ define([ var rendererBuffers = model._rendererResources.buffers; while (loadResources.buffersToCreate.length > 0) { - var bufferViewName = loadResources.buffersToCreate.dequeue(); - bufferView = bufferViews[bufferViewName]; + var bufferViewId = loadResources.buffersToCreate.dequeue(); + bufferView = bufferViews[bufferViewId]; // Only ARRAY_BUFFER here. ELEMENT_ARRAY_BUFFER created below. var vertexBuffer = Buffer.createVertexBuffer({ @@ -1364,16 +1362,16 @@ define([ usage : BufferUsage.STATIC_DRAW }); vertexBuffer.vertexArrayDestroyable = false; - rendererBuffers[bufferViewName] = vertexBuffer; + rendererBuffers[bufferViewId] = vertexBuffer; } // The Cesium Renderer requires knowing the datatype for an index buffer // at creation type, which is not part of the glTF bufferview so loop // through glTF accessors to create the bufferview's index buffer. var accessors = model.gltf.accessors; - for (var name in accessors) { - if (accessors.hasOwnProperty(name)) { - var accessor = accessors[name]; + for (var id in accessors) { + if (accessors.hasOwnProperty(id)) { + var accessor = accessors[id]; bufferView = bufferViews[accessor.bufferView]; if ((bufferView.target === WebGLConstants.ELEMENT_ARRAY_BUFFER) && !defined(rendererBuffers[accessor.bufferView])) { @@ -1416,16 +1414,16 @@ define([ return getStringFromTypedArray(loadResources.getBuffer(bufferView)); } - function createProgram(name, model, context) { + function createProgram(id, model, context) { var programs = model.gltf.programs; var shaders = model._loadResources.shaders; - var program = programs[name]; + var program = programs[id]; var attributeLocations = createAttributeLocations(program.attributes); var vs = getShaderSource(model, shaders[program.vertexShader]); var fs = getShaderSource(model, shaders[program.fragmentShader]); - model._rendererResources.programs[name] = ShaderProgram.fromCache({ + model._rendererResources.programs[id] = ShaderProgram.fromCache({ context : context, vertexShaderSource : vs, fragmentShaderSource : fs, @@ -1439,7 +1437,7 @@ define([ pickColorQualifier : 'uniform' }); - model._rendererResources.pickPrograms[name] = ShaderProgram.fromCache({ + model._rendererResources.pickPrograms[id] = ShaderProgram.fromCache({ context : context, vertexShaderSource : vs, fragmentShaderSource : pickFS, @@ -1450,7 +1448,7 @@ define([ function createPrograms(model, context) { var loadResources = model._loadResources; - var name; + var id; if (loadResources.pendingShaderLoads !== 0) { return; @@ -1465,14 +1463,14 @@ define([ if (model.asynchronous) { // Create one program per frame if (loadResources.programsToCreate.length > 0) { - name = loadResources.programsToCreate.dequeue(); - createProgram(name, model, context); + id = loadResources.programsToCreate.dequeue(); + createProgram(id, model, context); } } else { // Create all loaded programs this frame while (loadResources.programsToCreate.length > 0) { - name = loadResources.programsToCreate.dequeue(); - createProgram(name, model, context); + id = loadResources.programsToCreate.dequeue(); + createProgram(id, model, context); } } } @@ -1480,7 +1478,7 @@ define([ function getOnImageCreatedFromTypedArray(loadResources, gltfTexture) { return function(image) { loadResources.texturesToCreate.enqueue({ - name : gltfTexture.name, + id : gltfTexture.id, image : image, bufferView : undefined }); @@ -1503,7 +1501,7 @@ define([ var bufferView = gltf.bufferViews[gltfTexture.bufferView]; var onload = getOnImageCreatedFromTypedArray(loadResources, gltfTexture); - var onerror = getFailedLoadFunction(model, 'image', 'name: ' + gltfTexture.name + ', bufferView: ' + gltfTexture.bufferView); + var onerror = getFailedLoadFunction(model, 'image', 'id: ' + gltfTexture.id + ', bufferView: ' + gltfTexture.bufferView); loadImageFromTypedArray(loadResources.getBuffer(bufferView), gltfTexture.mimeType). then(onload).otherwise(onerror); @@ -1519,11 +1517,11 @@ define([ var rendererSamplers = model._rendererResources.samplers; var samplers = model.gltf.samplers; - for (var name in samplers) { - if (samplers.hasOwnProperty(name)) { - var sampler = samplers[name]; + for (var id in samplers) { + if (samplers.hasOwnProperty(id)) { + var sampler = samplers[id]; - rendererSamplers[name] = new Sampler({ + rendererSamplers[id] = new Sampler({ wrapS : sampler.wrapS, wrapT : sampler.wrapT, minificationFilter : sampler.minFilter, @@ -1536,7 +1534,7 @@ define([ function createTexture(gltfTexture, model, context) { var textures = model.gltf.textures; - var texture = textures[gltfTexture.name]; + var texture = textures[gltfTexture.id]; var rendererSamplers = model._rendererResources.samplers; var sampler = rendererSamplers[texture.sampler]; @@ -1583,7 +1581,7 @@ define([ } tx.sampler = sampler; - model._rendererResources.textures[gltfTexture.name] = tx; + model._rendererResources.textures[gltfTexture.id] = tx; } function createTextures(model, context) { @@ -1660,12 +1658,12 @@ define([ var nodes = gltf.nodes; var runtimeNodes = model._runtime.nodes; - var skinnedNodesNames = model._loadResources.skinnedNodesNames; - var length = skinnedNodesNames.length; + var skinnedNodesIds = model._loadResources.skinnedNodesIds; + var length = skinnedNodesIds.length; for (var j = 0; j < length; ++j) { - var name = skinnedNodesNames[j]; - var skinnedNode = runtimeNodes[name]; - var node = nodes[name]; + var id = skinnedNodesIds[j]; + var skinnedNode = runtimeNodes[id]; + var node = nodes[id]; var runtimeSkin = runtimeSkins[node.skin]; skinnedNode.inverseBindMatrices = runtimeSkin.inverseBindMatrices; @@ -1707,9 +1705,9 @@ define([ var skins = gltf.skins; var runtimeSkins = {}; - for (var name in skins) { - if (skins.hasOwnProperty(name)) { - var skin = skins[name]; + for (var id in skins) { + if (skins.hasOwnProperty(id)) { + var skin = skins[id]; var accessor = accessors[skin.inverseBindMatrices]; var bindShapeMatrix; @@ -1717,7 +1715,7 @@ define([ bindShapeMatrix = Matrix4.clone(skin.bindShapeMatrix); } - runtimeSkins[name] = { + runtimeSkins[id] = { inverseBindMatrices : ModelAnimationCache.getSkinInverseBindMatrices(model, accessor), bindShapeMatrix : bindShapeMatrix // not used when undefined }; @@ -1729,12 +1727,11 @@ define([ function getChannelEvaluator(model, runtimeNode, targetPath, spline) { return function(localAnimationTime) { -// Workaround for https://github.com/KhronosGroup/glTF/issues/219 -/* - if (targetPath === 'translation') { - return; - } -*/ + // Workaround for https://github.com/KhronosGroup/glTF/issues/219 + + //if (targetPath === 'translation') { + // return; + //} runtimeNode[targetPath] = spline.evaluate(localAnimationTime, runtimeNode[targetPath]); runtimeNode.dirtyNumber = model._maxDirtyNumber; }; @@ -1758,18 +1755,17 @@ define([ var runtimeNodes = model._runtime.nodes; var animations = model.gltf.animations; var accessors = model.gltf.accessors; - var name; - for (var animationName in animations) { - if (animations.hasOwnProperty(animationName)) { - var animation = animations[animationName]; + for (var animationId in animations) { + if (animations.hasOwnProperty(animationId)) { + var animation = animations[animationId]; var channels = animation.channels; var parameters = animation.parameters; var samplers = animation.samplers; var parameterValues = {}; - for (name in parameters) { + for (var name in parameters) { if (parameters.hasOwnProperty(name)) { parameterValues[name] = ModelAnimationCache.getAnimationParameterValues(model, accessors[parameters[name]]); } @@ -1791,12 +1787,12 @@ define([ startTime = Math.min(startTime, times[0]); stopTime = Math.max(stopTime, times[times.length - 1]); - var spline = ModelAnimationCache.getAnimationSpline(model, animationName, animation, channel.sampler, sampler, parameterValues); + var spline = ModelAnimationCache.getAnimationSpline(model, animationId, animation, channel.sampler, sampler, parameterValues); // GLTF_SPEC: Support more targets like materials. https://github.com/KhronosGroup/glTF/issues/142 channelEvaluators[i] = getChannelEvaluator(model, runtimeNodes[target.id], target.path, spline); } - model._runtime.animations[animationName] = { + model._runtime.animations[animationId] = { startTime : startTime, stopTime : stopTime, channelEvaluators : channelEvaluators @@ -1823,9 +1819,9 @@ define([ var accessors = gltf.accessors; var meshes = gltf.meshes; - for (var meshName in meshes) { - if (meshes.hasOwnProperty(meshName)) { - var primitives = meshes[meshName].primitives; + for (var meshId in meshes) { + if (meshes.hasOwnProperty(meshId)) { + var primitives = meshes[meshId].primitives; var primitivesLength = primitives.length; for (var i = 0; i < primitivesLength; ++i) { @@ -1865,7 +1861,7 @@ define([ var accessor = accessors[primitive.indices]; indexBuffer = rendererBuffers[accessor.bufferView]; } - rendererVertexArrays[meshName + '.primitive.' + i] = new VertexArray({ + rendererVertexArrays[meshId + '.primitive.' + i] = new VertexArray({ context : context, attributes : attrs, indexBuffer : indexBuffer @@ -1901,9 +1897,9 @@ define([ loadResources.createRenderStates = false; var rendererRenderStates = model._rendererResources.renderStates; var techniques = model.gltf.techniques; - for (var name in techniques) { - if (techniques.hasOwnProperty(name)) { - var technique = techniques[name]; + for (var id in techniques) { + if (techniques.hasOwnProperty(id)) { + var technique = techniques[id]; var states = technique.states; var booleanStates = getBooleanStates(states); @@ -1922,7 +1918,7 @@ define([ var polygonOffset = defaultValue(statesFunctions.polygonOffset, [0.0, 0.0]); var scissor = defaultValue(statesFunctions.scissor, [0.0, 0.0, 0.0, 0.0]); - rendererRenderStates[name] = RenderState.fromCache({ + rendererRenderStates[id] = RenderState.fromCache({ frontFace : defined(statesFunctions.frontFace) ? statesFunctions.frontFace[0] : WebGLConstants.CCW, cull : { enabled : booleanStates[WebGLConstants.CULL_FACE], @@ -2053,7 +2049,7 @@ define([ return uniformState.viewportCartesian4; }; } - // JOINTMATRIX created in createCommands() + // JOINTMATRIX created in createCommand() }; /////////////////////////////////////////////////////////////////////////// @@ -2293,9 +2289,9 @@ define([ var programs = gltf.programs; var uniformMaps = model._uniformMaps; - for (var materialName in materials) { - if (materials.hasOwnProperty(materialName)) { - var material = materials[materialName]; + for (var materialId in materials) { + if (materials.hasOwnProperty(materialId)) { + var material = materials[materialId]; var instanceParameters = material.values; var technique = techniques[material.technique]; var parameters = technique.parameters; @@ -2345,7 +2341,7 @@ define([ } } - var u = uniformMaps[materialName]; + var u = uniformMaps[materialId]; u.uniformMap = uniformMap; // uniform name -> function for the renderer u.values = uniformValues; // material parameter name -> ModelMaterial for modifying the parameter at runtime u.jointMatrixUniformName = jointMatrixUniformName; @@ -2369,7 +2365,7 @@ define([ var nodeCommands = model._nodeCommands; var pickIds = model._pickIds; var allowPicking = model.allowPicking; - var runtimeMeshes = model._runtime.meshesByName; + var runtimeMeshesByName = model._runtime.meshesByName; var debugShowBoundingVolume = model.debugShowBoundingVolume; @@ -2390,8 +2386,8 @@ define([ var meshesLength = meshes.length; for (var j = 0; j < meshesLength; ++j) { - var name = meshes[j]; - var mesh = gltfMeshes[name]; + var id = meshes[j]; + var mesh = gltfMeshes[id]; var primitives = mesh.primitives; var length = primitives.length; @@ -2412,7 +2408,7 @@ define([ boundingSphere = BoundingSphere.fromCornerPoints(Cartesian3.fromArray(a.min), Cartesian3.fromArray(a.max)); } - var vertexArray = rendererVertexArrays[name + '.primitive.' + i]; + var vertexArray = rendererVertexArrays[id + '.primitive.' + i]; var offset; var count; if (defined(ix)) { @@ -2442,7 +2438,7 @@ define([ primitive : defaultValue(model.pickPrimitive, model), id : model.id, node : runtimeNode.publicNode, - mesh : runtimeMeshes[mesh.name] + mesh : runtimeMeshesByName[mesh.name] }; var command = new DrawCommand({ @@ -2576,7 +2572,9 @@ define([ model._runtime.nodes = runtimeNodes; } - function createResources(model, context) { + function createResources(model, frameState) { + var context = frameState.context; + if (model._loadRendererResourcesFromCache) { var resources = model._rendererResources; var cachedResources = model._cachedRendererResources; @@ -3021,7 +3019,7 @@ define([ if (this._state === ModelState.LOADING) { // Incrementally create WebGL resources as buffers/shaders/textures are downloaded - createResources(this, context); + createResources(this, frameState); var loadResources = this._loadResources; if (loadResources.finishedPendingLoads() && loadResources.finishedResourceCreation()) { diff --git a/Specs/Scene/ModelSpec.js b/Specs/Scene/ModelSpec.js index 3ed92a68bb78..99b33618d649 100644 --- a/Specs/Scene/ModelSpec.js +++ b/Specs/Scene/ModelSpec.js @@ -363,7 +363,7 @@ defineSuite([ expect(texturedBoxModel.getMesh('name-of-mesh-that-does-not-exist')).not.toBeDefined(); }); - it('getMesh returns returns a mesh', function() { + it('getMesh returns a mesh', function() { var mesh = texturedBoxModel.getMesh('Mesh'); expect(mesh).toBeDefined(); expect(mesh.name).toEqual('Mesh'); @@ -388,7 +388,7 @@ defineSuite([ expect(texturedBoxModel.getMaterial('name-of-material-that-does-not-exist')).not.toBeDefined(); }); - it('getMaterial returns returns a material', function() { + it('getMaterial returns a material', function() { var material = texturedBoxModel.getMaterial('Texture'); expect(material).toBeDefined(); expect(material.name).toEqual('Texture'); From c6a6181cd13dbf7c7551b09ee2d6373d5e50af8c Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Wed, 11 Nov 2015 11:14:28 -0500 Subject: [PATCH 07/59] Added incrementallyLoadTextures and updated ModelSpec --- Source/Scene/Model.js | 225 +++++++++++++++++++++++++-------------- Specs/Scene/ModelSpec.js | 177 +++++++++++++++--------------- 2 files changed, 230 insertions(+), 172 deletions(-) diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 36fadef5b72d..b0a7b763e2ba 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -110,7 +110,6 @@ define([ Pass, SceneMode) { "use strict"; - /*global WebGLRenderingContext*/ // Bail out if the browser doesn't support typed arrays, to prevent the setup function // from failing, since we won't be able to create a WebGL context anyway. @@ -124,7 +123,7 @@ define([ var ModelState = { NEEDS_LOAD : 0, LOADING : 1, - LOADED : 2, + LOADED : 2, // Renderable, but textures can still be pending when incrementallyLoadTextures is true. FAILED : 3 }; @@ -161,18 +160,8 @@ define([ return getSubarray(this.buffers[bufferView.buffer], bufferView.byteOffset, bufferView.byteLength); }; - LoadResources.prototype.finishedPendingLoads = function() { - return ((this.pendingBufferLoads === 0) && - (this.pendingShaderLoads === 0) && - (this.pendingTextureLoads === 0)); - }; - - LoadResources.prototype.finishedResourceCreation = function() { - return ((this.buffersToCreate.length === 0) && - (this.programsToCreate.length === 0) && - (this.texturesToCreate.length === 0) && - (this.texturesToCreateFromBufferView.length === 0) && - (this.pendingBufferViewToImage === 0)); + LoadResources.prototype.finishedPendingBufferLoads = function() { + return (this.pendingBufferLoads === 0); }; LoadResources.prototype.finishedBuffersCreation = function() { @@ -184,10 +173,28 @@ define([ }; LoadResources.prototype.finishedTextureCreation = function() { - return ((this.pendingTextureLoads === 0) && - (this.texturesToCreate.length === 0) && - (this.texturesToCreateFromBufferView.length === 0) && - (this.pendingBufferViewToImage === 0)); + var finishedPendingLoads = (this.pendingTextureLoads === 0); + var finishedResourceCreation = + (this.texturesToCreate.length === 0) && + (this.texturesToCreateFromBufferView.length === 0); + + return finishedPendingLoads && finishedResourceCreation; + }; + + LoadResources.prototype.finishedEverythingButTextureCreation = function() { + var finishedPendingLoads = + (this.pendingBufferLoads === 0) && + (this.pendingShaderLoads === 0); + var finishedResourceCreation = + (this.buffersToCreate.length === 0) && + (this.programsToCreate.length === 0) && + (this.pendingBufferViewToImage === 0); + + return finishedPendingLoads && finishedResourceCreation; + }; + + LoadResources.prototype.finished = function() { + return this.finishedTextureCreation() && this.finishedEverythingButTextureCreation(); }; /////////////////////////////////////////////////////////////////////////// @@ -296,6 +303,7 @@ define([ * @param {Number} [options.maximumScale] The maximum scale size of a model. An upper limit for minimumPixelSize. * @param {Object} [options.id] A user-defined object to return when the model is picked with {@link Scene#pick}. * @param {Boolean} [options.allowPicking=true] When true, each glTF mesh and primitive is pickable with {@link Scene#pick}. + * @param {Boolean} [options.incrementallyLoadTextures=true] Determine if textures may continue to stream in after the model is loaded. * @param {Boolean} [options.asynchronous=true] Determines if model WebGL resource creation will be spread out over several frames or block until completion once all glTF files are loaded. * @param {Boolean} [options.debugShowBoundingVolume=false] For debugging only. Draws the bounding sphere for each draw command in the model. * @param {Boolean} [options.debugWireframe=false] For debugging only. Draws the model in wireframe. @@ -459,6 +467,8 @@ define([ */ this.activeAnimations = new ModelAnimationCollection(this); + this._defaultTexture = undefined; + this._incrementallyLoadTextures = defaultValue(options.incrementallyLoadTextures, true); this._asynchronous = defaultValue(options.asynchronous, true); /** @@ -735,6 +745,22 @@ define([ get : function() { return this._allowPicking; } + }, + + /** + * Determine if textures may continue to stream in after the model is loaded. + * + * @memberof Model.prototype + * + * @type {Boolean} + * @readonly + * + * @default true + */ + incrementallyLoadTextures : { + get : function() { + return this._incrementallyLoadTextures; + } } }); @@ -772,7 +798,7 @@ define([ //>>includeStart('debug', pragmas.debug); var version = view.getUint32(byteOffset, true); if (version !== 1) { - throw new DeveloperError('Only glTF Binary version 1 is supported. Version ' + version + ' is not.'); + throw new DeveloperError('Only Binary glTF version 1 is supported. Version ' + version + ' is not.'); } //>>includeEnd('debug'); byteOffset += sizeOfUint32; @@ -826,7 +852,9 @@ define([ * @param {Number} [options.scale=1.0] A uniform scale applied to this model. * @param {Number} [options.minimumPixelSize=0.0] The approximate minimum pixel size of the model regardless of zoom. * @param {Number} [options.maxiumumScale] The maximum scale for the model. + * @param {Object} [options.id] A user-defined object to return when the model is picked with {@link Scene#pick}. * @param {Boolean} [options.allowPicking=true] When true, each glTF mesh and primitive is pickable with {@link Scene#pick}. + * @param {Boolean} [options.incrementallyLoadTextures=true] Determine if textures may continue to stream in after the model is loaded. * @param {Boolean} [options.asynchronous=true] Determines if model WebGL resource creation will be spread out over several frames or block until completion once all glTF files are loaded. * @param {Boolean} [options.debugShowBoundingVolume=false] For debugging only. Draws the bounding sphere for each {@link DrawCommand} in the model. * @param {Boolean} [options.debugWireframe=false] For debugging only. Draws the model in wireframe. @@ -1085,8 +1113,6 @@ define([ var uri = new Uri(buffer.uri); var bufferPath = uri.resolve(model._baseUri).toString(); loadArrayBuffer(bufferPath).then(bufferLoad(model, id)).otherwise(getFailedLoadFunction(model, 'buffer', bufferPath)); - } else if (buffer.type === 'text') { - // GLTF_SPEC: Load compressed .bin with loadText. https://github.com/KhronosGroup/glTF/issues/230 } } } @@ -1165,11 +1191,11 @@ define([ var loadResources = model._loadResources; --loadResources.pendingTextureLoads; loadResources.texturesToCreate.enqueue({ - id : id, - image : image, - bufferView : undefined - }); - }; + id : id, + image : image, + bufferView : undefined + }); + }; } function parseTextures(model) { @@ -1571,6 +1597,7 @@ define([ source : source, pixelFormat : texture.internalFormat, pixelDatatype : texture.type, + sampler : sampler, flipY : false }); } @@ -1579,7 +1606,6 @@ define([ if (mipmap) { tx.generateMipmap(); } - tx.sampler = sampler; model._rendererResources.textures[gltfTexture.id] = tx; } @@ -1740,7 +1766,7 @@ define([ function createRuntimeAnimations(model) { var loadResources = model._loadResources; - if (!loadResources.finishedPendingLoads()) { + if (!loadResources.finishedPendingBufferLoads()) { return; } @@ -1976,6 +2002,7 @@ define([ } // This doesn't support LOCAL, which we could add if it is ever used. + var scratchTranslationRtc = new Cartesian3(); var gltfSemanticUniforms = { MODEL : function(uniformState, model) { return function() { @@ -2001,7 +2028,10 @@ define([ // CESIUM_RTC extension var mvRtc = new Matrix4(); return function() { - return Matrix4.setTranslation(uniformState.modelView, model._rtcCenterEye, mvRtc); + Matrix4.getTranslation(uniformState.model, scratchTranslationRtc); + Cartesian3.add(scratchTranslationRtc, model._rtcCenter, scratchTranslationRtc); + Matrix4.multiplyByPoint(uniformState.view, scratchTranslationRtc, scratchTranslationRtc); + return Matrix4.setTranslation(uniformState.modelView, scratchTranslationRtc, mvRtc); }; }, MODELVIEWPROJECTION : function(uniformState, model) { @@ -2133,41 +2163,71 @@ define([ return that; } - function getTextureUniformFunction(value, model) { - var that = { - value : model._rendererResources.textures[value], - clone : function(source, result) { - return source; + /////////////////////////////////////////////////////////////////////////// + + var DelayLoadedTextureUniform = function(value, model) { + this._value = undefined; + this._textureId = value; + this._model = model; + }; + + defineProperties(DelayLoadedTextureUniform.prototype, { + value : { + get : function() { + // Use the default texture (1x1 white) until the model's texture is loaded + if (!defined(this._value)) { + var texture = this._model._rendererResources.textures[this._textureId]; + if (defined(texture)) { + this._value = texture; + } else { + return this._model._defaultTexture; + } + } + + return this._value; }, - func : function() { - return that.value; + set : function(value) { + this._value = value; } + } + }); + + DelayLoadedTextureUniform.prototype.clone = function(source, result) { + return source; + }; + + DelayLoadedTextureUniform.prototype.func = undefined; + + /////////////////////////////////////////////////////////////////////////// + + function getTextureUniformFunction(value, model) { + var uniform = new DelayLoadedTextureUniform(value, model); + // Define function here to access closure since 'this' can't be + // used when the Renderer sets uniforms. + uniform.func = function() { + return uniform.value; }; - return that; + return uniform; } var gltfUniformFunctions = {}; - - // this check must use typeof, not defined, because defined doesn't work with undeclared variables. - if (typeof WebGLRenderingContext !== 'undefined') { - gltfUniformFunctions[WebGLConstants.FLOAT] = getScalarUniformFunction; - gltfUniformFunctions[WebGLConstants.FLOAT_VEC2] = getVec2UniformFunction; - gltfUniformFunctions[WebGLConstants.FLOAT_VEC3] = getVec3UniformFunction; - gltfUniformFunctions[WebGLConstants.FLOAT_VEC4] = getVec4UniformFunction; - gltfUniformFunctions[WebGLConstants.INT] = getScalarUniformFunction; - gltfUniformFunctions[WebGLConstants.INT_VEC2] = getVec2UniformFunction; - gltfUniformFunctions[WebGLConstants.INT_VEC3] = getVec3UniformFunction; - gltfUniformFunctions[WebGLConstants.INT_VEC4] = getVec4UniformFunction; - gltfUniformFunctions[WebGLConstants.BOOL] = getScalarUniformFunction; - gltfUniformFunctions[WebGLConstants.BOOL_VEC2] = getVec2UniformFunction; - gltfUniformFunctions[WebGLConstants.BOOL_VEC3] = getVec3UniformFunction; - gltfUniformFunctions[WebGLConstants.BOOL_VEC4] = getVec4UniformFunction; - gltfUniformFunctions[WebGLConstants.FLOAT_MAT2] = getMat2UniformFunction; - gltfUniformFunctions[WebGLConstants.FLOAT_MAT3] = getMat3UniformFunction; - gltfUniformFunctions[WebGLConstants.FLOAT_MAT4] = getMat4UniformFunction; - gltfUniformFunctions[WebGLConstants.SAMPLER_2D] = getTextureUniformFunction; - // GLTF_SPEC: Support SAMPLER_CUBE. https://github.com/KhronosGroup/glTF/issues/40 - } + gltfUniformFunctions[WebGLConstants.FLOAT] = getScalarUniformFunction; + gltfUniformFunctions[WebGLConstants.FLOAT_VEC2] = getVec2UniformFunction; + gltfUniformFunctions[WebGLConstants.FLOAT_VEC3] = getVec3UniformFunction; + gltfUniformFunctions[WebGLConstants.FLOAT_VEC4] = getVec4UniformFunction; + gltfUniformFunctions[WebGLConstants.INT] = getScalarUniformFunction; + gltfUniformFunctions[WebGLConstants.INT_VEC2] = getVec2UniformFunction; + gltfUniformFunctions[WebGLConstants.INT_VEC3] = getVec3UniformFunction; + gltfUniformFunctions[WebGLConstants.INT_VEC4] = getVec4UniformFunction; + gltfUniformFunctions[WebGLConstants.BOOL] = getScalarUniformFunction; + gltfUniformFunctions[WebGLConstants.BOOL_VEC2] = getVec2UniformFunction; + gltfUniformFunctions[WebGLConstants.BOOL_VEC3] = getVec3UniformFunction; + gltfUniformFunctions[WebGLConstants.BOOL_VEC4] = getVec4UniformFunction; + gltfUniformFunctions[WebGLConstants.FLOAT_MAT2] = getMat2UniformFunction; + gltfUniformFunctions[WebGLConstants.FLOAT_MAT3] = getMat3UniformFunction; + gltfUniformFunctions[WebGLConstants.FLOAT_MAT4] = getMat4UniformFunction; + gltfUniformFunctions[WebGLConstants.SAMPLER_2D] = getTextureUniformFunction; + // GLTF_SPEC: Support SAMPLER_CUBE. https://github.com/KhronosGroup/glTF/issues/40 var gltfUniformsFromNode = { MODEL : function(uniformState, model, runtimeNode) { @@ -2274,7 +2334,7 @@ define([ function createUniformMaps(model, context) { var loadResources = model._loadResources; - if (!loadResources.finishedTextureCreation() || !loadResources.finishedProgramCreation()) { + if (!loadResources.finishedProgramCreation()) { return; } @@ -2496,7 +2556,7 @@ define([ function createRuntimeNodes(model, context) { var loadResources = model._loadResources; - if (!loadResources.finishedPendingLoads() || !loadResources.finishedResourceCreation()) { + if (!loadResources.finishedEverythingButTextureCreation()) { return; } @@ -2587,7 +2647,7 @@ define([ resources.samplers = cachedResources.samplers; resources.renderStates = cachedResources.renderStates; } else { - createBuffers(model, context); // using glTF bufferViews + createBuffers(model, context); // using glTF bufferViews createPrograms(model, context); createSamplers(model, context); loadTexturesFromBufferViews(model); @@ -2652,15 +2712,16 @@ define([ var commands = n.commands; if ((n.dirtyNumber === maxDirtyNumber) || modelTransformChanged || justLoaded) { + var nodeMatrix = Matrix4.multiplyTransformation(computedModelMatrix, transformToRoot, n.computedMatrix); var commandsLength = commands.length; if (commandsLength > 0) { // Node has meshes, which has primitives. Update their commands. for (var j = 0 ; j < commandsLength; ++j) { var primitiveCommand = commands[j]; var command = primitiveCommand.command; - Matrix4.multiplyTransformation(computedModelMatrix, transformToRoot, command.modelMatrix); + Matrix4.clone(nodeMatrix, command.modelMatrix); - // PERFORMANCE_IDEA: Can use transformWithoutScale if no node up to the root has scale (inclug animation) + // PERFORMANCE_IDEA: Can use transformWithoutScale if no node up to the root has scale (including animation) BoundingSphere.transform(primitiveCommand.boundingSphere, command.modelMatrix, command.boundingVolume); if (defined(model._rtcCenter)) { @@ -2673,9 +2734,6 @@ define([ BoundingSphere.clone(command.boundingVolume, pickCommand.boundingVolume); } } - } else { - // Node has a light or camera - n.computedMatrix = Matrix4.multiplyTransformation(computedModelMatrix, transformToRoot, n.computedMatrix); } } @@ -2962,6 +3020,7 @@ define([ } var context = frameState.context; + this._defaultTexture = context.defaultTexture; if ((this._state === ModelState.NEEDS_LOAD) && defined(this.gltf)) { // Use renderer resources from cache instead of loading/creating them? @@ -3011,19 +3070,35 @@ define([ } } - var justLoaded = false; - if (this._state === ModelState.FAILED) { throw this._loadError; } + var loadResources = this._loadResources; + var incrementallyLoadTextures = this._incrementallyLoadTextures; + var justLoaded = false; + if (this._state === ModelState.LOADING) { - // Incrementally create WebGL resources as buffers/shaders/textures are downloaded + // Create WebGL resources as buffers/shaders/textures are downloaded createResources(this, frameState); - var loadResources = this._loadResources; - if (loadResources.finishedPendingLoads() && loadResources.finishedResourceCreation()) { + // Transition from LOADING -> LOADED once resources are downloaded and created. + // Textures may continue to stream in while in the LOADED state. + if (loadResources.finished() || + (incrementallyLoadTextures && loadResources.finishedEverythingButTextureCreation())) { this._state = ModelState.LOADED; + justLoaded = true; + } + } + + // Incrementally stream textures. + if (defined(loadResources) && (this._state === ModelState.LOADED)) { + // Also check justLoaded so we don't process twice during the transition frame + if (incrementallyLoadTextures && !justLoaded) { + createResources(this, frameState); + } + + if (loadResources.finished()) { this._loadResources = undefined; // Clear CPU memory since WebGL resources were created. var resources = this._rendererResources; @@ -3041,8 +3116,6 @@ define([ if (this.releaseGltfJson) { releaseCachedGltf(this); } - - justLoaded = true; } } @@ -3087,12 +3160,6 @@ define([ updatePickIds(this, context); updateWireframe(this); updateShowBoundingVolume(this); - - if (defined(this._rtcCenter)) { - // The CESIUM_RTC extension is use. Compute the center in eye coordinates so it - // can be used to compute the model-view RTC matrix uniforms. - Matrix4.multiplyByPoint(frameState.camera.viewMatrix, this._rtcCenter, this._rtcCenterEye); - } } if (justLoaded) { diff --git a/Specs/Scene/ModelSpec.js b/Specs/Scene/ModelSpec.js index 99b33618d649..27ae05e9bb08 100644 --- a/Specs/Scene/ModelSpec.js +++ b/Specs/Scene/ModelSpec.js @@ -5,6 +5,7 @@ defineSuite([ 'Core/Cartesian3', 'Core/Cartesian4', 'Core/defaultValue', + 'Core/defined', 'Core/FeatureDetection', 'Core/HeadingPitchRange', 'Core/JulianDate', @@ -26,6 +27,7 @@ defineSuite([ Cartesian3, Cartesian4, defaultValue, + defined, FeatureDetection, HeadingPitchRange, JulianDate, @@ -129,6 +131,7 @@ defineSuite([ minimumPixelSize : options.minimumPixelSize, maximumScale : options.maximumScale, id : url, // for picking tests + incrementallyLoadTextures : options.incrementallyLoadTextures, asynchronous : options.asynchronous, releaseGltfJson : options.releaseGltfJson, cacheKey : options.cacheKey @@ -144,13 +147,40 @@ defineSuite([ }); } + function loadModelJson(gltf, options) { + options = defaultValue(options, {}); + + var model = primitives.add(new Model({ + gltf : gltf, + modelMatrix : defaultValue(options.modelMatrix, Transforms.eastNorthUpToFixedFrame(Cartesian3.fromDegrees(0.0, 0.0, 100.0))), + show : false, + scale : options.scale, + minimumPixelSize : options.minimumPixelSize, + maximumScale : options.maximumScale, + incrementallyLoadTextures : options.incrementallyLoadTextures, + asynchronous : options.asynchronous, + releaseGltfJson : options.releaseGltfJson + })); + addZoomTo(model); + + return pollToPromise(function() { + // Render scene to progressively load the model + scene.renderForSpecs(); + return model.ready; + }, { timeout: 10000 }).then(function() { + return model; + }); + } + function verifyRender(model) { expect(model.ready).toBe(true); expect(scene.renderForSpecs()).toEqual([0, 0, 0, 255]); model.show = true; model.zoomTo(); - expect(scene.renderForSpecs()).not.toEqual([0, 0, 0, 255]); + var pixelColor = scene.renderForSpecs(); + expect(pixelColor).not.toEqual([0, 0, 0, 255]); model.show = false; + return pixelColor; } it('fromGltf throws without options', function() { @@ -198,36 +228,17 @@ defineSuite([ it('renders from glTF', function() { // Simulate using procedural glTF as opposed to loading it from a file - var model = primitives.add(new Model({ - gltf : texturedBoxModel.gltf, - modelMatrix : Transforms.eastNorthUpToFixedFrame(Cartesian3.fromDegrees(0.0, 0.0, 100.0)), - show : false - })); - addZoomTo(model); - - return pollToPromise(function() { - // Render scene to progressively load the model - scene.renderForSpecs(); - return model.ready; - }, { timeout: 10000 }).then(function() { + loadModelJson(texturedBoxModel.gltf).then(function(model) { verifyRender(model); primitives.remove(model); }); }); it('Applies the right render state', function() { - // Simulate using procedural glTF as opposed to loading it from a file - var model = primitives.add(new Model({ - gltf : texturedBoxModel.gltf - })); - spyOn(RenderState, 'fromCache').and.callThrough(); - return pollToPromise(function() { - // Render scene to progressively load the model - scene.renderForSpecs(); - return model.ready; - }, { timeout : 10000 }).then(function() { + // Simulate using procedural glTF as opposed to loading it from a file + loadModelJson(texturedBoxModel.gltf).then(function(model) { var rs = { frontFace : WebGLConstants.CCW, cull : { @@ -547,20 +558,7 @@ defineSuite([ it('loads a model with the CESIUM_binary_glTF extension as an ArrayBuffer using new Model', function() { return loadArrayBuffer(texturedBoxBinaryUrl).then(function(arrayBuffer) { - var model = primitives.add(new Model({ - gltf : arrayBuffer, - modelMatrix : Transforms.eastNorthUpToFixedFrame(Cartesian3.fromDegrees(0.0, 0.0, 100.0)), - show : false - })); - addZoomTo(model); - - return pollToPromise(function() { - // Render scene to progressively load the model - scene.renderForSpecs(); - return model.ready; - }, { - timeout : 10000 - }).then(function() { + loadModelJson(arrayBuffer).then(function(model) { verifyRender(model); primitives.remove(model); }); @@ -569,20 +567,7 @@ defineSuite([ it('loads a model with the CESIUM_binary_glTF extension as an Uint8Array using new Model', function() { return loadArrayBuffer(texturedBoxBinaryUrl).then(function(arrayBuffer) { - var model = primitives.add(new Model({ - gltf : new Uint8Array(arrayBuffer), - modelMatrix : Transforms.eastNorthUpToFixedFrame(Cartesian3.fromDegrees(0.0, 0.0, 100.0)), - show : false - })); - addZoomTo(model); - - return pollToPromise(function() { - // Render scene to progressively load the model - scene.renderForSpecs(); - return model.ready; - }, { - timeout : 10000 - }).then(function() { + loadModelJson(new Uint8Array(arrayBuffer)).then(function(model) { verifyRender(model); primitives.remove(model); }); @@ -598,20 +583,7 @@ defineSuite([ it('loads a model with the KHR_binary_glTF extension as an ArrayBuffer using new Model', function() { return loadArrayBuffer(texturedBoxKhrBinaryUrl).then(function(arrayBuffer) { - var model = primitives.add(new Model({ - gltf : arrayBuffer, - modelMatrix : Transforms.eastNorthUpToFixedFrame(Cartesian3.fromDegrees(0.0, 0.0, 100.0)), - show : false - })); - addZoomTo(model); - - return pollToPromise(function() { - // Render scene to progressively load the model - scene.renderForSpecs(); - return model.ready; - }, { - timeout : 10000 - }).then(function() { + loadModelJson(arrayBuffer).then(function(model) { verifyRender(model); primitives.remove(model); }); @@ -620,20 +592,7 @@ defineSuite([ it('loads a model with the KHR_binary_glTF extension as an Uint8Array using new Model', function() { return loadArrayBuffer(texturedBoxKhrBinaryUrl).then(function(arrayBuffer) { - var model = primitives.add(new Model({ - gltf : new Uint8Array(arrayBuffer), - modelMatrix : Transforms.eastNorthUpToFixedFrame(Cartesian3.fromDegrees(0.0, 0.0, 100.0)), - show : false - })); - addZoomTo(model); - - return pollToPromise(function() { - // Render scene to progressively load the model - scene.renderForSpecs(); - return model.ready; - }, { - timeout : 10000 - }).then(function() { + loadModelJson(new Uint8Array(arrayBuffer)).then(function(model) { verifyRender(model); primitives.remove(model); }); @@ -1213,7 +1172,7 @@ defineSuite([ }); }); - it('releaseGltfJson releases glTFJSON when constructed with fromGltf', function() { + it('releaseGltfJson releases glTF JSON when constructed with fromGltf', function() { return loadModel(boxUrl, { releaseGltfJson : true }).then(function(m) { @@ -1226,20 +1185,11 @@ defineSuite([ }); it('releaseGltfJson releases glTF JSON when constructed with Model constructor function', function() { - var m = primitives.add(new Model({ - gltf : texturedBoxModel.gltf, - modelMatrix : Transforms.eastNorthUpToFixedFrame(Cartesian3.fromDegrees(0.0, 0.0, 100.0)), - show : false, + loadModelJson(texturedBoxModel.gltf, { releaseGltfJson : true, + incrementallyLoadTextures : false, asynchronous : true - })); - addZoomTo(m); - - return pollToPromise(function() { - // Render scene to progressively load the model - scene.renderForSpecs(); - return m.ready; - }, { timeout : 10000 }).then(function() { + }).then(function(m) { expect(m.releaseGltfJson).toEqual(true); expect(m.gltf).not.toBeDefined(); @@ -1360,6 +1310,7 @@ defineSuite([ modelMatrix : Transforms.eastNorthUpToFixedFrame(Cartesian3.fromDegrees(0.0, 0.0, 100.0)), show : false, cacheKey : key, + incrementallyLoadTextures : false, asynchronous : true })); addZoomTo(m); @@ -1468,6 +1419,46 @@ defineSuite([ }); }); + it('Loads with incrementallyLoadTextures set to true', function() { + loadModelJson(texturedBoxModel.gltf, { + incrementallyLoadTextures : true + }).then(function(m) { + // Get the rendered color of the model before textures are loaded + var loadedColor = verifyRender(m); + + pollToPromise(function() { + // Render scene to progressively load textures + scene.renderForSpecs(); + // Textures have finished loading + return !defined(m._loadResources); + }, { timeout : 10000 }).then(function() { + var finishedColor = verifyRender(m); + expect(finishedColor).not.toEqual(loadedColor); + primitives.remove(m); + }); + }); + }); + + it('Loads with incrementallyLoadTextures set to false', function() { + loadModelJson(texturedBoxModel.gltf, { + incrementallyLoadTextures : false + }).then(function(m) { + // Get the rendered color of the model before textures are loaded + var loadedColor = verifyRender(m); + + pollToPromise(function() { + // Render scene to progressively load textures (they should already be loaded) + scene.renderForSpecs(); + // Textures have finished loading + return !defined(m._loadResources); + }, { timeout : 10000 }).then(function() { + var finishedColor = verifyRender(m); + expect(finishedColor).toEqual(loadedColor); + primitives.remove(m); + }); + }); + }); + it('loads a glTF with KHR_materials_common using the constant lighting model', function() { return loadModel(boxConstantUrl).then(function(m) { verifyRender(m); @@ -1552,4 +1543,4 @@ defineSuite([ }); }); -}, 'WebGL'); \ No newline at end of file +}, 'WebGL'); From 10991a568439b21a558e7eefdc30a262fa4bb367 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Wed, 11 Nov 2015 14:30:43 -0500 Subject: [PATCH 08/59] Added external resource loaders to Model --- Source/Scene/Model.js | 143 ++++++++++++++++++++++++++++------- Specs/Scene/ModelSpec.js | 156 ++++++++++++++++++++++++++++++--------- 2 files changed, 241 insertions(+), 58 deletions(-) diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index b0a7b763e2ba..3b453433b1ee 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -498,6 +498,16 @@ define([ this.debugWireframe = defaultValue(options.debugWireframe, false); this._debugWireframe = false; + // Undocumented options + this._precreatedAttributes = options.precreatedAttributes; + this._vertexShaderLoaded = options.vertexShaderLoaded; + this._fragmentShaderLoaded = options.fragmentShaderLoaded; + this._uniformMapLoaded = options.uniformMapLoaded; + this._pickVertexShaderLoaded = options.pickVertexShaderLoaded; + this._pickFragmentShaderLoaded = options.pickFragmentShaderLoaded; + this._pickUniformMapLoaded = options.pickUniformMapLoaded; + this._ignoreCommands = defaultValue(options.ignoreCommands, false); + this._computedModelMatrix = new Matrix4(); // Derived from modelMatrix and scale this._initialRadius = undefined; // Radius without model's scale property, model-matrix scale, animations, or skins this._boundingSphere = undefined; @@ -1440,6 +1450,13 @@ define([ return getStringFromTypedArray(loadResources.getBuffer(bufferView)); } + function modifyShader(shader, programName, callback) { + if (defined(callback)) { + shader = callback(shader, programName); + } + return shader; + } + function createProgram(id, model, context) { var programs = model.gltf.programs; var shaders = model._loadResources.shaders; @@ -1449,23 +1466,39 @@ define([ var vs = getShaderSource(model, shaders[program.vertexShader]); var fs = getShaderSource(model, shaders[program.fragmentShader]); + var drawVS = modifyShader(vs, id, model._vertexShaderLoaded); + var drawFS = modifyShader(fs, id, model._fragmentShaderLoaded); + + // Add pre-created attributes to attributeLocations + var attributesLength = program.attributes.length; + var precreatedAttributes = model._precreatedAttributes; + if (defined(precreatedAttributes)) { + for (var attrName in precreatedAttributes) { + if (precreatedAttributes.hasOwnProperty(attrName)) { + attributeLocations[attrName] = attributesLength++; + } + } + } + model._rendererResources.programs[id] = ShaderProgram.fromCache({ context : context, - vertexShaderSource : vs, - fragmentShaderSource : fs, + vertexShaderSource : drawVS, + fragmentShaderSource : drawFS, attributeLocations : attributeLocations }); if (model.allowPicking) { // PERFORMANCE_IDEA: Can optimize this shader with a glTF hint. https://github.com/KhronosGroup/glTF/issues/181 - var pickFS = new ShaderSource({ - sources : [fs], - pickColorQualifier : 'uniform' - }); + var pickVS = modifyShader(vs, id, model._pickVertexShaderLoaded); + var pickFS = modifyShader(fs, id, model._pickFragmentShaderLoaded); + + if (!model._pickFragmentShaderLoaded) { + pickFS = ShaderSource.createPickFragmentShaderSource(fs, 'uniform'); + } model._rendererResources.pickPrograms[id] = ShaderProgram.fromCache({ context : context, - vertexShaderSource : vs, + vertexShaderSource : pickVS, fragmentShaderSource : pickFS, attributeLocations : attributeLocations }); @@ -1646,8 +1679,15 @@ define([ // Note: WebGL shader compiler may have optimized and removed some attributes from programAttributeLocations for (var location in programAttributeLocations){ if (programAttributeLocations.hasOwnProperty(location)) { - var parameter = parameters[attributes[location]]; - attributeLocations[parameter.semantic] = programAttributeLocations[location].index; + var attribute = attributes[location]; + var index = programAttributeLocations[location].index; + if (defined(attribute)) { + var parameter = parameters[attribute]; + attributeLocations[parameter.semantic] = index; + } else { + // Pre-created attributes + attributeLocations[location] = index; + } } } @@ -1860,16 +1900,19 @@ define([ // https://github.com/KhronosGroup/glTF/issues/258 var attributeLocations = getAttributeLocations(model, primitive); - var attrs = []; + var attributeName; + var attributeLocation; + var attribute; + var attributes = []; var primitiveAttributes = primitive.attributes; - for (var attrName in primitiveAttributes) { - if (primitiveAttributes.hasOwnProperty(attrName)) { - var attributeLocation = attributeLocations[attrName]; + for (attributeName in primitiveAttributes) { + if (primitiveAttributes.hasOwnProperty(attributeName)) { + attributeLocation = attributeLocations[attributeName]; // Skip if the attribute is not used by the material, e.g., because the asset was exported // with an attribute that wasn't used and the asset wasn't optimized. if (defined(attributeLocation)) { - var a = accessors[primitiveAttributes[attrName]]; - attrs.push({ + var a = accessors[primitiveAttributes[attributeName]]; + attributes.push({ index : attributeLocation, vertexBuffer : rendererBuffers[a.bufferView], componentsPerAttribute : getModelAccessor(a).componentsPerAttribute, @@ -1882,6 +1925,21 @@ define([ } } + // Add pre-created attributes + var precreatedAttributes = model._precreatedAttributes; + if (defined(precreatedAttributes)) { + for (attributeName in precreatedAttributes) { + if (precreatedAttributes.hasOwnProperty(attributeName)) { + attributeLocation = attributeLocations[attributeName]; + if (defined(attributeLocation)) { + attribute = precreatedAttributes[attributeName]; + attribute.index = attributeLocation; + attributes.push(attribute); + } + } + } + } + var indexBuffer; if (defined(primitive.indices)) { var accessor = accessors[primitive.indices]; @@ -1889,7 +1947,7 @@ define([ } rendererVertexArrays[meshId + '.primitive.' + i] = new VertexArray({ context : context, - attributes : attrs, + attributes : attributes, indexBuffer : indexBuffer }); } @@ -2460,6 +2518,7 @@ define([ var ix = accessors[primitive.indices]; var material = materials[primitive.material]; var technique = techniques[material.technique]; + var programId = technique.program; var boundingSphere; var positionAttribute = primitive.attributes.POSITION; @@ -2491,7 +2550,13 @@ define([ uniformMap = combine(uniformMap, jointUniformMap); } + // Allow callback to modify the uniformMap + if (defined(model._uniformMapLoaded)) { + uniformMap = model._uniformMapLoaded(uniformMap, programId, runtimeNode); + } + var rs = rendererRenderStates[material.technique]; + // GLTF_SPEC: Offical means to determine translucency. https://github.com/KhronosGroup/glTF/issues/105 var isTranslucent = rs.blending.enabled; var owner = { @@ -2518,13 +2583,26 @@ define([ var pickCommand; if (allowPicking) { - var pickId = context.createPickId(owner); - pickIds.push(pickId); - - var pickUniformMap = combine( - uniformMap, { + var pickUniformMap; + + // Callback to override default model picking + if (defined(model._pickFragmentShaderLoaded)) { + if (defined(model._pickUniformMapLoaded)) { + pickUniformMap = model._pickUniformMapLoaded(uniformMap); + } else { + // This is unlikely, but could happen if the override shader does not + // need new uniforms since, for example, its pick ids are coming from + // a vertex attribute or are baked into the shader source. + pickUniformMap = combine(uniformMap); + } + } else { + var pickId = context.createPickId(owner); + pickIds.push(pickId); + var pickUniforms = { czm_pickColor : createPickColorFunction(pickId.color) - }); + }; + pickUniformMap = combine(uniformMap, pickUniforms); + } pickCommand = new DrawCommand({ boundingVolume : new BoundingSphere(), // updated in update() @@ -2646,6 +2724,11 @@ define([ resources.textures = cachedResources.textures; resources.samplers = cachedResources.samplers; resources.renderStates = cachedResources.renderStates; + + // Vertex arrays are unique to this model, create instead of using the cache. + if (defined(model._precreatedAttributes)) { + createVertexArrays(model, context); + } } else { createBuffers(model, context); // using glTF bufferViews createPrograms(model, context); @@ -3113,6 +3196,11 @@ define([ cachedResources.renderStates = resources.renderStates; cachedResources.ready = true; + // Vertex arrays are unique to this model, do not store in cache. + if (defined(this._precreatedAttributes)) { + cachedResources.vertexArrays = {}; + } + if (this.releaseGltfJson) { releaseCachedGltf(this); } @@ -3175,8 +3263,8 @@ define([ // We don't check show at the top of the function since we // want to be able to progressively load models when they are not shown, // and then have them visible immediately when show is set to true. - if (show) { -// PERFORMANCE_IDEA: This is terrible + if (show && !this._ignoreCommands) { + // PERFORMANCE_IDEA: This is terrible var commandList = frameState.commandList; var passes = frameState.passes; var nodeCommands = this._nodeCommands; @@ -3193,7 +3281,7 @@ define([ } } - if (passes.pick) { + if (passes.pick && this.allowPicking) { for (i = 0; i < length; ++i) { nc = nodeCommands[i]; if (nc.show) { @@ -3236,6 +3324,11 @@ define([ * model = model && model.destroy(); */ Model.prototype.destroy = function() { + // Vertex arrays are unique to this model, destroy here. + if (defined(this._precreatedAttributes)) { + destroy(this._rendererResources.vertexArrays); + } + this._rendererResources = undefined; this._cachedRendererResources = this._cachedRendererResources && this._cachedRendererResources.release(); diff --git a/Specs/Scene/ModelSpec.js b/Specs/Scene/ModelSpec.js index 27ae05e9bb08..af8ff79dbc5b 100644 --- a/Specs/Scene/ModelSpec.js +++ b/Specs/Scene/ModelSpec.js @@ -4,6 +4,7 @@ defineSuite([ 'Core/Cartesian2', 'Core/Cartesian3', 'Core/Cartesian4', + 'Core/combine', 'Core/defaultValue', 'Core/defined', 'Core/FeatureDetection', @@ -16,6 +17,7 @@ defineSuite([ 'Core/PrimitiveType', 'Core/Transforms', 'Renderer/RenderState', + 'Renderer/ShaderSource', 'Renderer/WebGLConstants', 'Scene/ModelAnimationLoop', 'Specs/createScene', @@ -26,6 +28,7 @@ defineSuite([ Cartesian2, Cartesian3, Cartesian4, + combine, defaultValue, defined, FeatureDetection, @@ -38,6 +41,7 @@ defineSuite([ PrimitiveType, Transforms, RenderState, + ShaderSource, WebGLConstants, ModelAnimationLoop, createScene, @@ -121,21 +125,14 @@ defineSuite([ } function loadModel(url, options) { - options = defaultValue(options, {}); - - var model = primitives.add(Model.fromGltf({ + options = combine(options, { + modelMatrix : Transforms.eastNorthUpToFixedFrame(Cartesian3.fromDegrees(0.0, 0.0, 100.0)), url : url, - modelMatrix : defaultValue(options.modelMatrix, Transforms.eastNorthUpToFixedFrame(Cartesian3.fromDegrees(0.0, 0.0, 100.0))), - show : false, - scale : options.scale, - minimumPixelSize : options.minimumPixelSize, - maximumScale : options.maximumScale, - id : url, // for picking tests - incrementallyLoadTextures : options.incrementallyLoadTextures, - asynchronous : options.asynchronous, - releaseGltfJson : options.releaseGltfJson, - cacheKey : options.cacheKey - })); + id : url, + show : false + }); + + var model = primitives.add(Model.fromGltf(options)); addZoomTo(model); return pollToPromise(function() { @@ -148,19 +145,13 @@ defineSuite([ } function loadModelJson(gltf, options) { - options = defaultValue(options, {}); - - var model = primitives.add(new Model({ + options = combine(options, { + modelMatrix : Transforms.eastNorthUpToFixedFrame(Cartesian3.fromDegrees(0.0, 0.0, 100.0)), gltf : gltf, - modelMatrix : defaultValue(options.modelMatrix, Transforms.eastNorthUpToFixedFrame(Cartesian3.fromDegrees(0.0, 0.0, 100.0))), - show : false, - scale : options.scale, - minimumPixelSize : options.minimumPixelSize, - maximumScale : options.maximumScale, - incrementallyLoadTextures : options.incrementallyLoadTextures, - asynchronous : options.asynchronous, - releaseGltfJson : options.releaseGltfJson - })); + show : false + }); + + var model = primitives.add(new Model(options)); addZoomTo(model); return pollToPromise(function() { @@ -558,7 +549,7 @@ defineSuite([ it('loads a model with the CESIUM_binary_glTF extension as an ArrayBuffer using new Model', function() { return loadArrayBuffer(texturedBoxBinaryUrl).then(function(arrayBuffer) { - loadModelJson(arrayBuffer).then(function(model) { + return loadModelJson(arrayBuffer).then(function(model) { verifyRender(model); primitives.remove(model); }); @@ -567,7 +558,7 @@ defineSuite([ it('loads a model with the CESIUM_binary_glTF extension as an Uint8Array using new Model', function() { return loadArrayBuffer(texturedBoxBinaryUrl).then(function(arrayBuffer) { - loadModelJson(new Uint8Array(arrayBuffer)).then(function(model) { + return loadModelJson(new Uint8Array(arrayBuffer)).then(function(model) { verifyRender(model); primitives.remove(model); }); @@ -583,7 +574,7 @@ defineSuite([ it('loads a model with the KHR_binary_glTF extension as an ArrayBuffer using new Model', function() { return loadArrayBuffer(texturedBoxKhrBinaryUrl).then(function(arrayBuffer) { - loadModelJson(arrayBuffer).then(function(model) { + return loadModelJson(arrayBuffer).then(function(model) { verifyRender(model); primitives.remove(model); }); @@ -592,7 +583,7 @@ defineSuite([ it('loads a model with the KHR_binary_glTF extension as an Uint8Array using new Model', function() { return loadArrayBuffer(texturedBoxKhrBinaryUrl).then(function(arrayBuffer) { - loadModelJson(new Uint8Array(arrayBuffer)).then(function(model) { + return loadModelJson(new Uint8Array(arrayBuffer)).then(function(model) { verifyRender(model); primitives.remove(model); }); @@ -1185,7 +1176,7 @@ defineSuite([ }); it('releaseGltfJson releases glTF JSON when constructed with Model constructor function', function() { - loadModelJson(texturedBoxModel.gltf, { + return loadModelJson(texturedBoxModel.gltf, { releaseGltfJson : true, incrementallyLoadTextures : false, asynchronous : true @@ -1420,7 +1411,7 @@ defineSuite([ }); it('Loads with incrementallyLoadTextures set to true', function() { - loadModelJson(texturedBoxModel.gltf, { + return loadModelJson(texturedBoxModel.gltf, { incrementallyLoadTextures : true }).then(function(m) { // Get the rendered color of the model before textures are loaded @@ -1440,7 +1431,7 @@ defineSuite([ }); it('Loads with incrementallyLoadTextures set to false', function() { - loadModelJson(texturedBoxModel.gltf, { + return loadModelJson(texturedBoxModel.gltf, { incrementallyLoadTextures : false }).then(function(m) { // Get the rendered color of the model before textures are loaded @@ -1543,4 +1534,103 @@ defineSuite([ }); }); + it('loads with custom vertex attributes, vertexShader, fragmentShader, and uniform map', function() { + function vertexShaderLoaded(vs) { + var renamedSource = ShaderSource.replaceMain(vs, 'czm_old_main'); + var newMain = + 'attribute vec4 a_color;\n' + + 'varying vec4 v_color;\n' + + 'void main()\n' + + '{\n' + + ' czm_old_main();\n' + + ' v_color = a_color;\n' + + '}'; + return renamedSource + '\n' + newMain; + } + + function fragmentShaderLoaded(fs) { + fs = 'uniform float u_value;\n' + + 'varying vec4 v_color;\n' + + 'void main()\n' + + '{\n' + + ' gl_FragColor = u_value * v_color;\n' + + '}'; + return fs; + } + + function uniformMapLoaded(uniformMap) { + return combine(uniformMap, { + u_value : function() { + return 1.0; + } + }); + } + + var precreatedAttributes = { + a_color : { + index : 0, // updated in Model + componentsPerAttribute : 4, + value : [1.0, 1.0, 1.0, 1.0] + } + }; + + var options = { + precreatedAttributes : precreatedAttributes, + vertexShaderLoaded : vertexShaderLoaded, + fragmentShaderLoaded : fragmentShaderLoaded, + uniformMapLoaded : uniformMapLoaded + }; + + return loadModelJson(texturedBoxModel.gltf, options).then(function(model) { + var pixelColor = verifyRender(model); + expect(pixelColor).toEqual([255, 255, 255, 255]); + primitives.remove(model); + }); + }); + + it('loads with custom pickFragmentShader and pickUniformMap', function() { + function pickFragmentShaderLoaded(fs) { + return ShaderSource.createPickFragmentShaderSource(fs, 'uniform'); + } + + var pickId = scene.context.createPickId({ + custom : 'custom' + }); + + function pickUniformMapLoaded(uniformMap) { + return combine(uniformMap, { + czm_pickColor : function() { + return pickId.color; + } + }); + } + + var options = { + pickFragmentShaderLoaded : pickFragmentShaderLoaded, + pickUniformMapLoaded : pickUniformMapLoaded + }; + + return loadModelJson(texturedBoxModel.gltf, options).then(function(model) { + model.show = true; + var pick = scene.pick(new Cartesian2(0, 0)); + expect(pick.custom).toEqual('custom'); + primitives.remove(model); + }); + }); + + it('does not render when ignoreCommands is true', function() { + loadModel(texturedBoxUrl, { + ignoreCommands : true + }).then(function(m) { + expect(m.ready).toBe(true); + expect(scene.renderForSpecs()).toEqual([0, 0, 0, 255]); + m.show = true; + m.zoomTo(); + expect(scene.renderForSpecs()).toEqual([0, 0, 0, 255]); + m.show = false; + + primitives.remove(m); + }); + }); + }, 'WebGL'); From e095fbb25854f4833ea81dab24b5dccc84b10942 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Wed, 11 Nov 2015 15:41:22 -0500 Subject: [PATCH 09/59] Added cull and tests --- Source/Scene/Model.js | 8 ++++++ Specs/Scene/ModelSpec.js | 57 +++++++++++++++++++++++++++++++++++----- 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 3b453433b1ee..970c42a2b745 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -508,6 +508,12 @@ define([ this._pickUniformMapLoaded = options.pickUniformMapLoaded; this._ignoreCommands = defaultValue(options.ignoreCommands, false); + /** + * @private + * @readonly + */ + this.cull = defaultValue(options.cull, true); + this._computedModelMatrix = new Matrix4(); // Derived from modelMatrix and scale this._initialRadius = undefined; // Radius without model's scale property, model-matrix scale, animations, or skins this._boundingSphere = undefined; @@ -2568,6 +2574,7 @@ define([ var command = new DrawCommand({ boundingVolume : new BoundingSphere(), // updated in update() + cull : model.cull, modelMatrix : new Matrix4(), // computed in update() primitiveType : primitive.mode, vertexArray : vertexArray, @@ -2606,6 +2613,7 @@ define([ pickCommand = new DrawCommand({ boundingVolume : new BoundingSphere(), // updated in update() + cull : model.cull, modelMatrix : new Matrix4(), // computed in update() primitiveType : primitive.mode, vertexArray : vertexArray, diff --git a/Specs/Scene/ModelSpec.js b/Specs/Scene/ModelSpec.js index af8ff79dbc5b..c74e4f2e6e9c 100644 --- a/Specs/Scene/ModelSpec.js +++ b/Specs/Scene/ModelSpec.js @@ -219,7 +219,7 @@ defineSuite([ it('renders from glTF', function() { // Simulate using procedural glTF as opposed to loading it from a file - loadModelJson(texturedBoxModel.gltf).then(function(model) { + return loadModelJson(texturedBoxModel.gltf).then(function(model) { verifyRender(model); primitives.remove(model); }); @@ -229,7 +229,7 @@ defineSuite([ spyOn(RenderState, 'fromCache').and.callThrough(); // Simulate using procedural glTF as opposed to loading it from a file - loadModelJson(texturedBoxModel.gltf).then(function(model) { + return loadModelJson(texturedBoxModel.gltf).then(function(model) { var rs = { frontFace : WebGLConstants.CCW, cull : { @@ -1618,17 +1618,62 @@ defineSuite([ }); }); - it('does not render when ignoreCommands is true', function() { - loadModel(texturedBoxUrl, { + it('does not issue draw commands when ignoreCommands is true', function() { + return loadModel(texturedBoxUrl, { ignoreCommands : true }).then(function(m) { expect(m.ready).toBe(true); - expect(scene.renderForSpecs()).toEqual([0, 0, 0, 255]); m.show = true; + m.zoomTo(); - expect(scene.renderForSpecs()).toEqual([0, 0, 0, 255]); + m.update(scene.frameState); + expect(scene.frameState.commandList.length).toEqual(0); + m.show = false; + primitives.remove(m); + }); + }); + + it('does not issue draw commands when the model is out of view and cull is true', function() { + return loadModel(texturedBoxUrl, { + cull : true + }).then(function(m) { + expect(m.ready).toBe(true); + m.show = true; + + // Look at the model + m.zoomTo(); + scene.renderForSpecs(); + expect(scene._frustumCommandsList.length).not.toEqual(0); + + // Move the model out of view + m.modelMatrix = Matrix4.fromTranslation(new Cartesian3(10000000000.0, 0.0, 0.0)); + scene.renderForSpecs(); + expect(scene._frustumCommandsList.length).toEqual(0); + m.show = false; + primitives.remove(m); + }); + }); + + it('issues draw commands when the model is out of view and cull is false', function() { + return loadModel(texturedBoxUrl, { + cull : false + }).then(function(m) { + expect(m.ready).toBe(true); + m.show = true; + + // Look at the model + m.zoomTo(); + scene.renderForSpecs(); + expect(scene._frustumCommandsList.length).not.toEqual(0); + + // Move the model out of view + m.modelMatrix = Matrix4.fromTranslation(new Cartesian3(10000000000.0, 0.0, 0.0)); + scene.renderForSpecs(); + expect(scene._frustumCommandsList.length).not.toEqual(0); + + m.show = false; primitives.remove(m); }); }); From 430bea280ee98c9d6896add8566fd32024e25a2e Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Wed, 11 Nov 2015 22:20:19 -0500 Subject: [PATCH 10/59] Small changes --- CHANGES.md | 2 ++ Source/Scene/Model.js | 14 ++++++++++++++ Specs/Scene/ModelSpec.js | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 7fd323d2d70a..5dab53d3f7bb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -17,6 +17,8 @@ Change Log * Added support for fog near the horizon, which improves performance by rendering less terrain tiles and reduces terrain tile requests. This is enabled by default. See `Scene.fog` for options. [#3154](https://github.com/AnalyticalGraphicsInc/cesium/pull/3154) * Added `Queue.peek` to return the item at the front of a Queue. * Added `Camera.distanceToBoundingSphere` function. +* Added utility function `getBaseUri`, which given a URI with or without query parameters, returns the base path of the URI. +* Added support for incrementally loading textures after a Model is ready. This allows the Model to be visible as soon as possible while its textures are loaded in the background. ### 1.15 - 2015-11-02 diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 970c42a2b745..9a2b7c351b40 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -777,6 +777,20 @@ define([ get : function() { return this._incrementallyLoadTextures; } + }, + + /** + * Return the number of pending texture loads. + * + * @memberof Model.prototype + * + * @type {Number} + * @readonly + */ + pendingTextureLoads : { + get : function() { + return defined(this._loadResources) ? this._loadResources.pendingTextureLoads : 0; + } } }); diff --git a/Specs/Scene/ModelSpec.js b/Specs/Scene/ModelSpec.js index c74e4f2e6e9c..4c3580904ac9 100644 --- a/Specs/Scene/ModelSpec.js +++ b/Specs/Scene/ModelSpec.js @@ -1421,7 +1421,7 @@ defineSuite([ // Render scene to progressively load textures scene.renderForSpecs(); // Textures have finished loading - return !defined(m._loadResources); + return (m.pendingTextureLoads === 0); }, { timeout : 10000 }).then(function() { var finishedColor = verifyRender(m); expect(finishedColor).not.toEqual(loadedColor); From 835a36010ac5a8e79affc303ab16d58879ad4143 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Tue, 10 Nov 2015 13:34:34 -0500 Subject: [PATCH 11/59] Added Cartographic.fromCartesian --- Source/Core/Cartographic.js | 22 +++++++++++++++++++ Specs/Core/CartographicSpec.js | 39 ++++++++++++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/Source/Core/Cartographic.js b/Source/Core/Cartographic.js index 96588dcdd141..704d04466522 100644 --- a/Source/Core/Cartographic.js +++ b/Source/Core/Cartographic.js @@ -105,6 +105,28 @@ define([ return Cartographic.fromRadians(longitude, latitude, height, result); }; + /** + * Creates a new Cartographic instance from a Cartesian position. The values in the + * resulting object will be in radians. + * + * @param {Cartesian3} cartesian The Cartesian position to convert to cartographic representation. + * @param {Ellipsoid} ellipsoid The ellipsoid on which the position lies. + * @param {Cartographic} [result] The object onto which to store the result. + * @returns {Cartographic} The modified result parameter, new Cartographic instance if none was provided, or undefined if the cartesian is at the center of the ellipsoid. + */ + Cartographic.fromCartesian = function(cartesian, ellipsoid, result) { + //>>includeStart('debug', pragmas.debug); + if (!defined(cartesian)) { + throw new DeveloperError('cartesian is required.'); + } + if (!defined(ellipsoid)) { + throw new DeveloperError('ellipsoid is required.'); + } + //>>includeEnd('debug'); + + return ellipsoid.cartesianToCartographic(cartesian, result); + }; + /** * Duplicates a Cartographic instance. * diff --git a/Specs/Core/CartographicSpec.js b/Specs/Core/CartographicSpec.js index 62ebd516bc38..d69e3d0dd672 100644 --- a/Specs/Core/CartographicSpec.js +++ b/Specs/Core/CartographicSpec.js @@ -1,11 +1,20 @@ /*global defineSuite*/ defineSuite([ - 'Core/Cartographic' + 'Core/Cartographic', + 'Core/Cartesian3', + 'Core/Ellipsoid', + 'Core/Math' ], function( - Cartographic) { + Cartographic, + Cartesian3, + Ellipsoid, + CesiumMath) { "use strict"; /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ + var surfaceCartesian = new Cartesian3(4094327.7921465295, 1909216.4044747739, 4487348.4088659193); + var surfaceCartographic = new Cartographic(CesiumMath.toRadians(25.0), CesiumMath.toRadians(45.0), 0.0); + it('default constructor sets expected properties', function() { var c = new Cartographic(); expect(c.longitude).toEqual(0); @@ -78,6 +87,32 @@ defineSuite([ expect(c.height).toEqual(0.0); }); + it('fromCartesian works without a result parameter', function() { + var ellipsoid = Ellipsoid.WGS84; + var c = Cartographic.fromCartesian(surfaceCartesian, ellipsoid); + expect(c).toEqualEpsilon(surfaceCartographic, CesiumMath.EPSILON8); + }); + + it('fromCartesian works with a result parameter', function() { + var ellipsoid = Ellipsoid.WGS84; + var result = new Cartographic(); + var c = Cartographic.fromCartesian(surfaceCartesian, ellipsoid, result); + expect(c).toEqualEpsilon(surfaceCartographic, CesiumMath.EPSILON8); + expect(result).toBe(c); + }); + + it('fromCartesian throws when there is no cartesian', function() { + expect(function() { + Cartographic.fromCartesian(); + }).toThrowDeveloperError(); + }); + + it('fromCartesian throws when there is no ellipsoid', function() { + expect(function() { + Cartographic.fromCartesian(surfaceCartesian); + }).toThrowDeveloperError(); + }); + it('clone without a result parameter', function() { var cartographic = new Cartographic(1.0, 2.0, 3.0); var result = cartographic.clone(); From 5abacc348f66b1e00fcd44a0f9da8af0aa6428b8 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Wed, 11 Nov 2015 21:48:39 -0500 Subject: [PATCH 12/59] Uses WGS84 as default Ellispoid --- Source/Core/Cartographic.js | 50 +++++++--- Source/Core/Ellipsoid.js | 102 +------------------ Source/Core/scaleToGeodeticSurface.js | 136 ++++++++++++++++++++++++++ Specs/Core/CartographicSpec.js | 11 +-- 4 files changed, 185 insertions(+), 114 deletions(-) create mode 100644 Source/Core/scaleToGeodeticSurface.js diff --git a/Source/Core/Cartographic.js b/Source/Core/Cartographic.js index 704d04466522..2c29e60ea9e9 100644 --- a/Source/Core/Cartographic.js +++ b/Source/Core/Cartographic.js @@ -1,16 +1,20 @@ /*global define*/ define([ + './Cartesian3', './defaultValue', './defined', './DeveloperError', './freezeObject', - './Math' + './Math', + './scaleToGeodeticSurface' ], function( + Cartesian3, defaultValue, defined, DeveloperError, freezeObject, - CesiumMath) { + CesiumMath, + scaleToGeodeticSurface) { "use strict"; /** @@ -105,26 +109,50 @@ define([ return Cartographic.fromRadians(longitude, latitude, height, result); }; + var cartesianToCartographicN = new Cartesian3(); + var cartesianToCartographicP = new Cartesian3(); + var cartesianToCartographicH = new Cartesian3(); + var wgs84OneOverRadii = new Cartesian3(1.0 / 6378137.0, 1.0 / 6378137.0, 1.0 / 6356752.3142451793); + var wgs84OneOverRadiiSquared = new Cartesian3(1.0 / (6378137.0 * 6378137.0), 1.0 / (6378137.0 * 6378137.0), 1.0 / (6356752.3142451793 * 6356752.3142451793)); + var wgs84CenterToleranceSquared = CesiumMath.EPSILON1; + /** * Creates a new Cartographic instance from a Cartesian position. The values in the * resulting object will be in radians. * * @param {Cartesian3} cartesian The Cartesian position to convert to cartographic representation. - * @param {Ellipsoid} ellipsoid The ellipsoid on which the position lies. + * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the position lies. * @param {Cartographic} [result] The object onto which to store the result. * @returns {Cartographic} The modified result parameter, new Cartographic instance if none was provided, or undefined if the cartesian is at the center of the ellipsoid. */ Cartographic.fromCartesian = function(cartesian, ellipsoid, result) { - //>>includeStart('debug', pragmas.debug); - if (!defined(cartesian)) { - throw new DeveloperError('cartesian is required.'); - } - if (!defined(ellipsoid)) { - throw new DeveloperError('ellipsoid is required.'); + var oneOverRadii = defined(ellipsoid) ? ellipsoid.oneOverRadii : wgs84OneOverRadii; + var oneOverRadiiSquared = defined(ellipsoid) ? ellipsoid.oneOverRadiiSquared : wgs84OneOverRadiiSquared; + var centerToleranceSquared = defined(ellipsoid) ? ellipsoid._centerToleranceSquared : wgs84CenterToleranceSquared; + + //`cartesian is required.` is thrown from scaleToGeodeticSurface + var p = scaleToGeodeticSurface(cartesian, oneOverRadii, oneOverRadiiSquared, centerToleranceSquared, cartesianToCartographicP); + + if (!defined(p)) { + return undefined; } - //>>includeEnd('debug'); - return ellipsoid.cartesianToCartographic(cartesian, result); + var n = Cartesian3.multiplyComponents(cartesian, oneOverRadiiSquared, cartesianToCartographicN); + n = Cartesian3.normalize(n, n); + + var h = Cartesian3.subtract(cartesian, p, cartesianToCartographicH); + + var longitude = Math.atan2(n.y, n.x); + var latitude = Math.asin(n.z); + var height = CesiumMath.sign(Cartesian3.dot(h, cartesian)) * Cartesian3.magnitude(h); + + if (!defined(result)) { + return new Cartographic(longitude, latitude, height); + } + result.longitude = longitude; + result.latitude = latitude; + result.height = height; + return result; }; /** diff --git a/Source/Core/Ellipsoid.js b/Source/Core/Ellipsoid.js index b5257e4e9521..7071158b8979 100644 --- a/Source/Core/Ellipsoid.js +++ b/Source/Core/Ellipsoid.js @@ -7,7 +7,8 @@ define([ './defineProperties', './DeveloperError', './freezeObject', - './Math' + './Math', + './scaleToGeodeticSurface' ], function( Cartesian3, Cartographic, @@ -16,7 +17,8 @@ define([ defineProperties, DeveloperError, freezeObject, - CesiumMath) { + CesiumMath, + scaleToGeodeticSurface) { "use strict"; function initialize(ellipsoid, x, y, z) { @@ -501,9 +503,6 @@ define([ return result; }; - var scaleToGeodeticSurfaceIntersection = new Cartesian3(); - var scaleToGeodeticSurfaceGradient = new Cartesian3(); - /** * Scales the provided Cartesian position along the geodetic surface normal * so that it is on the surface of this ellipsoid. If the position is @@ -514,98 +513,7 @@ define([ * @returns {Cartesian3} The modified result parameter, a new Cartesian3 instance if none was provided, or undefined if the position is at the center. */ Ellipsoid.prototype.scaleToGeodeticSurface = function(cartesian, result) { - //>>includeStart('debug', pragmas.debug); - if (!defined(cartesian)) { - throw new DeveloperError('cartesian is required.'); - } - //>>includeEnd('debug'); - - var positionX = cartesian.x; - var positionY = cartesian.y; - var positionZ = cartesian.z; - - var oneOverRadii = this._oneOverRadii; - var oneOverRadiiX = oneOverRadii.x; - var oneOverRadiiY = oneOverRadii.y; - var oneOverRadiiZ = oneOverRadii.z; - - var x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX; - var y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY; - var z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ; - - // Compute the squared ellipsoid norm. - var squaredNorm = x2 + y2 + z2; - var ratio = Math.sqrt(1.0 / squaredNorm); - - // As an initial approximation, assume that the radial intersection is the projection point. - var intersection = Cartesian3.multiplyByScalar(cartesian, ratio, scaleToGeodeticSurfaceIntersection); - - //* If the position is near the center, the iteration will not converge. - if (squaredNorm < this._centerToleranceSquared) { - return !isFinite(ratio) ? undefined : Cartesian3.clone(intersection, result); - } - - var oneOverRadiiSquared = this._oneOverRadiiSquared; - var oneOverRadiiSquaredX = oneOverRadiiSquared.x; - var oneOverRadiiSquaredY = oneOverRadiiSquared.y; - var oneOverRadiiSquaredZ = oneOverRadiiSquared.z; - - // Use the gradient at the intersection point in place of the true unit normal. - // The difference in magnitude will be absorbed in the multiplier. - var gradient = scaleToGeodeticSurfaceGradient; - gradient.x = intersection.x * oneOverRadiiSquaredX * 2.0; - gradient.y = intersection.y * oneOverRadiiSquaredY * 2.0; - gradient.z = intersection.z * oneOverRadiiSquaredZ * 2.0; - - // Compute the initial guess at the normal vector multiplier, lambda. - var lambda = (1.0 - ratio) * Cartesian3.magnitude(cartesian) / (0.5 * Cartesian3.magnitude(gradient)); - var correction = 0.0; - - var func; - var denominator; - var xMultiplier; - var yMultiplier; - var zMultiplier; - var xMultiplier2; - var yMultiplier2; - var zMultiplier2; - var xMultiplier3; - var yMultiplier3; - var zMultiplier3; - - do { - lambda -= correction; - - xMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredX); - yMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredY); - zMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredZ); - - xMultiplier2 = xMultiplier * xMultiplier; - yMultiplier2 = yMultiplier * yMultiplier; - zMultiplier2 = zMultiplier * zMultiplier; - - xMultiplier3 = xMultiplier2 * xMultiplier; - yMultiplier3 = yMultiplier2 * yMultiplier; - zMultiplier3 = zMultiplier2 * zMultiplier; - - func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1.0; - - // "denominator" here refers to the use of this expression in the velocity and acceleration - // computations in the sections to follow. - denominator = x2 * xMultiplier3 * oneOverRadiiSquaredX + y2 * yMultiplier3 * oneOverRadiiSquaredY + z2 * zMultiplier3 * oneOverRadiiSquaredZ; - - var derivative = -2.0 * denominator; - - correction = func / derivative; - } while (Math.abs(func) > CesiumMath.EPSILON12); - - if (!defined(result)) { - return new Cartesian3(positionX * xMultiplier, positionY * yMultiplier, positionZ * zMultiplier); - } - result.x = positionX * xMultiplier; - result.y = positionY * yMultiplier; - result.z = positionZ * zMultiplier; - return result; + return scaleToGeodeticSurface(cartesian, this._oneOverRadii, this._oneOverRadiiSquared, this._centerToleranceSquared, result); }; /** diff --git a/Source/Core/scaleToGeodeticSurface.js b/Source/Core/scaleToGeodeticSurface.js new file mode 100644 index 000000000000..e3328df8088f --- /dev/null +++ b/Source/Core/scaleToGeodeticSurface.js @@ -0,0 +1,136 @@ +/*global define*/ +define([ + './Cartesian3', + './Math', + './defined', + './DeveloperError' + ], function( + Cartesian3, + CesiumMath, + defined, + DeveloperError) { + "use strict"; + + var scaleToGeodeticSurfaceIntersection = new Cartesian3(); + var scaleToGeodeticSurfaceGradient = new Cartesian3(); + + /** + * Scales the provided Cartesian position along the geodetic surface normal + * so that it is on the surface of this ellipsoid. If the position is + * at the center of the ellipsoid, this function returns undefined. + * + * @param {Cartesian3} cartesian The Cartesian position to scale. + * @param {Cartesian3} oneOverRadii One over radii of the ellipsoid. + * @param {Cartesian3} oneOverRadiiSquared One over radii squared of the ellipsoid. + * @param {Number} centerToleranceSquared Tolerance for closeness to the center. + * @param {Cartesian3} [result] The object onto which to store the result. + * @returns {Cartesian3} The modified result parameter, a new Cartesian3 instance if none was provided, or undefined if the position is at the center. + * + * @exports scaleToGeodeticSurface + * + * @private + */ + var scaleToGeodeticSurface = function(cartesian, oneOverRadii, oneOverRadiiSquared, centerToleranceSquared, result) { + //>>includeStart('debug', pragmas.debug); + if (!defined(cartesian)) { + throw new DeveloperError('cartesian is required.'); + } + if (!defined(oneOverRadii)) { + throw new DeveloperError('oneOverRadii is required.'); + } + if (!defined(oneOverRadiiSquared)) { + throw new DeveloperError('oneOverRadiiSquared is required.'); + } + if (!defined(centerToleranceSquared)) { + throw new DeveloperError('centerToleranceSquared is required.'); + } + //>>includeEnd('debug'); + + var positionX = cartesian.x; + var positionY = cartesian.y; + var positionZ = cartesian.z; + + var oneOverRadiiX = oneOverRadii.x; + var oneOverRadiiY = oneOverRadii.y; + var oneOverRadiiZ = oneOverRadii.z; + + var x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX; + var y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY; + var z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ; + + // Compute the squared ellipsoid norm. + var squaredNorm = x2 + y2 + z2; + var ratio = Math.sqrt(1.0 / squaredNorm); + + // As an initial approximation, assume that the radial intersection is the projection point. + var intersection = Cartesian3.multiplyByScalar(cartesian, ratio, scaleToGeodeticSurfaceIntersection); + + // If the position is near the center, the iteration will not converge. + if (squaredNorm < centerToleranceSquared) { + return !isFinite(ratio) ? undefined : Cartesian3.clone(intersection, result); + } + + var oneOverRadiiSquaredX = oneOverRadiiSquared.x; + var oneOverRadiiSquaredY = oneOverRadiiSquared.y; + var oneOverRadiiSquaredZ = oneOverRadiiSquared.z; + + // Use the gradient at the intersection point in place of the true unit normal. + // The difference in magnitude will be absorbed in the multiplier. + var gradient = scaleToGeodeticSurfaceGradient; + gradient.x = intersection.x * oneOverRadiiSquaredX * 2.0; + gradient.y = intersection.y * oneOverRadiiSquaredY * 2.0; + gradient.z = intersection.z * oneOverRadiiSquaredZ * 2.0; + + // Compute the initial guess at the normal vector multiplier, lambda. + var lambda = (1.0 - ratio) * Cartesian3.magnitude(cartesian) / (0.5 * Cartesian3.magnitude(gradient)); + var correction = 0.0; + + var func; + var denominator; + var xMultiplier; + var yMultiplier; + var zMultiplier; + var xMultiplier2; + var yMultiplier2; + var zMultiplier2; + var xMultiplier3; + var yMultiplier3; + var zMultiplier3; + + do { + lambda -= correction; + + xMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredX); + yMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredY); + zMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredZ); + + xMultiplier2 = xMultiplier * xMultiplier; + yMultiplier2 = yMultiplier * yMultiplier; + zMultiplier2 = zMultiplier * zMultiplier; + + xMultiplier3 = xMultiplier2 * xMultiplier; + yMultiplier3 = yMultiplier2 * yMultiplier; + zMultiplier3 = zMultiplier2 * zMultiplier; + + func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1.0; + + // "denominator" here refers to the use of this expression in the velocity and acceleration + // computations in the sections to follow. + denominator = x2 * xMultiplier3 * oneOverRadiiSquaredX + y2 * yMultiplier3 * oneOverRadiiSquaredY + z2 * zMultiplier3 * oneOverRadiiSquaredZ; + + var derivative = -2.0 * denominator; + + correction = func / derivative; + } while (Math.abs(func) > CesiumMath.EPSILON12); + + if (!defined(result)) { + return new Cartesian3(positionX * xMultiplier, positionY * yMultiplier, positionZ * zMultiplier); + } + result.x = positionX * xMultiplier; + result.y = positionY * yMultiplier; + result.z = positionZ * zMultiplier; + return result; + }; + + return scaleToGeodeticSurface; +}); diff --git a/Specs/Core/CartographicSpec.js b/Specs/Core/CartographicSpec.js index d69e3d0dd672..e5ba19434dde 100644 --- a/Specs/Core/CartographicSpec.js +++ b/Specs/Core/CartographicSpec.js @@ -101,15 +101,14 @@ defineSuite([ expect(result).toBe(c); }); - it('fromCartesian throws when there is no cartesian', function() { - expect(function() { - Cartographic.fromCartesian(); - }).toThrowDeveloperError(); + it('fromCartesian works without an ellipsoid', function() { + var c = Cartographic.fromCartesian(surfaceCartesian); + expect(c).toEqualEpsilon(surfaceCartographic, CesiumMath.EPSILON8); }); - it('fromCartesian throws when there is no ellipsoid', function() { + it('fromCartesian throws when there is no cartesian', function() { expect(function() { - Cartographic.fromCartesian(surfaceCartesian); + Cartographic.fromCartesian(); }).toThrowDeveloperError(); }); From f94118d27c353688f224c4a3a106a541cb0a256e Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Wed, 11 Nov 2015 21:50:50 -0500 Subject: [PATCH 13/59] Updated Picking.html --- Apps/Sandcastle/gallery/Picking.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apps/Sandcastle/gallery/Picking.html b/Apps/Sandcastle/gallery/Picking.html index 8655d47583ec..80869a51a753 100644 --- a/Apps/Sandcastle/gallery/Picking.html +++ b/Apps/Sandcastle/gallery/Picking.html @@ -174,7 +174,7 @@ var cartesian = viewer.scene.pickPosition(movement.endPosition); if (Cesium.defined(cartesian)) { - var cartographic = ellipsoid.cartesianToCartographic(cartesian); + var cartographic = Cesium.Cartographic.fromCartesian(cartesian); var longitudeString = Cesium.Math.toDegrees(cartographic.longitude).toFixed(2); var latitudeString = Cesium.Math.toDegrees(cartographic.latitude).toFixed(2); var heightString = cartographic.height.toFixed(2); From 09fc15c9d92cccd9d92cbeac260c178ae9919c20 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Wed, 11 Nov 2015 21:54:37 -0500 Subject: [PATCH 14/59] Updated CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 5dab53d3f7bb..47aaa1fff6f4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -19,6 +19,7 @@ Change Log * Added `Camera.distanceToBoundingSphere` function. * Added utility function `getBaseUri`, which given a URI with or without query parameters, returns the base path of the URI. * Added support for incrementally loading textures after a Model is ready. This allows the Model to be visible as soon as possible while its textures are loaded in the background. +* Added 'Cartographic.fromCartesian' function. ### 1.15 - 2015-11-02 From 7eb031a1d91a14b9ce016420e6dc63575a5a1fc5 Mon Sep 17 00:00:00 2001 From: Patrick Cozzi Date: Thu, 12 Nov 2015 08:09:04 -0500 Subject: [PATCH 15/59] Tweak picking example --- Apps/Sandcastle/gallery/Picking.html | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Apps/Sandcastle/gallery/Picking.html b/Apps/Sandcastle/gallery/Picking.html index 80869a51a753..6616cd00b9fe 100644 --- a/Apps/Sandcastle/gallery/Picking.html +++ b/Apps/Sandcastle/gallery/Picking.html @@ -36,7 +36,6 @@ var handler; Sandcastle.addDefaultToolbarButton('Show Cartographic Position on Mouse Over', function() { - var ellipsoid = scene.globe.ellipsoid; var entity = viewer.entities.add({ label : { show : false @@ -46,9 +45,9 @@ // Mouse over the globe to see the cartographic position handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); handler.setInputAction(function(movement) { - var cartesian = viewer.camera.pickEllipsoid(movement.endPosition, ellipsoid); + var cartesian = viewer.camera.pickEllipsoid(movement.endPosition, scene.globe.ellipsoid); if (cartesian) { - var cartographic = ellipsoid.cartesianToCartographic(cartesian); + var cartographic = Cesium.Cartographic.fromCartesian(cartesian); var longitudeString = Cesium.Math.toDegrees(cartographic.longitude).toFixed(2); var latitudeString = Cesium.Math.toDegrees(cartographic.latitude).toFixed(2); @@ -145,8 +144,6 @@ }); Sandcastle.addToolbarButton('Pick position', function() { - var ellipsoid = scene.globe.ellipsoid; - var modelEntity = viewer.entities.add({ name : 'milktruck', position : Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706), From c7af4439d766b9c933c6a99678b40788ec547f7d Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 12 Nov 2015 12:10:37 -0500 Subject: [PATCH 16/59] Fix bounding volume and horizon culling point computations for exaggerated quantized mesh terrain. --- Source/Core/QuantizedMeshTerrainData.js | 25 ++++++++++----- .../createVerticesFromQuantizedTerrainMesh.js | 32 +++++++++++++++++-- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/Source/Core/QuantizedMeshTerrainData.js b/Source/Core/QuantizedMeshTerrainData.js index 987516d4f73c..343b385195e8 100644 --- a/Source/Core/QuantizedMeshTerrainData.js +++ b/Source/Core/QuantizedMeshTerrainData.js @@ -291,16 +291,25 @@ define([ vertexCount += that._westIndices.length + that._southIndices.length + that._eastIndices.length + that._northIndices.length; var indicesTypedArray = IndexDatatype.createTypedArray(vertexCount, result.indices); + var vertices = new Float32Array(result.vertices); + var rtc = result.center; + var minimumHeight = result.minimumHeight; + var maximumHeight = result.maximumHeight; + var boundingSphere = defaultValue(result.boundingSphere, that._boundingSphere); + var obb = defaultValue(result.orientedBoundingBox, that._orientedBoundingBox); + var occlusionPoint = defaultValue(result.occludeePointInScaledSpace, that._horizonOcclusionPoint); + var stride = result.vertexStride; + return new TerrainMesh( - that._boundingSphere.center, - new Float32Array(result.vertices), + rtc, + vertices, indicesTypedArray, - that._minimumHeight, - that._maximumHeight, - that._boundingSphere, - that._horizonOcclusionPoint, - defined(that._encodedNormals) ? 7 : 6, - that._orientedBoundingBox); + minimumHeight, + maximumHeight, + boundingSphere, + occlusionPoint, + stride, + obb); }); }; diff --git a/Source/Workers/createVerticesFromQuantizedTerrainMesh.js b/Source/Workers/createVerticesFromQuantizedTerrainMesh.js index 5ed45fc6b36b..5bc3e051c065 100644 --- a/Source/Workers/createVerticesFromQuantizedTerrainMesh.js +++ b/Source/Workers/createVerticesFromQuantizedTerrainMesh.js @@ -1,23 +1,29 @@ /*global define*/ define([ '../Core/AttributeCompression', + '../Core/BoundingSphere', '../Core/Cartesian2', '../Core/Cartesian3', '../Core/Cartographic', '../Core/defined', '../Core/Ellipsoid', + '../Core/EllipsoidalOccluder', '../Core/IndexDatatype', '../Core/Math', + '../Core/OrientedBoundingBox', './createTaskProcessorWorker' ], function( AttributeCompression, + BoundingSphere, Cartesian2, Cartesian3, Cartographic, defined, Ellipsoid, + EllipsoidalOccluder, IndexDatatype, CesiumMath, + OrientedBoundingBox, createTaskProcessorWorker) { "use strict"; @@ -44,7 +50,10 @@ define([ var minimumHeight = parameters.minimumHeight; var maximumHeight = parameters.maximumHeight; var center = parameters.relativeToCenter; + var exaggeration = parameters.exaggeration; + minimumHeight *= exaggeration; + maximumHeight *= exaggeration; var rectangle = parameters.rectangle; var west = rectangle.west; @@ -73,7 +82,7 @@ define([ cartographicScratch.longitude = CesiumMath.lerp(west, east, u); cartographicScratch.latitude = CesiumMath.lerp(south, north, v); - cartographicScratch.height = height * exaggeration; + cartographicScratch.height = height; ellipsoid.cartographicToCartesian(cartographicScratch, cartesian3Scratch); @@ -95,6 +104,18 @@ define([ var indexBuffer = IndexDatatype.createTypedArray(quantizedVertexCount + edgeVertexCount, indexBufferLength); indexBuffer.set(parameters.indices, 0); + var occludeePointInScaledSpace; + var orientedBoundingBox; + var boundingSphere; + + if (exaggeration > 1.0) { + boundingSphere = BoundingSphere.fromVertices(vertexBuffer, center, vertexStride); + orientedBoundingBox = OrientedBoundingBox.fromRectangle(rectangle, minimumHeight, maximumHeight, ellipsoid); + + var occluder = new EllipsoidalOccluder(ellipsoid); + occludeePointInScaledSpace = occluder.computeHorizonCullingPointFromVertices(center, vertexBuffer, vertexStride); + } + // Add skirts. var vertexBufferIndex = quantizedVertexCount * vertexStride; var indexBufferIndex = parameters.indices.length; @@ -111,7 +132,14 @@ define([ return { vertices : vertexBuffer.buffer, - indices : indexBuffer.buffer + indices : indexBuffer.buffer, + vertexStride : vertexStride, + center : center, + minimumHeight : minimumHeight, + maximumHeight : maximumHeight, + boundingSphere : boundingSphere, + orientedBoundingBox : orientedBoundingBox, + occludeePointInScaledSpace : occludeePointInScaledSpace }; } From 57c9b63c5a5e1873aef97d5c6f67ff018c387565 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 12 Nov 2015 12:21:54 -0500 Subject: [PATCH 17/59] Fix ground primitives with exaggeration. --- Source/Scene/GroundPrimitive.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Source/Scene/GroundPrimitive.js b/Source/Scene/GroundPrimitive.js index e97362abaa94..2577da991ce4 100644 --- a/Source/Scene/GroundPrimitive.js +++ b/Source/Scene/GroundPrimitive.js @@ -317,9 +317,13 @@ define([ return scene.context.fragmentDepth; }; - GroundPrimitive._maxHeight = 9000.0; - GroundPrimitive._minHeight = -100000.0; - GroundPrimitive._minOBBHeight = -11500.0; + GroundPrimitive._maxHeight = undefined; + GroundPrimitive._minHeight = undefined; + GroundPrimitive._minOBBHeight = undefined; + + GroundPrimitive._maxTerrainHeight = 9000.0; + GroundPrimitive._minTerrainHeight = -100000.0; + GroundPrimitive._minOBBTerrainHeight = -11500.0; function computeMaximumHeight(granularity, ellipsoid) { var r = ellipsoid.maximumRadius; @@ -675,6 +679,13 @@ define([ return; } + if (!defined(GroundPrimitive._maxHeight)) { + var exaggeration = frameState.terrainExaggeration; + GroundPrimitive._maxHeight = GroundPrimitive._maxTerrainHeight * exaggeration; + GroundPrimitive._minHeight = GroundPrimitive._minTerrainHeight * exaggeration; + GroundPrimitive._minOBBHeight = GroundPrimitive._minOBBTerrainHeight * exaggeration; + } + if (!defined(this._primitive)) { var instance = this.geometryInstance; var geometry = instance.geometry; From c0a866d38ae413d038fa1678a0e3f9887be046a2 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 12 Nov 2015 13:20:10 -0500 Subject: [PATCH 18/59] Fix picking and collision detection with exaggerated terrain. --- Source/Scene/ScreenSpaceCameraController.js | 24 ++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Source/Scene/ScreenSpaceCameraController.js b/Source/Scene/ScreenSpaceCameraController.js index 7d6e725eeb1f..0a041c158fa3 100644 --- a/Source/Scene/ScreenSpaceCameraController.js +++ b/Source/Scene/ScreenSpaceCameraController.js @@ -749,7 +749,7 @@ define([ var normal = Cartesian3.UNIT_X; var globePos; - if (camera.position.z < controller.minimumPickingTerrainHeight) { + if (camera.position.z < controller.minimumPickingTerrainHeight * controller._scene.terrainExaggeration) { globePos = pickGlobe(controller, startMouse, translateCVStartPos); if (defined(globePos)) { origin.x = globePos.x; @@ -825,7 +825,7 @@ define([ var maxCoord = controller._maxCoord; var onMap = Math.abs(camera.position.x) - maxCoord.x < 0 && Math.abs(camera.position.y) - maxCoord.y < 0; - if (controller._tiltCVOffMap || !onMap || camera.position.z > controller.minimumPickingTerrainHeight) { + if (controller._tiltCVOffMap || !onMap || camera.position.z > controller.minimumPickingTerrainHeight * controller._scene.terrainExaggeration) { controller._tiltCVOffMap = true; rotateCVOnPlane(controller, startPosition, movement); } else { @@ -904,7 +904,7 @@ define([ if (Cartesian2.equals(startPosition, controller._tiltCenterMousePosition)) { center = Cartesian3.clone(controller._tiltCenter, rotateCVCenter); } else { - if (camera.position.z < controller.minimumPickingTerrainHeight) { + if (camera.position.z < controller.minimumPickingTerrainHeight * controller._scene.terrainExaggeration) { center = pickGlobe(controller, startPosition, rotateCVCenter); } @@ -1070,7 +1070,7 @@ define([ var ray = camera.getPickRay(windowPosition, zoomCVWindowRay); var intersection; - if (camera.position.z < controller.minimumPickingTerrainHeight) { + if (camera.position.z < controller.minimumPickingTerrainHeight * controller._scene.terrainExaggeration) { intersection = pickGlobe(controller, windowPosition, zoomCVIntersection); } @@ -1184,7 +1184,7 @@ define([ var mousePos; var tangentPick = false; - if (defined(globe) && height < controller.minimumPickingTerrainHeight) { + if (defined(globe) && height < controller.minimumPickingTerrainHeight * controller._scene.terrainExaggeration) { mousePos = pickGlobe(controller, movement.startPosition, scratchMousePos); if (defined(mousePos)) { var ray = camera.getPickRay(movement.startPosition, pickGlobeScratchRay); @@ -1220,7 +1220,7 @@ define([ controller._strafing = false; } - if (defined(globe) && height < controller.minimumPickingTerrainHeight) { + if (defined(globe) && height < controller.minimumPickingTerrainHeight * controller._scene.terrainExaggeration) { if (defined(mousePos)) { if (Cartesian3.magnitude(camera.position) < Cartesian3.magnitude(mousePos)) { Cartesian3.clone(mousePos, controller._strafeStartPosition); @@ -1243,7 +1243,7 @@ define([ } else if (defined(camera.pickEllipsoid(movement.startPosition, controller._ellipsoid, spin3DPick))) { pan3D(controller, startPosition, movement, controller._ellipsoid); Cartesian3.clone(spin3DPick, controller._rotateStartPosition); - } else if (height > controller.minimumTrackBallHeight) { + } else if (height > controller.minimumTrackBallHeigh * controller._scene.terrainExaggerationt) { controller._rotating = true; rotate3D(controller, startPosition, movement); } else { @@ -1417,7 +1417,7 @@ define([ var intersection; var height = ellipsoid.cartesianToCartographic(camera.position, zoom3DCartographic).height; - if (height < controller.minimumPickingTerrainHeight) { + if (height < controller.minimumPickingTerrainHeight * controller._scene.terrainExaggeration) { intersection = pickGlobe(controller, windowPosition, zoomCVIntersection); } @@ -1471,7 +1471,7 @@ define([ var ellipsoid = controller._ellipsoid; var cartographic = ellipsoid.cartesianToCartographic(camera.position, tilt3DCart); - if (controller._tiltOnEllipsoid || cartographic.height > controller.minimumCollisionTerrainHeight) { + if (controller._tiltOnEllipsoid || cartographic.height > controller.minimumCollisionTerrainHeight * controller._scene.terrainExaggeration) { controller._tiltOnEllipsoid = true; tilt3DOnEllipsoid(controller, startPosition, movement); } else { @@ -1503,7 +1503,7 @@ define([ var intersection = IntersectionTests.rayEllipsoid(ray, ellipsoid); if (defined(intersection)) { center = Ray.getPoint(ray, intersection.start, tilt3DCenter); - } else if (height > controller.minimumTrackBallHeight) { + } else if (height > controller.minimumTrackBallHeight * controller._scene.terrainExaggeration) { var grazingAltitudeLocation = IntersectionTests.grazingAltitudeLocation(ray, ellipsoid); if (!defined(grazingAltitudeLocation)) { return; @@ -1561,7 +1561,7 @@ define([ intersection = IntersectionTests.rayEllipsoid(ray, ellipsoid); if (!defined(intersection)) { var cartographic = ellipsoid.cartesianToCartographic(camera.position, tilt3DCart); - if (cartographic.height <= controller.minimumTrackBallHeight) { + if (cartographic.height <= controller.minimumTrackBallHeight * controller._scene.terrainExaggeration) { controller._looking = true; var up = controller._ellipsoid.geodeticSurfaceNormal(camera.position, tilt3DLookUp); look3D(controller, startPosition, movement, up); @@ -1804,7 +1804,7 @@ define([ } var heightUpdated = false; - if (cartographic.height < controller.minimumCollisionTerrainHeight) { + if (cartographic.height < controller.minimumCollisionTerrainHeight * controller._scene.terrainExaggeration) { var height = globe.getHeight(cartographic); if (defined(height)) { height += controller.minimumZoomDistance; From 2457f9d2e4836cac79bdc8b95961ce44da3d46dd Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 12 Nov 2015 13:36:31 -0500 Subject: [PATCH 19/59] Disable fog with terrain exaggeration. --- Source/Scene/Fog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Scene/Fog.js b/Source/Scene/Fog.js index 68354b8ac157..0ab675585a75 100644 --- a/Source/Scene/Fog.js +++ b/Source/Scene/Fog.js @@ -114,7 +114,7 @@ define([ var positionCartographic = camera.positionCartographic; // Turn off fog in space. - if (!defined(positionCartographic) || positionCartographic.height > 800000.0 || frameState.mode !== SceneMode.SCENE3D) { + if (!defined(positionCartographic) || positionCartographic.height > 800000.0 || frameState.mode !== SceneMode.SCENE3D || frameState.terrainExaggeration > 1.0) { frameState.fog.enabled = false; return; } From e5b88606dec84243cf23e7594c8030ba3f78fa83 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 12 Nov 2015 13:52:38 -0500 Subject: [PATCH 20/59] Update doc. --- CHANGES.md | 1 + Source/Scene/FrameState.js | 4 ++++ Source/Widgets/CesiumWidget/CesiumWidget.js | 2 +- Source/Widgets/Viewer/Viewer.js | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 47aaa1fff6f4..70054c17b834 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -20,6 +20,7 @@ Change Log * Added utility function `getBaseUri`, which given a URI with or without query parameters, returns the base path of the URI. * Added support for incrementally loading textures after a Model is ready. This allows the Model to be visible as soon as possible while its textures are loaded in the background. * Added 'Cartographic.fromCartesian' function. +* Added terrain exaggeration. Enabled on viewer creation with the exaggeration scalar as the `terrainExaggeration` option. ### 1.15 - 2015-11-02 diff --git a/Source/Scene/FrameState.js b/Source/Scene/FrameState.js index d85f5ac77029..bb3bc86a282d 100644 --- a/Source/Scene/FrameState.js +++ b/Source/Scene/FrameState.js @@ -157,6 +157,10 @@ define([ sse : undefined }; + /** + * A scalar used to exaggerate the terrain. + * @type {Number} + */ this.terrainExaggeration = undefined; }; diff --git a/Source/Widgets/CesiumWidget/CesiumWidget.js b/Source/Widgets/CesiumWidget/CesiumWidget.js index 397f9a265e0b..24511e23b132 100644 --- a/Source/Widgets/CesiumWidget/CesiumWidget.js +++ b/Source/Widgets/CesiumWidget/CesiumWidget.js @@ -153,7 +153,7 @@ define([ * @param {Object} [options.contextOptions] Context and WebGL creation properties corresponding to options passed to {@link Scene}. * @param {Element|String} [options.creditContainer] The DOM element or ID that will contain the {@link CreditDisplay}. If not specified, the credits are added * to the bottom of the widget itself. - * @param {Number} [terrainExaggeration] The scalar amount to exaggerate the terrain. + * @param {Number} [options.terrainExaggeration=1.0] A scalar used to exaggerate the terrain. Note that terrain exaggeration will not modify any other primitive as they are positioned relative to the ellipsoid. * * @exception {DeveloperError} Element with id "container" does not exist in the document. * diff --git a/Source/Widgets/Viewer/Viewer.js b/Source/Widgets/Viewer/Viewer.js index 531d6023a01b..edf54b8353a1 100644 --- a/Source/Widgets/Viewer/Viewer.js +++ b/Source/Widgets/Viewer/Viewer.js @@ -219,7 +219,7 @@ define([ * @param {Element|String} [options.creditContainer] The DOM element or ID that will contain the {@link CreditDisplay}. If not specified, the credits are added to the bottom of the widget itself. * @param {DataSourceCollection} [options.dataSources=new DataSourceCollection()] The collection of data sources visualized by the widget. If this parameter is provided, * the instance is assumed to be owned by the caller and will not be destroyed when the viewer is destroyed. - * @param {Number} The scalar amount to exaggerate the terrain. + * @param {Number} [options.terrainExaggeration=1.0] A scalar used to exaggerate the terrain. Note that terrain exaggeration will not modify any other primitive as they are positioned relative to the ellipsoid. * * @exception {DeveloperError} Element with id "container" does not exist in the document. * @exception {DeveloperError} options.imageryProvider is not available when using the BaseLayerPicker widget, specify options.selectedImageryProviderViewModel instead. From 6f49c53f274cbea9b99755afc3755aaf4d3a3101 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 12 Nov 2015 13:53:36 -0500 Subject: [PATCH 21/59] Update doc. --- Source/Scene/Scene.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 97db7d116ee6..3a10d8d45e78 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -173,7 +173,7 @@ define([ * @param {MapProjection} [options.mapProjection=new GeographicProjection()] The map projection to use in 2D and Columbus View modes. * @param {Boolean} [options.orderIndependentTranslucency=true] If true and the configuration supports it, use order independent translucency. * @param {Boolean} [options.scene3DOnly=false] If true, optimizes memory use and performance for 3D mode but disables the ability to use 2D or Columbus View. - * @param {Number} [options.terrainExaggeration=1.0] A scalar used to exaggerate the terrain. + * @param {Number} [options.terrainExaggeration=1.0] A scalar used to exaggerate the terrain. Note that terrain exaggeration will not modify any other primitive as they are positioned relative to the ellipsoid. * * @see CesiumWidget * @see {@link http://www.khronos.org/registry/webgl/specs/latest/#5.2|WebGLContextAttributes} From 6ddfd327f28e16add34fa509b2fcb8c63a945e5a Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 12 Nov 2015 14:19:06 -0500 Subject: [PATCH 22/59] Fix tests. --- Source/Scene/ScreenSpaceCameraController.js | 2 +- Specs/Core/QuantizedMeshTerrainDataSpec.js | 72 ++++++------ Specs/Scene/GlobeSurfaceTileSpec.js | 106 +++++++++--------- .../Scene/ScreenSpaceCameraControllerSpec.js | 1 + Specs/createFrameState.js | 2 + 5 files changed, 93 insertions(+), 90 deletions(-) diff --git a/Source/Scene/ScreenSpaceCameraController.js b/Source/Scene/ScreenSpaceCameraController.js index 0a041c158fa3..dc42ed765535 100644 --- a/Source/Scene/ScreenSpaceCameraController.js +++ b/Source/Scene/ScreenSpaceCameraController.js @@ -1243,7 +1243,7 @@ define([ } else if (defined(camera.pickEllipsoid(movement.startPosition, controller._ellipsoid, spin3DPick))) { pan3D(controller, startPosition, movement, controller._ellipsoid); Cartesian3.clone(spin3DPick, controller._rotateStartPosition); - } else if (height > controller.minimumTrackBallHeigh * controller._scene.terrainExaggerationt) { + } else if (height > controller.minimumTrackBallHeight * controller._scene.terrainExaggeration) { controller._rotating = true; rotate3D(controller, startPosition, movement); } else { diff --git a/Specs/Core/QuantizedMeshTerrainDataSpec.js b/Specs/Core/QuantizedMeshTerrainDataSpec.js index 31f618644e0a..e84055970f16 100644 --- a/Specs/Core/QuantizedMeshTerrainDataSpec.js +++ b/Specs/Core/QuantizedMeshTerrainDataSpec.js @@ -427,44 +427,44 @@ defineSuite([ expect(mesh.boundingSphere3D).toEqual(data._boundingSphere); }); }); - }); - it('createMesh requires 32bit indices for large meshes', function() { - var tilingScheme = new GeographicTilingScheme(); - var quantizedVertices = []; - var i; - for (i = 0; i < 65 * 1024; i++) { - quantizedVertices.push(i % 32767); // u - } - for (i = 0; i < 65 * 1024; i++) { - quantizedVertices.push(Math.floor(i / 32767)); // v - } - for (i = 0; i < 65 * 1024; i++) { - quantizedVertices.push(0.0); // height - } - var data = new QuantizedMeshTerrainData({ - minimumHeight : 0.0, - maximumHeight : 4.0, - quantizedVertices : new Uint16Array(quantizedVertices), - indices : new Uint32Array([ 0, 3, 1, - 0, 2, 3, - 65000, 65002, 65003]), - boundingSphere : new BoundingSphere(), - horizonOcclusionPoint : new Cartesian3(), - westIndices : [0, 1], - southIndices : [0, 1], - eastIndices : [2, 3], - northIndices : [1, 3], - westSkirtHeight : 1.0, - southSkirtHeight : 1.0, - eastSkirtHeight : 1.0, - northSkirtHeight : 1.0, - childTileMask : 15 - }); + it('requires 32bit indices for large meshes', function() { + var tilingScheme = new GeographicTilingScheme(); + var quantizedVertices = []; + var i; + for (i = 0; i < 65 * 1024; i++) { + quantizedVertices.push(i % 32767); // u + } + for (i = 0; i < 65 * 1024; i++) { + quantizedVertices.push(Math.floor(i / 32767)); // v + } + for (i = 0; i < 65 * 1024; i++) { + quantizedVertices.push(0.0); // height + } + var data = new QuantizedMeshTerrainData({ + minimumHeight : 0.0, + maximumHeight : 4.0, + quantizedVertices : new Uint16Array(quantizedVertices), + indices : new Uint32Array([ 0, 3, 1, + 0, 2, 3, + 65000, 65002, 65003]), + boundingSphere : new BoundingSphere(), + horizonOcclusionPoint : new Cartesian3(), + westIndices : [0, 1], + southIndices : [0, 1], + eastIndices : [2, 3], + northIndices : [1, 3], + westSkirtHeight : 1.0, + southSkirtHeight : 1.0, + eastSkirtHeight : 1.0, + northSkirtHeight : 1.0, + childTileMask : 15 + }); - return data.createMesh(tilingScheme, 0, 0, 0).then(function(mesh) { - expect(mesh).toBeInstanceOf(TerrainMesh); - expect(mesh.indices.BYTES_PER_ELEMENT).toBe(4); + return data.createMesh(tilingScheme, 0, 0, 0).then(function(mesh) { + expect(mesh).toBeInstanceOf(TerrainMesh); + expect(mesh.indices.BYTES_PER_ELEMENT).toBe(4); + }); }); }); diff --git a/Specs/Scene/GlobeSurfaceTileSpec.js b/Specs/Scene/GlobeSurfaceTileSpec.js index feb18ec43079..779c6f17bb47 100644 --- a/Specs/Scene/GlobeSurfaceTileSpec.js +++ b/Specs/Scene/GlobeSurfaceTileSpec.js @@ -19,6 +19,7 @@ defineSuite([ 'Scene/TerrainState', 'Scene/TileImagery', 'Specs/createContext', + 'Specs/createFrameState', 'Specs/pollToPromise', 'ThirdParty/when' ], function( @@ -41,14 +42,14 @@ defineSuite([ TerrainState, TileImagery, createContext, + createFrameState, pollToPromise, when) { "use strict"; /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ describe('processStateMachine', function() { - var context; - var commandList = []; + var frameState; var alwaysDeferTerrainProvider; var alwaysFailTerrainProvider; var realTerrainProvider; @@ -59,7 +60,7 @@ defineSuite([ var imageryLayerCollection; beforeAll(function() { - context = createContext(); + frameState = createFrameState(createContext()); alwaysDeferTerrainProvider = { requestTileGeometry : function(x, y, level) { @@ -95,7 +96,7 @@ defineSuite([ }); afterAll(function() { - context.destroyForSpecs(); + frameState.context.destroyForSpecs(); }); beforeEach(function() { @@ -125,12 +126,12 @@ defineSuite([ }); it('transitions to the LOADING state immediately', function() { - GlobeSurfaceTile.processStateMachine(rootTile, context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(rootTile, frameState, alwaysDeferTerrainProvider, imageryLayerCollection); expect(rootTile.state).toBe(QuadtreeTileLoadState.LOADING); }); it('creates loadedTerrain but not upsampledTerrain for root tiles', function() { - GlobeSurfaceTile.processStateMachine(rootTile, context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(rootTile, frameState, alwaysDeferTerrainProvider, imageryLayerCollection); expect(rootTile.data.loadedTerrain).toBeDefined(); expect(rootTile.data.upsampledTerrain).toBeUndefined(); }); @@ -138,7 +139,7 @@ defineSuite([ it('non-root tiles get neither loadedTerrain nor upsampledTerrain when their parent is not loaded nor upsampled', function() { var children = rootTile.children; for (var i = 0; i < children.length; ++i) { - GlobeSurfaceTile.processStateMachine(children[i], context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(children[i], frameState, alwaysDeferTerrainProvider, imageryLayerCollection); expect(children[i].data.loadedTerrain).toBeUndefined(); expect(children[i].data.upsampledTerrain).toBeUndefined(); } @@ -146,12 +147,12 @@ defineSuite([ it('once a root tile is loaded, its children get both loadedTerrain and upsampledTerrain', function() { return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(rootTile, context, commandList, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(rootTile, frameState, realTerrainProvider, imageryLayerCollection); return rootTile.state === QuadtreeTileLoadState.DONE; }).then(function() { var children = rootTile.children; for (var i = 0; i < children.length; ++i) { - GlobeSurfaceTile.processStateMachine(children[i], context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(children[i], frameState, alwaysDeferTerrainProvider, imageryLayerCollection); expect(children[i].data.loadedTerrain).toBeDefined(); expect(children[i].data.upsampledTerrain).toBeDefined(); } @@ -160,7 +161,7 @@ defineSuite([ it('loaded terrainData is copied to the tile once it is available', function() { return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(rootTile, context, commandList, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(rootTile, frameState, realTerrainProvider, imageryLayerCollection); return rootTile.data.loadedTerrain.state >= TerrainState.RECEIVED; }).then(function() { expect(rootTile.data.terrainData).toBeDefined(); @@ -169,12 +170,12 @@ defineSuite([ it('upsampled terrainData is copied to the tile once it is available', function() { return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(rootTile, context, commandList, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(rootTile, frameState, realTerrainProvider, imageryLayerCollection); return rootTile.data.loadedTerrain.state >= TerrainState.RECEIVED; }).then(function() { return pollToPromise(function() { var childTile = rootTile.children[0]; - GlobeSurfaceTile.processStateMachine(childTile, context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(childTile, frameState, alwaysDeferTerrainProvider, imageryLayerCollection); return childTile.data.upsampledTerrain.state >= TerrainState.RECEIVED; }).then(function() { expect(rootTile.children[0].data.terrainData).toBeDefined(); @@ -186,20 +187,20 @@ defineSuite([ var childTile = rootTile.children[0]; return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(rootTile, context, commandList, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(rootTile, frameState, realTerrainProvider, imageryLayerCollection); return rootTile.data.loadedTerrain.state >= TerrainState.RECEIVED; }).then(function() { var upsampledTerrainData; return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(childTile, context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(childTile, frameState, alwaysDeferTerrainProvider, imageryLayerCollection); return childTile.data.upsampledTerrain.state >= TerrainState.RECEIVED; }).then(function() { upsampledTerrainData = childTile.data.terrainData; expect(upsampledTerrainData).toBeDefined(); return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(childTile, context, commandList, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(childTile, frameState, realTerrainProvider, imageryLayerCollection); return childTile.data.loadedTerrain.state >= TerrainState.RECEIVED; }).then(function() { expect(childTile.data.terrainData).not.toBe(upsampledTerrainData); @@ -213,9 +214,9 @@ defineSuite([ var grandchildTile = childTile.children[0]; return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(rootTile, context, commandList, realTerrainProvider, imageryLayerCollection); - GlobeSurfaceTile.processStateMachine(childTile, context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); - GlobeSurfaceTile.processStateMachine(grandchildTile, context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(rootTile, frameState, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(childTile, frameState, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(grandchildTile, frameState, alwaysDeferTerrainProvider, imageryLayerCollection); return rootTile.data.loadedTerrain.state >= TerrainState.RECEIVED && childTile.data.upsampledTerrain.state >= TerrainState.RECEIVED && grandchildTile.data.upsampledTerrain.state >= TerrainState.RECEIVED; @@ -224,7 +225,7 @@ defineSuite([ expect(grandchildTile.data.loadedTerrain).toBeUndefined(); return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(childTile, context, commandList, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(childTile, frameState, realTerrainProvider, imageryLayerCollection); return childTile.data.loadedTerrain.state >= TerrainState.RECEIVED; }).then(function() { expect(grandchildTile.data.upsampledTerrain).not.toBe(grandchildUpsampledTerrain); @@ -239,10 +240,10 @@ defineSuite([ var greatGrandchildTile = grandchildTile.children[0]; return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(rootTile, context, commandList, realTerrainProvider, imageryLayerCollection); - GlobeSurfaceTile.processStateMachine(childTile, context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); - GlobeSurfaceTile.processStateMachine(grandchildTile, context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); - GlobeSurfaceTile.processStateMachine(greatGrandchildTile, context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(rootTile, frameState, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(childTile, frameState, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(grandchildTile, frameState, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(greatGrandchildTile, frameState, alwaysDeferTerrainProvider, imageryLayerCollection); return rootTile.data.loadedTerrain.state >= TerrainState.RECEIVED && childTile.data.upsampledTerrain.state >= TerrainState.RECEIVED && grandchildTile.data.upsampledTerrain.state >= TerrainState.RECEIVED && @@ -251,8 +252,8 @@ defineSuite([ var greatGrandchildUpsampledTerrain = grandchildTile.data.upsampledTerrain; return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(childTile, context, commandList, realTerrainProvider, imageryLayerCollection); - GlobeSurfaceTile.processStateMachine(grandchildTile, context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(childTile, frameState, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(grandchildTile, frameState, alwaysDeferTerrainProvider, imageryLayerCollection); return childTile.data.loadedTerrain.state >= TerrainState.RECEIVED && grandchildTile.data.upsampledTerrain.state >= TerrainState.RECEIVED; }).then(function() { @@ -266,8 +267,8 @@ defineSuite([ var childTile = rootTile.children[0]; return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(rootTile, context, commandList, realTerrainProvider, imageryLayerCollection); - GlobeSurfaceTile.processStateMachine(childTile, context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(rootTile, frameState, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(childTile, frameState, alwaysDeferTerrainProvider, imageryLayerCollection); return rootTile.renderable && childTile.renderable; }).then(function() { expect(childTile.data.waterMaskTexture).toBeDefined(); @@ -275,7 +276,7 @@ defineSuite([ var referenceCount = childWaterMaskTexture.referenceCount; return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(childTile, context, commandList, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(childTile, frameState, realTerrainProvider, imageryLayerCollection); return childTile.state === QuadtreeTileLoadState.DONE; }).then(function() { expect(childTile.data.waterMaskTexture).toBeDefined(); @@ -289,8 +290,8 @@ defineSuite([ var childTile = rootTile.children[0]; return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(rootTile, context, commandList, realTerrainProvider, imageryLayerCollection); - GlobeSurfaceTile.processStateMachine(childTile, context, commandList, alwaysFailTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(rootTile, frameState, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(childTile, frameState, alwaysFailTerrainProvider, imageryLayerCollection); return rootTile.renderable && childTile.renderable; }).then(function() { expect(childTile.data.loadedTerrain).toBeUndefined(); @@ -303,8 +304,8 @@ defineSuite([ var grandchildTile = childTile.children[0]; return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(rootTile, context, commandList, realTerrainProvider, imageryLayerCollection); - GlobeSurfaceTile.processStateMachine(childTile, context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(rootTile, frameState, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(childTile, frameState, alwaysDeferTerrainProvider, imageryLayerCollection); return rootTile.data.loadedTerrain.state >= TerrainState.RECEIVED && childTile.data.upsampledTerrain.state >= TerrainState.RECEIVED; }).then(function() { @@ -312,14 +313,14 @@ defineSuite([ childTile.data.terrainData._childTileMask = 15; return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(grandchildTile, context, commandList, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(grandchildTile, frameState, realTerrainProvider, imageryLayerCollection); return grandchildTile.state === QuadtreeTileLoadState.DONE; }).then(function() { expect(grandchildTile.data.loadedTerrain).toBeUndefined(); expect(grandchildTile.data.upsampledTerrain).toBeUndefined(); return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(childTile, context, commandList, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(childTile, frameState, realTerrainProvider, imageryLayerCollection); return childTile.state === QuadtreeTileLoadState.DONE; }).then(function() { expect(grandchildTile.state).toBe(QuadtreeTileLoadState.DONE); @@ -336,9 +337,9 @@ defineSuite([ var greatGrandchildTile = grandchildTile.children[0]; return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(rootTile, context, commandList, realTerrainProvider, imageryLayerCollection); - GlobeSurfaceTile.processStateMachine(childTile, context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); - GlobeSurfaceTile.processStateMachine(grandchildTile, context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(rootTile, frameState, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(childTile, frameState, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(grandchildTile, frameState, alwaysDeferTerrainProvider, imageryLayerCollection); return rootTile.data.loadedTerrain.state >= TerrainState.RECEIVED && childTile.data.upsampledTerrain.state >= TerrainState.RECEIVED && grandchildTile.data.upsampledTerrain.state >= TerrainState.RECEIVED; @@ -347,15 +348,15 @@ defineSuite([ grandchildTile.data.terrainData._childTileMask = 15; return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(greatGrandchildTile, context, commandList, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(greatGrandchildTile, frameState, realTerrainProvider, imageryLayerCollection); return greatGrandchildTile.state === QuadtreeTileLoadState.DONE; }).then(function() { expect(greatGrandchildTile.data.loadedTerrain).toBeUndefined(); expect(greatGrandchildTile.data.upsampledTerrain).toBeUndefined(); return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(childTile, context, commandList, realTerrainProvider, imageryLayerCollection); - GlobeSurfaceTile.processStateMachine(grandchildTile, context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(childTile, frameState, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(grandchildTile, frameState, alwaysDeferTerrainProvider, imageryLayerCollection); return childTile.state === QuadtreeTileLoadState.DONE && !defined(grandchildTile.data.upsampledTerrain); }).then(function() { @@ -371,8 +372,8 @@ defineSuite([ var childTile = rootTile.children[0]; return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(rootTile, context, commandList, realTerrainProvider, imageryLayerCollection); - GlobeSurfaceTile.processStateMachine(childTile, context, commandList, alwaysFailTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(rootTile, frameState, realTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(childTile, frameState, alwaysFailTerrainProvider, imageryLayerCollection); return rootTile.state >= QuadtreeTileLoadState.DONE && childTile.state >= QuadtreeTileLoadState.DONE; }).then(function() { @@ -407,10 +408,10 @@ defineSuite([ return pollToPromise(function() { if (rootTile.state !== QuadtreeTileLoadState.DONE) { - GlobeSurfaceTile.processStateMachine(rootTile, context, commandList, allWaterTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(rootTile, frameState, allWaterTerrainProvider, imageryLayerCollection); return false; } else { - GlobeSurfaceTile.processStateMachine(childTile, context, commandList, allWaterTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(childTile, frameState, allWaterTerrainProvider, imageryLayerCollection); return childTile.state === QuadtreeTileLoadState.DONE; } }).then(function() { @@ -445,10 +446,10 @@ defineSuite([ return pollToPromise(function() { if (rootTile.state !== QuadtreeTileLoadState.DONE) { - GlobeSurfaceTile.processStateMachine(rootTile, context, commandList, allLandTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(rootTile, frameState, allLandTerrainProvider, imageryLayerCollection); return false; } else { - GlobeSurfaceTile.processStateMachine(childTile, context, commandList, allLandTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(childTile, frameState, allLandTerrainProvider, imageryLayerCollection); return childTile.state === QuadtreeTileLoadState.DONE; } }).then(function() { @@ -466,7 +467,7 @@ defineSuite([ var imageryLayerCollection = new ImageryLayerCollection(); - GlobeSurfaceTile.processStateMachine(tile, context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(tile, frameState, alwaysDeferTerrainProvider, imageryLayerCollection); var layer = new ImageryLayer({ requestImage : function() { @@ -479,22 +480,21 @@ defineSuite([ expect(imagery.parent.state).toBe(ImageryState.UNLOADED); return pollToPromise(function() { - GlobeSurfaceTile.processStateMachine(tile, context, commandList, alwaysDeferTerrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(tile, frameState, alwaysDeferTerrainProvider, imageryLayerCollection); return imagery.parent.state !== ImageryState.UNLOADED; }); }); }, 'WebGL'); describe('pick', function() { - var context; - var commandList = []; + var frameState; beforeAll(function() { - context = createContext(); + frameState = createFrameState(createContext()); }); afterAll(function() { - context.destroyForSpecs(); + frameState.context.destroyForSpecs(); }); it('gets correct results even when the mesh includes normals', function() { @@ -517,7 +517,7 @@ defineSuite([ return false; } - GlobeSurfaceTile.processStateMachine(tile, context, commandList, terrainProvider, imageryLayerCollection); + GlobeSurfaceTile.processStateMachine(tile, frameState, terrainProvider, imageryLayerCollection); return tile.state === QuadtreeTileLoadState.DONE; }).then(function() { var ray = new Ray( diff --git a/Specs/Scene/ScreenSpaceCameraControllerSpec.js b/Specs/Scene/ScreenSpaceCameraControllerSpec.js index ba362289d95b..afdbbf35fa2e 100644 --- a/Specs/Scene/ScreenSpaceCameraControllerSpec.js +++ b/Specs/Scene/ScreenSpaceCameraControllerSpec.js @@ -55,6 +55,7 @@ defineSuite([ this.camera = camera; this.globe = undefined; this.mapProjection = new GeographicProjection(ellipsoid); + this.terrainExaggeration = 1.0; }; var MockGlobe = function(ellipsoid) { diff --git a/Specs/createFrameState.js b/Specs/createFrameState.js index 34c63dd5371a..fca649998b68 100644 --- a/Specs/createFrameState.js +++ b/Specs/createFrameState.js @@ -32,6 +32,8 @@ define([ frameState.camera = camera; frameState.cullingVolume = camera.frustum.computeCullingVolume(camera.position, camera.direction, camera.up); + frameState.terrainExaggeration = 1.0; + frameState.passes.render = true; frameState.passes.pick = false; From 3a0a049503225c63102b1e179f9da2a4c16c5dd2 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 12 Nov 2015 14:26:12 -0500 Subject: [PATCH 23/59] Add test for exaggerating quantized mesh. --- Specs/Core/QuantizedMeshTerrainDataSpec.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Specs/Core/QuantizedMeshTerrainDataSpec.js b/Specs/Core/QuantizedMeshTerrainDataSpec.js index e84055970f16..c4ce54dc6d1b 100644 --- a/Specs/Core/QuantizedMeshTerrainDataSpec.js +++ b/Specs/Core/QuantizedMeshTerrainDataSpec.js @@ -428,6 +428,17 @@ defineSuite([ }); }); + it('exaggerates mesh', function() { + return data.createMesh(tilingScheme, 0, 0, 0, 2).then(function(mesh) { + expect(mesh).toBeInstanceOf(TerrainMesh); + expect(mesh.vertices.length).toBe(12 * 6); // 4 regular vertices, 8 skirt vertices. + expect(mesh.indices.length).toBe(10 * 3); // 2 regular triangles, 8 skirt triangles. + expect(mesh.minimumHeight).toBe(data._minimumHeight); + expect(mesh.maximumHeight).toBeGreaterThan(data._maximumHeight); + expect(mesh.boundingSphere3D.radius).toBeGreaterThan(data._boundingSphere.radius); + }); + }); + it('requires 32bit indices for large meshes', function() { var tilingScheme = new GeographicTilingScheme(); var quantizedVertices = []; From 2fd7e80152250d4dd3b1705bc46d4275ea45ea52 Mon Sep 17 00:00:00 2001 From: Patrick Cozzi Date: Thu, 12 Nov 2015 19:52:21 -0500 Subject: [PATCH 24/59] Update doc --- Source/Core/HeightmapTerrainData.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/HeightmapTerrainData.js b/Source/Core/HeightmapTerrainData.js index 7afba446359c..6a6aa7150d2a 100644 --- a/Source/Core/HeightmapTerrainData.js +++ b/Source/Core/HeightmapTerrainData.js @@ -153,7 +153,7 @@ define([ * @param {Number} x The X coordinate of the tile for which to create the terrain data. * @param {Number} y The Y coordinate of the tile for which to create the terrain data. * @param {Number} level The level of the tile for which to create the terrain data. - * @param {Number} [exaggeration] The scale used to exaggerate the terrain. + * @param {Number} [exaggeration=1.0] The scale used to exaggerate the terrain. * @returns {Promise.|undefined} A promise for the terrain mesh, or undefined if too many * asynchronous mesh creations are already in progress and the operation should * be retried later. From 528dfbd951b844a4e383b7f7534210f490ebb96c Mon Sep 17 00:00:00 2001 From: Patrick Cozzi Date: Thu, 12 Nov 2015 19:55:02 -0500 Subject: [PATCH 25/59] Add reference doc --- Source/Core/HeightmapTessellator.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Core/HeightmapTessellator.js b/Source/Core/HeightmapTessellator.js index 2bd94bc9d0da..fa9458733880 100644 --- a/Source/Core/HeightmapTessellator.js +++ b/Source/Core/HeightmapTessellator.js @@ -60,6 +60,7 @@ define([ * @param {Rectangle} options.nativeRectangle An rectangle in the native coordinates of the heightmap's projection. For * a heightmap with a geographic projection, this is degrees. For the web mercator * projection, this is meters. + * @param {Number} [options.exaggeration=1.0] The scale used to exaggerate the terrain. * @param {Rectangle} [options.rectangle] The rectangle covered by the heightmap, in geodetic coordinates with north, south, east and * west properties in radians. Either rectangle or nativeRectangle must be provided. If both * are provided, they're assumed to be consistent. From 45f40fc091dd03da8e60ab9a8793c9ae4b4c7178 Mon Sep 17 00:00:00 2001 From: Patrick Cozzi Date: Thu, 12 Nov 2015 19:55:43 -0500 Subject: [PATCH 26/59] Tweak doc --- Source/Core/QuantizedMeshTerrainData.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/QuantizedMeshTerrainData.js b/Source/Core/QuantizedMeshTerrainData.js index 343b385195e8..4c9aa0f3cd9e 100644 --- a/Source/Core/QuantizedMeshTerrainData.js +++ b/Source/Core/QuantizedMeshTerrainData.js @@ -235,7 +235,7 @@ define([ * @param {Number} x The X coordinate of the tile for which to create the terrain data. * @param {Number} y The Y coordinate of the tile for which to create the terrain data. * @param {Number} level The level of the tile for which to create the terrain data. - * @param {Number} [exaggeration] The scale used to exaggerate the terrain. + * @param {Number} [exaggeration=1.0] The scale used to exaggerate the terrain. * @returns {Promise.|undefined} A promise for the terrain mesh, or undefined if too many * asynchronous mesh creations are already in progress and the operation should * be retried later. From 86b7a495687c33b3b497e0e728b9e1e7a9ae663b Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Fri, 13 Nov 2015 01:11:20 -0500 Subject: [PATCH 27/59] Fix Travis, update .jshintrc, remove a ton of junk. So it turns out that jsHint no longer works on Node 0.10.x, which is ancient anyway. So I updated Travis to use 0.12.x. I then decided to update our .jshintrc to take advantage of the latest JSHint features and that produced a TON of new (perfectly valid) errors about unused variables, empty code blocks, and unused defined globals, which I have now cleaned up. This also uncovered a bunch of other stuff that I also fixed. In summary: 1. Update travis to use Node 0.12.x 2. Update .jshintrc to take advantage of new features 3. Fix bad code pointed out by said features 4. Remove all uneeded `jasmine` globals in spec files 5. Generate a `Specs` specific .jshintrc as part of the build which enables jasmine mode in jshint 6. Move `QuadtreePrimitive` to Development Sandcastle gallery. 7. Update NPM modules to latest versions. 8. Lock NPM modules to specific versions to avoid untested updates in the future. 9. Ran `sortRequires` --- .gitignore | 1 + .jshintrc | 38 ++++++++++++----- .travis.yml | 2 +- Apps/Sandcastle/CesiumSandcastle.js | 2 +- Apps/Sandcastle/gallery/Cesium Inspector.html | 1 - .../development}/QuadtreePrimitive.html | 14 ++----- Source/Core/GeometryPipeline.js | 3 -- Source/Core/IntersectionTests.js | 1 - Source/Core/Intersections2D.js | 7 ++-- Source/Core/OrientedBoundingBox.js | 1 - Source/Core/PolygonPipeline.js | 1 - Source/Core/PolylineGeometry.js | 4 -- Source/Core/QuantizedMeshTerrainData.js | 1 - Source/Core/scaleToGeodeticSurface.js | 8 ++-- Source/DataSources/CzmlDataSource.js | 10 ----- Source/DataSources/DataSourceDisplay.js | 1 - Source/DataSources/EntityCollection.js | 1 - Source/DataSources/GeoJsonDataSource.js | 7 ---- Source/DataSources/GeometryVisualizer.js | 1 - Source/DataSources/KmlDataSource.js | 10 +---- Source/DataSources/ModelVisualizer.js | 2 - Source/DataSources/SampledProperty.js | 4 +- .../VelocityOrientationProperty.js | 2 +- Source/Renderer/UniformState.js | 41 +++++++++++-------- Source/Renderer/createUniform.js | 1 - Source/Renderer/createUniformArray.js | 1 - Source/Scene/Camera.js | 9 ---- Source/Scene/CameraFlightPath.js | 4 -- Source/Scene/EllipsoidPrimitive.js | 1 - Source/Scene/Globe.js | 3 -- Source/Scene/GlobeSurfaceTileProvider.js | 2 - Source/Scene/ImageryLayerCollection.js | 2 - Source/Scene/Model.js | 11 +---- Source/Scene/QuadtreePrimitive.js | 1 - Source/Scene/Scene.js | 4 -- Source/Scene/SceneTransforms.js | 2 - Source/Scene/ScreenSpaceCameraController.js | 1 - Source/Scene/modelMaterialsCommon.js | 14 +++---- .../Viewer/viewerPerformanceWatchdogMixin.js | 1 - .../ArcGisImageServerTerrainProviderSpec.js | 2 - Specs/Core/AssociativeArraySpec.js | 1 - Specs/Core/AttributeCompressionSpec.js | 1 - Specs/Core/AxisAlignedBoundingBoxSpec.js | 1 - Specs/Core/BingMapsApiSpec.js | 1 - Specs/Core/BoundingRectangleSpec.js | 1 - Specs/Core/BoundingSphereSpec.js | 1 - Specs/Core/BoxGeometrySpec.js | 1 - Specs/Core/BoxOutlineGeometrySpec.js | 3 +- Specs/Core/Cartesian2Spec.js | 3 +- Specs/Core/Cartesian3Spec.js | 3 +- Specs/Core/Cartesian4Spec.js | 3 +- Specs/Core/CartographicSpec.js | 1 - Specs/Core/CatmullRomSplineSpec.js | 1 - Specs/Core/CesiumTerrainProviderSpec.js | 31 -------------- Specs/Core/CircleGeometrySpec.js | 1 - Specs/Core/CircleOutlineGeometrySpec.js | 1 - Specs/Core/ClockSpec.js | 1 - .../ColorGeometryInstanceAttributeSpec.js | 1 - Specs/Core/ColorSpec.js | 1 - Specs/Core/ComponentDatatypeSpec.js | 3 +- Specs/Core/CorridorGeometrySpec.js | 1 - Specs/Core/CorridorOutlineGeometrySpec.js | 3 +- Specs/Core/CubicRealPolynomialSpec.js | 3 +- Specs/Core/CylinderGeometrySpec.js | 3 +- Specs/Core/CylinderOutlineGeometrySpec.js | 3 +- Specs/Core/DeveloperErrorSpec.js | 1 - Specs/Core/EarthOrientationParametersSpec.js | 3 +- Specs/Core/EllipseGeometrySpec.js | 1 - Specs/Core/EllipseOutlineGeometrySpec.js | 1 - Specs/Core/EllipsoidGeodesicSpec.js | 11 +---- Specs/Core/EllipsoidGeometrySpec.js | 1 - Specs/Core/EllipsoidOutlineGeometrySpec.js | 3 +- Specs/Core/EllipsoidSpec.js | 1 - Specs/Core/EllipsoidTangentPlaneSpec.js | 1 - Specs/Core/EllipsoidTerrainProviderSpec.js | 3 +- Specs/Core/EllipsoidalOccluderSpec.js | 1 - Specs/Core/EncodedCartesian3Spec.js | 1 - Specs/Core/EventSpec.js | 3 +- Specs/Core/FeatureDetectionSpec.js | 1 - Specs/Core/FullscreenSpec.js | 3 +- Specs/Core/GeographicProjectionSpec.js | 3 +- Specs/Core/GeographicTilingSchemeSpec.js | 3 +- Specs/Core/GeometryAttributeSpec.js | 1 - Specs/Core/GeometryInstanceAttributeSpec.js | 1 - Specs/Core/GeometryInstanceSpec.js | 1 - Specs/Core/GeometryPipelineSpec.js | 4 -- Specs/Core/GeometrySpec.js | 1 - Specs/Core/HeadingPitchRangeSpec.js | 3 +- Specs/Core/HeightmapTerrainDataSpec.js | 3 +- .../HermitePolynomialApproximationSpec.js | 3 +- Specs/Core/HermiteSplineSpec.js | 1 - Specs/Core/Iau2000OrientationSpec.js | 1 - Specs/Core/Iau2006XysDataSpec.js | 3 +- Specs/Core/IauOrientationAxesSpec.js | 1 - Specs/Core/IndexDatatypeSpec.js | 1 - Specs/Core/IntersectionTestsSpec.js | 1 - Specs/Core/Intersections2DSpec.js | 1 - Specs/Core/IntervalSpec.js | 3 +- Specs/Core/JulianDateSpec.js | 1 - .../LagrangePolynomialApproximationSpec.js | 3 +- Specs/Core/LeapSecondSpec.js | 1 - Specs/Core/LinearApproximationSpec.js | 3 +- Specs/Core/LinearSplineSpec.js | 1 - Specs/Core/MapboxApiSpec.js | 1 - Specs/Core/MathSpec.js | 1 - Specs/Core/Matrix2Spec.js | 1 - Specs/Core/Matrix3Spec.js | 1 - Specs/Core/Matrix4Spec.js | 4 +- Specs/Core/NearFarScalarSpec.js | 1 - Specs/Core/OccluderSpec.js | 1 - Specs/Core/OrientedBoundingBoxSpec.js | 12 ------ Specs/Core/PinBuilderSpec.js | 3 +- Specs/Core/PlaneSpec.js | 1 - Specs/Core/PolygonGeometrySpec.js | 1 - Specs/Core/PolygonOutlineGeometrySpec.js | 1 - Specs/Core/PolygonPipelineSpec.js | 3 +- Specs/Core/PolylineGeometrySpec.js | 3 +- Specs/Core/PolylinePipelineSpec.js | 1 - Specs/Core/PolylineVolumeGeometrySpec.js | 1 - .../Core/PolylineVolumeOutlineGeometrySpec.js | 3 +- Specs/Core/QuadraticRealPolynomialSpec.js | 3 +- Specs/Core/QuantizedMeshTerrainDataSpec.js | 3 +- Specs/Core/QuarticRealPolynomialSpec.js | 3 +- Specs/Core/QuaternionSpec.js | 2 - Specs/Core/QuaternionSplineSpec.js | 1 - Specs/Core/QueueSpec.js | 1 - Specs/Core/RaySpec.js | 1 - Specs/Core/RectangleGeometrySpec.js | 1 - Specs/Core/RectangleOutlineGeometrySpec.js | 1 - Specs/Core/RectangleSpec.js | 3 +- Specs/Core/RequestErrorEventSpec.js | 3 +- Specs/Core/RuntimeErrorSpec.js | 1 - Specs/Core/ScreenSpaceEventHandlerSpec.js | 1 - .../Core/ShowGeometryInstanceAttributeSpec.js | 1 - Specs/Core/Simon1994PlanetaryPositionsSpec.js | 2 - Specs/Core/SimplePolylineGeometrySpec.js | 3 +- Specs/Core/SphereGeometrySpec.js | 1 - Specs/Core/SphereOutlineGeometrySpec.js | 4 +- Specs/Core/SphericalSpec.js | 3 +- Specs/Core/SplineSpec.js | 1 - Specs/Core/TaskProcessorSpec.js | 3 +- Specs/Core/TimeIntervalCollectionSpec.js | 1 - Specs/Core/TimeIntervalSpec.js | 3 +- Specs/Core/TipsifySpec.js | 3 +- Specs/Core/TransformsSpec.js | 4 -- Specs/Core/TridiagonalSystemSolverSpec.js | 1 - Specs/Core/VRTheWorldTerrainProviderSpec.js | 3 +- Specs/Core/VertexFormatSpec.js | 1 - Specs/Core/WallGeometrySpec.js | 1 - Specs/Core/WallOutlineGeometrySpec.js | 1 - Specs/Core/WebMercatorProjectionSpec.js | 3 +- Specs/Core/WebMercatorTilingSchemeSpec.js | 3 +- Specs/Core/appendForwardSlashSpec.js | 3 +- Specs/Core/barycentricCoordinatesSpec.js | 1 - Specs/Core/binarySearchSpec.js | 3 +- Specs/Core/buildModuleUrlSpec.js | 5 +-- Specs/Core/cloneSpec.js | 3 +- Specs/Core/combineSpec.js | 5 +-- Specs/Core/createGuidSpec.js | 1 - Specs/Core/definedNotNullSpec.js | 3 +- Specs/Core/definedSpec.js | 3 +- Specs/Core/deprecationWarningSpec.js | 4 +- Specs/Core/getBaseUriSpec.js | 1 - Specs/Core/getFilenameFromUriSpec.js | 1 - Specs/Core/getStringFromTypedArraySpec.js | 3 +- Specs/Core/isCrossOriginUrlSpec.js | 3 +- Specs/Core/isLeapYearSpec.js | 3 +- Specs/Core/joinUrlsSpec.js | 1 - Specs/Core/loadArrayBufferSpec.js | 3 +- Specs/Core/loadBlobSpec.js | 3 +- Specs/Core/loadImageFromTypedArraySpec.js | 3 +- Specs/Core/loadImageSpec.js | 1 - Specs/Core/loadImageViaBlobSpec.js | 1 - Specs/Core/loadJsonSpec.js | 3 +- Specs/Core/loadJsonpSpec.js | 1 - Specs/Core/loadTextSpec.js | 4 +- Specs/Core/loadWithXhrSpec.js | 3 +- Specs/Core/loadXMLSpec.js | 3 +- Specs/Core/mergeSortSpec.js | 3 +- Specs/Core/objectToQuerySpec.js | 3 +- Specs/Core/parseResponseHeadersSpec.js | 3 +- Specs/Core/pointInsideTriangleSpec.js | 3 +- Specs/Core/queryToObjectSpec.js | 3 +- Specs/Core/requestAnimationFrameSpec.js | 1 - Specs/Core/sampleTerrainSpec.js | 1 - Specs/Core/subdivideArraySpec.js | 5 +-- Specs/Core/throttleRequestByServerSpec.js | 1 - Specs/Core/writeTextToCanvasSpec.js | 5 +-- Specs/DataSources/BillboardGraphicsSpec.js | 3 +- Specs/DataSources/BillboardVisualizerSpec.js | 1 - Specs/DataSources/BoxGeometryUpdaterSpec.js | 3 +- Specs/DataSources/BoxGraphicsSpec.js | 3 +- Specs/DataSources/CallbackPropertySpec.js | 4 +- .../CheckerboardMaterialPropertySpec.js | 3 +- .../DataSources/ColorMaterialPropertySpec.js | 3 +- .../CompositeEntityCollectionSpec.js | 1 - .../CompositeMaterialPropertySpec.js | 3 +- .../CompositePositionPropertySpec.js | 3 +- Specs/DataSources/CompositePropertySpec.js | 3 +- .../ConstantPositionPropertySpec.js | 3 +- Specs/DataSources/ConstantPropertySpec.js | 3 +- .../CorridorGeometryUpdaterSpec.js | 3 +- Specs/DataSources/CorridorGraphicsSpec.js | 3 +- Specs/DataSources/CustomDataSourceSpec.js | 3 +- .../CylinderGeometryUpdaterSpec.js | 3 +- Specs/DataSources/CylinderGraphicsSpec.js | 3 +- Specs/DataSources/CzmlDataSourceSpec.js | 5 --- Specs/DataSources/DataSourceClockSpec.js | 3 +- Specs/DataSources/DataSourceCollectionSpec.js | 1 - Specs/DataSources/DataSourceDisplaySpec.js | 2 - .../DataSources/EllipseGeometryUpdaterSpec.js | 3 +- Specs/DataSources/EllipseGraphicsSpec.js | 3 +- .../EllipsoidGeometryUpdaterSpec.js | 3 +- Specs/DataSources/EllipsoidGraphicsSpec.js | 3 +- Specs/DataSources/EntityCollectionSpec.js | 1 - Specs/DataSources/EntitySpec.js | 5 +-- Specs/DataSources/EntityViewSpec.js | 1 - Specs/DataSources/GeoJsonDataSourceSpec.js | 1 - Specs/DataSources/GeometryVisualizerSpec.js | 1 - Specs/DataSources/GridMaterialPropertySpec.js | 3 +- .../DataSources/ImageMaterialPropertySpec.js | 3 +- Specs/DataSources/KmlDataSourceSpec.js | 12 +----- Specs/DataSources/LabelGraphicsSpec.js | 3 +- Specs/DataSources/LabelVisualizerSpec.js | 3 +- Specs/DataSources/ModelGraphicsSpec.js | 3 +- Specs/DataSources/ModelVisualizerSpec.js | 1 - Specs/DataSources/PathGraphicsSpec.js | 3 +- Specs/DataSources/PathVisualizerSpec.js | 1 - Specs/DataSources/PointGraphicsSpec.js | 3 +- Specs/DataSources/PointVisualizerSpec.js | 3 +- .../DataSources/PolygonGeometryUpdaterSpec.js | 3 +- Specs/DataSources/PolygonGraphicsSpec.js | 3 +- .../PolylineArrowMaterialPropertySpec.js | 3 +- .../PolylineGeometryUpdaterSpec.js | 5 +-- .../PolylineGlowMaterialPropertySpec.js | 3 +- Specs/DataSources/PolylineGraphicsSpec.js | 3 +- .../PolylineOutlineMaterialPropertySpec.js | 3 +- .../PolylineVolumeGeometryUpdaterSpec.js | 3 +- .../DataSources/PolylineVolumeGraphicsSpec.js | 3 +- .../DataSources/PositionPropertyArraySpec.js | 3 +- Specs/DataSources/PropertyArraySpec.js | 3 +- .../RectangleGeometryUpdaterSpec.js | 3 +- Specs/DataSources/RectangleGraphicsSpec.js | 3 +- Specs/DataSources/ReferencePropertySpec.js | 3 +- Specs/DataSources/RotationSpec.js | 3 +- .../SampledPositionPropertySpec.js | 3 +- Specs/DataSources/SampledPropertySpec.js | 3 +- .../DataSources/StripeMaterialPropertySpec.js | 3 +- ...eIntervalCollectionPositionPropertySpec.js | 3 +- .../TimeIntervalCollectionPropertySpec.js | 3 +- .../VelocityOrientationPropertySpec.js | 3 +- Specs/DataSources/WallGeometryUpdaterSpec.js | 3 +- Specs/DataSources/WallGraphicsSpec.js | 3 +- .../createMaterialPropertyDescriptorSpec.js | 1 - Specs/Renderer/AutomaticUniformSpec.js | 1 - Specs/Renderer/BufferSpec.js | 3 +- Specs/Renderer/BuiltinFunctionsSpec.js | 3 +- Specs/Renderer/ClearCommandSpec.js | 3 +- Specs/Renderer/ClearSpec.js | 3 +- Specs/Renderer/ComputeCommandSpec.js | 1 - Specs/Renderer/ContextSpec.js | 1 - Specs/Renderer/CubeMapSpec.js | 1 - Specs/Renderer/DrawCommandSpec.js | 1 - Specs/Renderer/DrawSpec.js | 1 - Specs/Renderer/FramebufferSpec.js | 1 - Specs/Renderer/PassStateSpec.js | 3 +- Specs/Renderer/RenderStateSpec.js | 5 +-- Specs/Renderer/RenderbufferSpec.js | 1 - Specs/Renderer/SamplerSpec.js | 1 - Specs/Renderer/ShaderCacheSpec.js | 3 +- Specs/Renderer/ShaderProgramSpec.js | 1 - Specs/Renderer/ShaderSourceSpec.js | 5 +-- Specs/Renderer/TextureSpec.js | 1 - Specs/Renderer/UniformSpec.js | 3 +- Specs/Renderer/VertexArrayFacadeSpec.js | 3 +- Specs/Renderer/VertexArrayFactorySpec.js | 3 +- Specs/Renderer/VertexArraySpec.js | 1 - Specs/Renderer/loadCubeMapSpec.js | 3 +- Specs/Scene/AppearanceSpec.js | 1 - .../ArcGisMapServerImageryProviderSpec.js | 1 - Specs/Scene/BillboardCollectionSpec.js | 3 +- Specs/Scene/BingMapsImageryProviderSpec.js | 3 +- Specs/Scene/CameraEventAggregatorSpec.js | 3 +- Specs/Scene/CameraFlightPathSpec.js | 2 - Specs/Scene/CameraSpec.js | 2 - Specs/Scene/CreditDisplaySpec.js | 3 +- Specs/Scene/CullingVolumeSpec.js | 1 - Specs/Scene/DebugAppearanceSpec.js | 3 +- Specs/Scene/DebugModelMatrixPrimitiveSpec.js | 1 - .../DiscardMissingTileImagePolicySpec.js | 4 +- Specs/Scene/EllipsoidPrimitiveSpec.js | 1 - Specs/Scene/EllipsoidSurfaceAppearanceSpec.js | 3 +- Specs/Scene/FrameRateMonitorSpec.js | 2 +- Specs/Scene/FrustumCommandsSpec.js | 3 +- Specs/Scene/GeometryRenderingSpec.js | 1 - Specs/Scene/GlobeSpec.js | 3 +- Specs/Scene/GlobeSurfaceTileProviderSpec.js | 3 +- Specs/Scene/GlobeSurfaceTileSpec.js | 1 - Specs/Scene/GoogleEarthImageryProviderSpec.js | 3 -- Specs/Scene/GridImageryProviderSpec.js | 1 - Specs/Scene/GroundPrimitiveSpec.js | 4 +- Specs/Scene/HeadingPitchRangeSpec.js | 3 +- Specs/Scene/HeightmapTessellatorSpec.js | 1 - Specs/Scene/ImageryLayerCollectionSpec.js | 3 -- Specs/Scene/ImageryLayerSpec.js | 1 - Specs/Scene/LabelCollectionSpec.js | 5 +-- Specs/Scene/MapboxImageryProviderSpec.js | 1 - Specs/Scene/MaterialAppearanceSpec.js | 3 +- Specs/Scene/MaterialSpec.js | 1 - Specs/Scene/ModelSpec.js | 22 +++++----- Specs/Scene/MoonSpec.js | 1 - Specs/Scene/MultifrustumSpec.js | 1 - .../Scene/OpenStreetMapImageryProviderSpec.js | 1 - Specs/Scene/OrthographicFrustumSpec.js | 1 - Specs/Scene/PerInstanceColorAppearanceSpec.js | 3 +- Specs/Scene/PerspectiveFrustumSpec.js | 1 - .../Scene/PerspectiveOffCenterFrustumSpec.js | 1 - Specs/Scene/PickSpec.js | 2 - Specs/Scene/PointPrimitiveCollectionSpec.js | 1 - Specs/Scene/PolygonSpec.js | 3 +- Specs/Scene/PolylineCollectionSpec.js | 3 +- Specs/Scene/PolylineColorAppearanceSpec.js | 3 +- Specs/Scene/PolylineMaterialAppearanceSpec.js | 3 +- Specs/Scene/PrimitiveCollectionSpec.js | 1 - Specs/Scene/PrimitiveCullingSpec.js | 1 - Specs/Scene/PrimitivePipelineSpec.js | 3 +- Specs/Scene/PrimitiveSpec.js | 3 +- Specs/Scene/QuadtreePrimitiveSpec.js | 7 ++-- Specs/Scene/QuadtreeTileSpec.js | 2 - Specs/Scene/RectanglePrimitiveSpec.js | 3 +- Specs/Scene/SceneSpec.js | 1 - Specs/Scene/SceneTransformsSpec.js | 4 -- .../Scene/ScreenSpaceCameraControllerSpec.js | 1 - Specs/Scene/SingleTileImageryProviderSpec.js | 1 - Specs/Scene/SkyAtmosphereSpec.js | 3 +- Specs/Scene/SkyBoxSpec.js | 3 +- Specs/Scene/SunSpec.js | 3 +- Specs/Scene/TextureAtlasSpec.js | 3 +- .../TileCoordinatesImageryProviderSpec.js | 1 - .../TileMapServiceImageryProviderSpec.js | 9 ++-- Specs/Scene/TileReplacementQueueSpec.js | 3 +- Specs/Scene/TweenCollectionSpec.js | 13 +++--- Specs/Scene/UrlTemplateImageryProviderSpec.js | 3 +- Specs/Scene/ViewportQuadSpec.js | 1 - .../Scene/WebMapServiceImageryProviderSpec.js | 7 +--- .../WebMapTileServiceImageryProviderSpec.js | 9 ++-- .../createTangentSpaceDebugPrimitiveSpec.js | 1 - Specs/ThirdParty/knockoutSpec.js | 5 +-- Specs/ThirdParty/whenSpec.js | 5 +-- Specs/Widgets/Animation/AnimationSpec.js | 3 +- .../Animation/AnimationViewModelSpec.js | 3 +- .../BaseLayerPicker/BaseLayerPickerSpec.js | 3 +- .../BaseLayerPickerViewModelSpec.js | 6 +-- .../BaseLayerPicker/ProviderViewModelSpec.js | 3 +- .../CesiumInspector/CesiumInspectorSpec.js | 3 +- .../CesiumInspectorViewModelSpec.js | 3 +- .../Widgets/CesiumWidget/CesiumWidgetSpec.js | 1 - Specs/Widgets/ClockViewModelSpec.js | 3 +- .../FullscreenButton/FullscreenButtonSpec.js | 3 +- .../FullscreenButtonViewModelSpec.js | 3 +- Specs/Widgets/Geocoder/GeocoderSpec.js | 1 - .../Widgets/Geocoder/GeocoderViewModelSpec.js | 1 - Specs/Widgets/HomeButton/HomeButtonSpec.js | 1 - .../HomeButton/HomeButtonViewModelSpec.js | 3 +- Specs/Widgets/InfoBox/InfoBoxSpec.js | 3 +- Specs/Widgets/InfoBox/InfoBoxViewModelSpec.js | 1 - .../NavigationHelpButtonSpec.js | 3 +- .../NavigationHelpButtonViewModelSpec.js | 3 +- .../PerformanceWatchdogSpec.js | 3 +- .../PerformanceWatchdogViewModelSpec.js | 2 +- .../SceneModePicker/SceneModePickerSpec.js | 3 +- .../SceneModePickerViewModelSpec.js | 4 +- .../SelectionIndicatorSpec.js | 3 +- .../SelectionIndicatorViewModelSpec.js | 3 +- Specs/Widgets/SvgPathBindingHandlerSpec.js | 3 +- Specs/Widgets/Timeline/TimelineSpec.js | 3 +- Specs/Widgets/Viewer/ViewerSpec.js | 1 - .../Widgets/Viewer/viewerDragDropMixinSpec.js | 3 +- .../viewerPerformanceWatchdogMixinSpec.js | 3 +- Specs/Widgets/createCommandSpec.js | 3 +- Specs/createContext.js | 3 +- ...reateDynamicGeometryBoundingSphereSpecs.js | 1 - Specs/createPackableSpecs.js | 1 - Specs/equals.js | 2 +- Specs/renderFragment.js | 3 +- Specs/testDefinitionChanged.js | 3 +- Specs/testMaterialDefinitionChanged.js | 3 +- gulpfile.js | 22 +++++++--- package.json | 30 +++++++------- 389 files changed, 346 insertions(+), 838 deletions(-) rename {Specs/Sandcastle => Apps/Sandcastle/gallery/development}/QuadtreePrimitive.html (92%) diff --git a/.gitignore b/.gitignore index ebdbdcfb19c8..f3138784f47e 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ Thumbs.db /Source/Shaders/*/*.js /Source/Shaders/*/*/*.js +/Specs/.jshintrc /Specs/SpecList.js /node_modules diff --git a/.jshintrc b/.jshintrc index 41bbea9cc9b4..c1529e5ba44a 100644 --- a/.jshintrc +++ b/.jshintrc @@ -3,26 +3,26 @@ "camelcase": false, "curly": true, "eqeqeq": true, - "es3": true, "forin": true, + "freeze": true, "immed": true, - "latedef": true, + "latedef": "nofunc", "newcap": true, "noarg": true, - "noempty": false, + "noempty": true, + "nonbsp": true, "nonew": true, "plusplus": false, "quotmark": false, - "regexp": false, "undef": true, - "unused": false, + "unused": "vars", "strict": true, - "trailing": true, "asi": false, "boss": false, "debug": false, "eqnull": false, "esnext": false, + "moz": false, "evil": false, "expr": false, "funcscope": false, @@ -32,15 +32,31 @@ "laxbreak": false, "laxcomma": false, "loopfunc": false, - "moz": false, "multistr": true, + "noyield": false, + "notypeof": false, "proto": false, - "regexdash": false, "scripturl": false, - "smarttabs": false, "shadow": false, "sub": false, "supernew": false, + "validthis": false, "browser": true, - "predef": [ "JSON" ] -} \ No newline at end of file + "browserify": false, + "couch": false, + "devel": true, + "dojo": false, + "jasmine": false, + "jquery": false, + "mocha": true, + "mootools": false, + "node": false, + "nonstandard": false, + "prototypejs": false, + "qunit": false, + "rhino": false, + "shelljs": false, + "worker": false, + "wsh": false, + "yui": false +} diff --git a/.travis.yml b/.travis.yml index 2dfa93e1b8e5..27cf02d7e417 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - "0.10" + - "0.12" sudo: false script: - npm run jsHint && npm run release diff --git a/Apps/Sandcastle/CesiumSandcastle.js b/Apps/Sandcastle/CesiumSandcastle.js index eb3522f3c92e..0365a7b5b19f 100644 --- a/Apps/Sandcastle/CesiumSandcastle.js +++ b/Apps/Sandcastle/CesiumSandcastle.js @@ -1,4 +1,4 @@ -/*global require,Blob,CodeMirror,JSHINT*/ +/*global require,Blob,JSHINT*/ /*global gallery_demos*/// defined by gallery/gallery-index.js, created by build /*global sandcastleJsHintOptions*/// defined by jsHintOptions.js, created by build require({ diff --git a/Apps/Sandcastle/gallery/Cesium Inspector.html b/Apps/Sandcastle/gallery/Cesium Inspector.html index 8c0a58ed10ca..ad804d476a55 100644 --- a/Apps/Sandcastle/gallery/Cesium Inspector.html +++ b/Apps/Sandcastle/gallery/Cesium Inspector.html @@ -35,7 +35,6 @@ var scene = viewer.scene; var globe = scene.globe; globe.depthTestAgainstTerrain = true; -var ellipsoid = globe.ellipsoid; var cesiumTerrainProviderHeightmaps = new Cesium.CesiumTerrainProvider({ url : '//assets.agi.com/stk-terrain/world', diff --git a/Specs/Sandcastle/QuadtreePrimitive.html b/Apps/Sandcastle/gallery/development/QuadtreePrimitive.html similarity index 92% rename from Specs/Sandcastle/QuadtreePrimitive.html rename to Apps/Sandcastle/gallery/development/QuadtreePrimitive.html index c8eee939ef64..c0be08bd69fa 100644 --- a/Specs/Sandcastle/QuadtreePrimitive.html +++ b/Apps/Sandcastle/gallery/development/QuadtreePrimitive.html @@ -1,9 +1,3 @@ - @@ -11,20 +5,20 @@ - + Cesium Demo - +

Loading...

diff --git a/Source/Core/GeometryPipeline.js b/Source/Core/GeometryPipeline.js index bc055a91b454..ee49c5300b03 100644 --- a/Source/Core/GeometryPipeline.js +++ b/Source/Core/GeometryPipeline.js @@ -2079,7 +2079,6 @@ define([ var westGeometry = copyGeometryForSplit(geometry); var i; - var index; var length = indices.length; var westGeometryIndexMap = []; @@ -2181,7 +2180,6 @@ define([ var cartesian3Scratch6 = new Cartesian3(); var cartesian4Scratch0 = new Cartesian4(); - var cartesian4Scratch1 = new Cartesian4(); function splitLongitudePolyline(instance) { var geometry = instance.geometry; @@ -2190,7 +2188,6 @@ define([ var prevPositions = attributes.prevPosition.values; var nextPositions = attributes.nextPosition.values; var expandAndWidths = attributes.expandAndWidth.values; - var indices = geometry.indices; var texCoords = (defined(attributes.st)) ? attributes.st.values : undefined; var colors = (defined(attributes.color)) ? attributes.color.values : undefined; diff --git a/Source/Core/IntersectionTests.js b/Source/Core/IntersectionTests.js index 808799071bc5..902cd076067b 100644 --- a/Source/Core/IntersectionTests.js +++ b/Source/Core/IntersectionTests.js @@ -344,7 +344,6 @@ define([ //>>includeEnd('debug'); var ray = scratchLineSegmentRay; - var origin = Cartesian3.clone(p0, ray.origin); var direction = Cartesian3.subtract(p1, p0, ray.direction); var maxT = Cartesian3.magnitude(direction); diff --git a/Source/Core/Intersections2D.js b/Source/Core/Intersections2D.js index b5e2434dd02c..7347218bd865 100644 --- a/Source/Core/Intersections2D.js +++ b/Source/Core/Intersections2D.js @@ -202,14 +202,13 @@ define([ result.push(2); result.push(u12Ratio); } - } else if (numBehind === 3) { - // Completely behind threshold - } else { + } else if (numBehind !== 3) { // Completely in front of threshold result.push(0); result.push(1); result.push(2); } + // else Completely behind threshold return result; }; @@ -283,4 +282,4 @@ define([ }; return Intersections2D; -}); \ No newline at end of file +}); diff --git a/Source/Core/OrientedBoundingBox.js b/Source/Core/OrientedBoundingBox.js index a0394432d874..094a7087a439 100644 --- a/Source/Core/OrientedBoundingBox.js +++ b/Source/Core/OrientedBoundingBox.js @@ -470,7 +470,6 @@ define([ var scratchCorner = new Cartesian3(); var scratchToCenter = new Cartesian3(); - var scratchProj = new Cartesian3(); /** * The distances calculated by the vector from the center of the bounding box to position projected onto direction. diff --git a/Source/Core/PolygonPipeline.js b/Source/Core/PolygonPipeline.js index e3805ed4625f..21cf15abba7b 100644 --- a/Source/Core/PolygonPipeline.js +++ b/Source/Core/PolygonPipeline.js @@ -547,7 +547,6 @@ define([ * * @private */ - var intersectionScratch = new Cartesian2(); var aDirectionScratch = new Cartesian2(); var bDirectionScratch = new Cartesian2(); diff --git a/Source/Core/PolylineGeometry.js b/Source/Core/PolylineGeometry.js index e480c7c30129..e1e1c62430a3 100644 --- a/Source/Core/PolylineGeometry.js +++ b/Source/Core/PolylineGeometry.js @@ -371,10 +371,6 @@ define([ var expandAndWidthIndex = 0; var stIndex = 0; var colorIndex = 0; - - var segmentLength; - var segmentIndex = 0; - var count = 0; var position; for (j = 0; j < positionsLength; ++j) { diff --git a/Source/Core/QuantizedMeshTerrainData.js b/Source/Core/QuantizedMeshTerrainData.js index 33260e797059..ca9c9f761a59 100644 --- a/Source/Core/QuantizedMeshTerrainData.js +++ b/Source/Core/QuantizedMeshTerrainData.js @@ -175,7 +175,6 @@ define([ return uValues[a] - uValues[b]; } - var requires32BitIndices = vertexCount > 64 * 1024; this._westIndices = sortIndicesIfNecessary(options.westIndices, sortByV, vertexCount); this._southIndices = sortIndicesIfNecessary(options.southIndices, sortByU, vertexCount); this._eastIndices = sortIndicesIfNecessary(options.eastIndices, sortByV, vertexCount); diff --git a/Source/Core/scaleToGeodeticSurface.js b/Source/Core/scaleToGeodeticSurface.js index e3328df8088f..52cbfc958d5d 100644 --- a/Source/Core/scaleToGeodeticSurface.js +++ b/Source/Core/scaleToGeodeticSurface.js @@ -1,14 +1,14 @@ /*global define*/ define([ './Cartesian3', - './Math', './defined', - './DeveloperError' + './DeveloperError', + './Math' ], function( Cartesian3, - CesiumMath, defined, - DeveloperError) { + DeveloperError, + CesiumMath) { "use strict"; var scaleToGeodeticSurfaceIntersection = new Cartesian3(); diff --git a/Source/DataSources/CzmlDataSource.js b/Source/DataSources/CzmlDataSource.js index 43cfb2ab268c..953ff46ab0be 100644 --- a/Source/DataSources/CzmlDataSource.js +++ b/Source/DataSources/CzmlDataSource.js @@ -180,16 +180,6 @@ define([ return rgbaf; } - function unwrapImageInterval(czmlInterval, sourceUri) { - var result = defaultValue(czmlInterval.image, czmlInterval); - if (defined(sourceUri)) { - var baseUri = new Uri(document.location.href); - sourceUri = new Uri(sourceUri); - result = new Uri(result).resolve(sourceUri.resolve(baseUri)).toString(); - } - return result; - } - function unwrapUriInterval(czmlInterval, sourceUri) { var result = defaultValue(czmlInterval.uri, czmlInterval); if (defined(sourceUri)) { diff --git a/Source/DataSources/DataSourceDisplay.js b/Source/DataSources/DataSourceDisplay.js index 2e309c54f730..a4991eeb8850 100644 --- a/Source/DataSources/DataSourceDisplay.js +++ b/Source/DataSources/DataSourceDisplay.js @@ -300,7 +300,6 @@ define([ var tmp = getBoundingSphereBoundingSphereScratch; var count = 0; - var resultState; var state = BoundingSphereState.DONE; var visualizers = dataSource._visualizers; var visualizersLength = visualizers.length; diff --git a/Source/DataSources/EntityCollection.js b/Source/DataSources/EntityCollection.js index a6fe50197841..837617d0a729 100644 --- a/Source/DataSources/EntityCollection.js +++ b/Source/DataSources/EntityCollection.js @@ -219,7 +219,6 @@ define([ entity.entityCollection = this; entities.set(id, entity); - var removedEntities = this._removedEntities; if (!this._removedEntities.remove(id)) { this._addedEntities.set(id, entity); } diff --git a/Source/DataSources/GeoJsonDataSource.js b/Source/DataSources/GeoJsonDataSource.js index 91aff895f8a8..b0c7e664fdb4 100644 --- a/Source/DataSources/GeoJsonDataSource.js +++ b/Source/DataSources/GeoJsonDataSource.js @@ -87,8 +87,6 @@ define([ 'marker-size', 'marker-symbol', 'marker-color', 'stroke', // 'stroke-opacity', 'stroke-width', 'fill', 'fill-opacity']; - var stringifyScratch = new Array(4); - function defaultDescribe(properties, nameProperty) { var html = ''; for ( var key in properties) { @@ -267,11 +265,6 @@ define([ } } - stringifyScratch[0] = symbol; - stringifyScratch[1] = color; - stringifyScratch[2] = size; - var id = JSON.stringify(stringifyScratch); - var canvasOrPromise; if (defined(symbol)) { if (symbol.length === 1) { diff --git a/Source/DataSources/GeometryVisualizer.js b/Source/DataSources/GeometryVisualizer.js index bd64c9933aba..a3235c15d708 100644 --- a/Source/DataSources/GeometryVisualizer.js +++ b/Source/DataSources/GeometryVisualizer.js @@ -259,7 +259,6 @@ define([ var tmp = getBoundingSphereBoundingSphereScratch; var count = 0; - var resultState; var state = BoundingSphereState.DONE; var batches = this._batches; var batchesLength = batches.length; diff --git a/Source/DataSources/KmlDataSource.js b/Source/DataSources/KmlDataSource.js index de82f19a7fea..39c668c9cf17 100644 --- a/Source/DataSources/KmlDataSource.js +++ b/Source/DataSources/KmlDataSource.js @@ -656,7 +656,6 @@ define([ function applyStyle(dataSource, styleNode, targetEntity, sourceUri, uriResolver) { for (var i = 0, len = styleNode.childNodes.length; i < len; i++) { var node = styleNode.childNodes.item(i); - var material; if (node.localName === 'IconStyle') { processBillboardIcon(dataSource, node, targetEntity, sourceUri, uriResolver); } else if (node.localName === 'LabelStyle') { @@ -1094,7 +1093,6 @@ define([ var trackNodes = queryChildNodes(geometryNode, 'Track', namespaces.gx); var times; - var data; var lastStop; var lastStopPosition; var needDropLine = false; @@ -1398,7 +1396,6 @@ define([ function processGroundOverlay(dataSource, parent, groundOverlay, entityCollection, styleCollection, sourceUri, uriResolver) { var r = processFeature(dataSource, parent, groundOverlay, entityCollection, styleCollection, sourceUri, uriResolver); var entity = r.entity; - var styleEntity = r.stylEntity; var geometry; var isLatLonQuad = false; @@ -1441,7 +1438,6 @@ define([ } } - var material; var iconNode = queryFirstNode(groundOverlay, 'Icon', namespaces.kml); var href = queryStringValue(iconNode, 'href', namespaces.kml); if (defined(href)) { @@ -1455,16 +1451,14 @@ define([ var altitudeMode = queryStringValue(groundOverlay, 'altitudeMode', namespaces.kml); - var altitude; if (defined(altitudeMode)) { if (altitudeMode === 'absolute') { //Use height above ellipsoid until we support MSL. geometry.height = queryNumericValue(groundOverlay, 'altitude', namespaces.kml); - } else if (altitudeMode === 'clampToGround') { - //Just use the default of 0 until we support terrain - } else { + } else if (altitudeMode !== 'clampToGround'){ window.console.log('KML - Unknown altitudeMode: ' + altitudeMode); } + // else just use the default of 0 until we support 'clampToGround' } else { altitudeMode = queryStringValue(groundOverlay, 'altitudeMode', namespaces.gx); if (altitudeMode === 'relativeToSeaFloor') { diff --git a/Source/DataSources/ModelVisualizer.js b/Source/DataSources/ModelVisualizer.js index f2824c89b2da..0ad6c5eaeea8 100644 --- a/Source/DataSources/ModelVisualizer.js +++ b/Source/DataSources/ModelVisualizer.js @@ -72,11 +72,9 @@ define([ } //>>includeEnd('debug'); - var context = this._scene.context; var entities = this._entitiesToVisualize.values; var modelHash = this._modelHash; var primitives = this._primitives; - var scene = this._scene; for (var i = 0, len = entities.length; i < len; i++) { var entity = entities[i]; diff --git a/Source/DataSources/SampledProperty.js b/Source/DataSources/SampledProperty.js index aa23d344768f..2d538eb19241 100644 --- a/Source/DataSources/SampledProperty.js +++ b/Source/DataSources/SampledProperty.js @@ -440,9 +440,7 @@ define([ var lastIndex = timesLength - 1; var pointsInCollection = lastIndex - firstIndex + 1; - if (pointsInCollection < degree + 1) { - // Use the entire range. - } else { + if (pointsInCollection >= degree + 1) { var computedFirstIndex = index - ((degree / 2) | 0) - 1; if (computedFirstIndex < firstIndex) { computedFirstIndex = firstIndex; diff --git a/Source/DataSources/VelocityOrientationProperty.js b/Source/DataSources/VelocityOrientationProperty.js index 7ff29915de38..ba41885cd841 100644 --- a/Source/DataSources/VelocityOrientationProperty.js +++ b/Source/DataSources/VelocityOrientationProperty.js @@ -181,7 +181,7 @@ define([ var velocity = Cartesian3.subtract(position2, position1, velocityScratch); Cartesian3.normalize(velocity, velocity); - var rotation = Transforms.rotationMatrixFromPositionVelocity(position1, velocity, this._ellipsoid, rotationScratch); + Transforms.rotationMatrixFromPositionVelocity(position1, velocity, this._ellipsoid, rotationScratch); return Quaternion.fromRotationMatrix(rotationScratch, result); }; diff --git a/Source/Renderer/UniformState.js b/Source/Renderer/UniformState.js index 49523552309d..6a68785ff32b 100644 --- a/Source/Renderer/UniformState.js +++ b/Source/Renderer/UniformState.js @@ -295,15 +295,7 @@ define([ */ view3D : { get : function() { - if (this._view3DDirty) { - if (this._mode === SceneMode.SCENE3D) { - Matrix4.clone(this._view, this._view3D); - } else { - view2Dto3D(this._cameraPosition, this._cameraDirection, this._cameraRight, this._cameraUp, this._frustum2DWidth, this._mode, this._mapProjection, this._view3D); - } - Matrix4.getRotation(this._view3D, this._viewRotation3D); - this._view3DDirty = false; - } + updateView3D(this); return this._view3D; } }, @@ -315,6 +307,7 @@ define([ */ viewRotation : { get : function() { + updateView3D(this); return this._viewRotation; } }, @@ -325,7 +318,7 @@ define([ */ viewRotation3D : { get : function() { - var view3D = this.view3D; + updateView3D(this); return this._viewRotation3D; } }, @@ -349,11 +342,7 @@ define([ */ inverseView3D : { get : function() { - if (this._inverseView3DDirty) { - Matrix4.inverseTransformation(this.view3D, this._inverseView3D); - Matrix4.getRotation(this._inverseView3D, this._inverseViewRotation3D); - this._inverseView3DDirty = false; - } + updateInverseView3D(this); return this._inverseView3D; } }, @@ -375,7 +364,7 @@ define([ */ inverseViewRotation3D : { get : function() { - var inverseView = this.inverseView3D; + updateInverseView3D(this); return this._inverseViewRotation3D; } }, @@ -1186,5 +1175,25 @@ define([ return result; } + function updateView3D(that) { + if (that._view3DDirty) { + if (that._mode === SceneMode.SCENE3D) { + Matrix4.clone(that._view, that._view3D); + } else { + view2Dto3D(that._cameraPosition, that._cameraDirection, that._cameraRight, that._cameraUp, that._frustum2DWidth, that._mode, that._mapProjection, that._view3D); + } + Matrix4.getRotation(that._view3D, that._viewRotation3D); + that._view3DDirty = false; + } + } + + function updateInverseView3D(that){ + if (that._inverseView3DDirty) { + Matrix4.inverseTransformation(that.view3D, that._inverseView3D); + Matrix4.getRotation(that._inverseView3D, that._inverseViewRotation3D); + that._inverseView3DDirty = false; + } + } + return UniformState; }); diff --git a/Source/Renderer/createUniform.js b/Source/Renderer/createUniform.js index b785e31d7384..ee4fa848f76e 100644 --- a/Source/Renderer/createUniform.js +++ b/Source/Renderer/createUniform.js @@ -22,7 +22,6 @@ define([ Matrix4, RuntimeError) { "use strict"; - /*global console*/ /** * @private diff --git a/Source/Renderer/createUniformArray.js b/Source/Renderer/createUniformArray.js index b8d4aefeebf1..7d72bac8b779 100644 --- a/Source/Renderer/createUniformArray.js +++ b/Source/Renderer/createUniformArray.js @@ -24,7 +24,6 @@ define([ Matrix4, RuntimeError) { "use strict"; - /*global console*/ /** * @private diff --git a/Source/Scene/Camera.js b/Source/Scene/Camera.js index 5af3b4ee911f..77791a9285c9 100644 --- a/Source/Scene/Camera.js +++ b/Source/Scene/Camera.js @@ -694,7 +694,6 @@ define([ heading : { get : function () { if (this._mode !== SceneMode.MORPHING) { - var origin = this.positionWC; var ellipsoid = this._projection.ellipsoid; var oldTransform = Matrix4.clone(this._transform, scratchHPRMatrix1); @@ -722,7 +721,6 @@ define([ pitch : { get : function() { if (this._mode !== SceneMode.MORPHING) { - var origin = this.positionWC; var ellipsoid = this._projection.ellipsoid; var oldTransform = Matrix4.clone(this._transform, scratchHPRMatrix1); @@ -750,7 +748,6 @@ define([ roll : { get : function() { if (this._mode !== SceneMode.MORPHING) { - var origin = this.positionWC; var ellipsoid = this._projection.ellipsoid; var oldTransform = Matrix4.clone(this._transform, scratchHPRMatrix1); @@ -1663,7 +1660,6 @@ define([ }; var scratchLookAtMatrix4 = new Matrix4(); - var scratchLookAtTransformMatrix4 = new Matrix4(); /** * Sets the camera position and orientation using a target and offset. The target must be given in @@ -2429,11 +2425,6 @@ define([ var scratchFlyToDestination = new Cartesian3(); - var scratchFlyToQuaternion = new Quaternion(); - var scratchFlyToMatrix3 = new Matrix3(); - var scratchFlyToDirection = new Cartesian3(); - var scratchFlyToUp = new Cartesian3(); - var scratchFlyToMatrix4 = new Matrix4(); var newOptions = { destination : undefined, heading : undefined, diff --git a/Source/Scene/CameraFlightPath.js b/Source/Scene/CameraFlightPath.js index 82928c4aa720..23539cd0bccb 100644 --- a/Source/Scene/CameraFlightPath.js +++ b/Source/Scene/CameraFlightPath.js @@ -141,7 +141,6 @@ define([ var scratchStartCart = new Cartographic(); var scratchEndCart = new Cartographic(); - var scratchCurrentPositionCart = new Cartesian3(); function createUpdate3D(scene, duration, destination, heading, pitch, roll, optionAltitude) { var camera = scene.camera; @@ -227,9 +226,6 @@ define([ return update; } - var dirScratch = new Cartesian3(); - var rightScratch = new Cartesian3(); - var upScratch = new Cartesian3(); var scratchCartographic = new Cartographic(); var scratchDestination = new Cartesian3(); diff --git a/Source/Scene/EllipsoidPrimitive.js b/Source/Scene/EllipsoidPrimitive.js index 7bb3ad9ff2ba..b62da8300a68 100644 --- a/Source/Scene/EllipsoidPrimitive.js +++ b/Source/Scene/EllipsoidPrimitive.js @@ -343,7 +343,6 @@ define([ this._onlySunLighting = this.onlySunLighting; var colorCommand = this._colorCommand; - var vs; var fs; // Recompile shader when material, lighting, or translucency changes diff --git a/Source/Scene/Globe.js b/Source/Scene/Globe.js index 64f251d393ca..13c0a4b50cdf 100644 --- a/Source/Scene/Globe.js +++ b/Source/Scene/Globe.js @@ -699,11 +699,8 @@ define([ } var mode = frameState.mode; - var projection = frameState.mapProjection; - var modeChanged = false; if (this._mode !== mode || !defined(this._rsColor)) { - modeChanged = true; if (mode === SceneMode.SCENE3D || mode === SceneMode.COLUMBUS_VIEW) { this._rsColor = RenderState.fromCache({ // Write color and depth cull : { diff --git a/Source/Scene/GlobeSurfaceTileProvider.js b/Source/Scene/GlobeSurfaceTileProvider.js index 9ac7a7101dd4..727fb31e5e05 100644 --- a/Source/Scene/GlobeSurfaceTileProvider.js +++ b/Source/Scene/GlobeSurfaceTileProvider.js @@ -395,7 +395,6 @@ define([ var drawCommands = this._drawCommands; // Add the tile pick commands from the tiles drawn last frame. - var tilesToRenderByTextureCount = this._tilesToRenderByTextureCount; for (var i = 0, length = this._usedDrawCommands; i < length; ++i) { addPickCommandsForTile(this, drawCommands[i], frameState); } @@ -485,7 +484,6 @@ define([ return intersection; }; - var float32ArrayScratch = FeatureDetection.supportsTypedArrays() ? new Float32Array(1) : undefined; var modifiedModelViewScratch = new Matrix4(); var tileRectangleScratch = new Cartesian4(); var rtcScratch = new Cartesian3(); diff --git a/Source/Scene/ImageryLayerCollection.js b/Source/Scene/ImageryLayerCollection.js index f9bc588d9c22..b7d7de69137d 100644 --- a/Source/Scene/ImageryLayerCollection.js +++ b/Source/Scene/ImageryLayerCollection.js @@ -374,7 +374,6 @@ define([ // Find the terrain tile containing the picked location. var tilesToRender = scene.globe._surface._tilesToRender; - var length = tilesToRender.length; var pickedTile; for (var textureIndex = 0; !defined(pickedTile) && textureIndex < tilesToRender.length; ++textureIndex) { @@ -389,7 +388,6 @@ define([ } // Pick against all attached imagery tiles containing the pickedLocation. - var tileExtent = pickedTile.rectangle; var imageryTiles = pickedTile.data.imagery; var promises = []; diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 9a2b7c351b40..b70def441e72 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -48,8 +48,8 @@ define([ './getModelAccessor', './ModelAnimationCache', './ModelAnimationCollection', - './modelMaterialsCommon', './ModelMaterial', + './modelMaterialsCommon', './ModelMesh', './ModelNode', './Pass', @@ -103,8 +103,8 @@ define([ getModelAccessor, ModelAnimationCache, ModelAnimationCollection, - modelMaterialsCommon, ModelMaterial, + modelMaterialsCommon, ModelMesh, ModelNode, Pass, @@ -1050,7 +1050,6 @@ define([ var aMaxScratch = new Cartesian3(); function computeBoundingSphere(gltf) { - var version = gltf.asset.version; var gltfNodes = gltf.nodes; var gltfMeshes = gltf.meshes; var gltfAccessors = gltf.accessors; @@ -1684,7 +1683,6 @@ define([ function getAttributeLocations(model, primitive) { var gltf = model.gltf; - var programs = gltf.programs; var techniques = gltf.techniques; var materials = gltf.materials; @@ -2424,7 +2422,6 @@ define([ var gltf = model.gltf; var materials = gltf.materials; var techniques = gltf.techniques; - var programs = gltf.programs; var uniformMaps = model._uniformMaps; for (var materialId in materials) { @@ -2505,8 +2502,6 @@ define([ var allowPicking = model.allowPicking; var runtimeMeshesByName = model._runtime.meshesByName; - var debugShowBoundingVolume = model.debugShowBoundingVolume; - var resources = model._rendererResources; var rendererVertexArrays = resources.vertexArrays; var rendererPrograms = resources.programs; @@ -2669,7 +2664,6 @@ define([ var runtimeNodes = model._runtime.nodes; var gltf = model.gltf; - var version = gltf.asset.version; var nodes = gltf.nodes; var scene = gltf.scenes[gltf.scene]; @@ -2677,7 +2671,6 @@ define([ var length = sceneNodes.length; var stack = []; - var axis = new Cartesian3(); for (var i = 0; i < length; ++i) { stack.push({ diff --git a/Source/Scene/QuadtreePrimitive.js b/Source/Scene/QuadtreePrimitive.js index 42329dd914f4..8298f25f81df 100644 --- a/Source/Scene/QuadtreePrimitive.js +++ b/Source/Scene/QuadtreePrimitive.js @@ -309,7 +309,6 @@ define([ } var i; - var j; var len; // Clear the render list. diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 5d929beecf59..24a26f7c2c93 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -1793,14 +1793,12 @@ define([ * @private */ Scene.prototype.clampLineWidth = function(width) { - var context = this._context; return Math.max(ContextLimits.minimumAliasedLineWidth, Math.min(width, ContextLimits.maximumAliasedLineWidth)); }; var orthoPickingFrustum = new OrthographicFrustum(); var scratchOrigin = new Cartesian3(); var scratchDirection = new Cartesian3(); - var scratchBufferDimensions = new Cartesian2(); var scratchPixelSize = new Cartesian2(); var scratchPickVolumeMatrix4 = new Matrix4(); @@ -1938,8 +1936,6 @@ define([ return object; }; - var scratchPickDepthPosition = new Cartesian3(); - var scratchMinDistPos = new Cartesian3(); var scratchPackedDepth = new Cartesian4(); var packedDepthScale = new Cartesian4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0); diff --git a/Source/Scene/SceneTransforms.js b/Source/Scene/SceneTransforms.js index 59f8b1905535..ed03443d1283 100644 --- a/Source/Scene/SceneTransforms.js +++ b/Source/Scene/SceneTransforms.js @@ -236,8 +236,6 @@ define([ var uniformState = context.uniformState; var viewport = uniformState.viewport; - var viewportTransformation = uniformState.viewportTransformation; - var ndc = Cartesian4.clone(Cartesian4.UNIT_W, scratchNDC); ndc.x = (drawingBufferPosition.x - viewport.x) / viewport.width * 2.0 - 1.0; ndc.y = (drawingBufferPosition.y - viewport.y) / viewport.height * 2.0 - 1.0; diff --git a/Source/Scene/ScreenSpaceCameraController.js b/Source/Scene/ScreenSpaceCameraController.js index 7d6e725eeb1f..f40fd67e1eec 100644 --- a/Source/Scene/ScreenSpaceCameraController.js +++ b/Source/Scene/ScreenSpaceCameraController.js @@ -1157,7 +1157,6 @@ define([ } var spin3DPick = new Cartesian3(); - var scratchStartRay = new Ray(); var scratchCartographic = new Cartographic(); var scratchMousePos = new Cartesian3(); var scratchRadii = new Cartesian3(); diff --git a/Source/Scene/modelMaterialsCommon.js b/Source/Scene/modelMaterialsCommon.js index 085225c99ad4..d9b99a5ae729 100644 --- a/Source/Scene/modelMaterialsCommon.js +++ b/Source/Scene/modelMaterialsCommon.js @@ -1,12 +1,12 @@ /*global define*/ define([ - '../Core/defaultValue', - '../Core/defined', - '../Renderer/WebGLConstants' -], function( - defaultValue, - defined, - WebGLConstants) { + '../Core/defaultValue', + '../Core/defined', + '../Renderer/WebGLConstants' + ], function( + defaultValue, + defined, + WebGLConstants) { "use strict"; function webGLConstantToGlslType(webGLValue) { diff --git a/Source/Widgets/Viewer/viewerPerformanceWatchdogMixin.js b/Source/Widgets/Viewer/viewerPerformanceWatchdogMixin.js index 724d173ea2cc..b35e2a5d0af6 100644 --- a/Source/Widgets/Viewer/viewerPerformanceWatchdogMixin.js +++ b/Source/Widgets/Viewer/viewerPerformanceWatchdogMixin.js @@ -12,7 +12,6 @@ define([ DeveloperError, PerformanceWatchdog) { "use strict"; - /*global console*/ /** * A mixin which adds the {@link PerformanceWatchdog} widget to the {@link Viewer} widget. diff --git a/Specs/Core/ArcGisImageServerTerrainProviderSpec.js b/Specs/Core/ArcGisImageServerTerrainProviderSpec.js index ccb770052b0e..aca3a818a051 100644 --- a/Specs/Core/ArcGisImageServerTerrainProviderSpec.js +++ b/Specs/Core/ArcGisImageServerTerrainProviderSpec.js @@ -24,7 +24,6 @@ defineSuite([ Uri, when) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ afterEach(function() { loadImage.createImage = loadImage.defaultCreateImage; @@ -187,7 +186,6 @@ defineSuite([ spyOn(loadImage, 'createImage').and.callFake(function(url, crossOrigin, deferred) { var uri = new Uri(url); - var params = queryToObject(uri.query); expect(uri.path).toEqual('/proxy/'); diff --git a/Specs/Core/AssociativeArraySpec.js b/Specs/Core/AssociativeArraySpec.js index aed73375df88..96cd239281b6 100644 --- a/Specs/Core/AssociativeArraySpec.js +++ b/Specs/Core/AssociativeArraySpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( AssociativeArray) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor has expected default values', function() { var associativeArray = new AssociativeArray(); diff --git a/Specs/Core/AttributeCompressionSpec.js b/Specs/Core/AttributeCompressionSpec.js index 020da752e6b9..fa5cb4955887 100644 --- a/Specs/Core/AttributeCompressionSpec.js +++ b/Specs/Core/AttributeCompressionSpec.js @@ -10,7 +10,6 @@ defineSuite([ Cartesian3, CesiumMath) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var negativeUnitZ = new Cartesian3(0.0, 0.0, -1.0); it('oct decode(0, 0)', function() { diff --git a/Specs/Core/AxisAlignedBoundingBoxSpec.js b/Specs/Core/AxisAlignedBoundingBoxSpec.js index 9a3f95de98a7..931f7f624100 100644 --- a/Specs/Core/AxisAlignedBoundingBoxSpec.js +++ b/Specs/Core/AxisAlignedBoundingBoxSpec.js @@ -12,7 +12,6 @@ defineSuite([ Intersect, Plane) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var positions = [ new Cartesian3(3, -1, -3), diff --git a/Specs/Core/BingMapsApiSpec.js b/Specs/Core/BingMapsApiSpec.js index 4b1426c5db82..423b42829382 100644 --- a/Specs/Core/BingMapsApiSpec.js +++ b/Specs/Core/BingMapsApiSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( BingMapsApi) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('getKey returns provided key if one is provided', function() { expect(BingMapsApi.getKey('foo')).toEqual('foo'); diff --git a/Specs/Core/BoundingRectangleSpec.js b/Specs/Core/BoundingRectangleSpec.js index f2dce62e2444..b2793bb2226d 100644 --- a/Specs/Core/BoundingRectangleSpec.js +++ b/Specs/Core/BoundingRectangleSpec.js @@ -14,7 +14,6 @@ defineSuite([ Intersect, Rectangle) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('default constructor sets expected values', function() { var rectangle = new BoundingRectangle(); diff --git a/Specs/Core/BoundingSphereSpec.js b/Specs/Core/BoundingSphereSpec.js index 105d59680a89..373e60f2cb4b 100644 --- a/Specs/Core/BoundingSphereSpec.js +++ b/Specs/Core/BoundingSphereSpec.js @@ -30,7 +30,6 @@ defineSuite([ Rectangle, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var positionsRadius = 1.0; var positionsCenter = new Cartesian3(10000001.0, 0.0, 0.0); diff --git a/Specs/Core/BoxGeometrySpec.js b/Specs/Core/BoxGeometrySpec.js index f73bd0abd031..2a11b689dbc6 100644 --- a/Specs/Core/BoxGeometrySpec.js +++ b/Specs/Core/BoxGeometrySpec.js @@ -12,7 +12,6 @@ defineSuite([ VertexFormat, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor throws without minimum corner', function() { expect(function() { diff --git a/Specs/Core/BoxOutlineGeometrySpec.js b/Specs/Core/BoxOutlineGeometrySpec.js index d8a77ec2b2ad..6c0810db1056 100644 --- a/Specs/Core/BoxOutlineGeometrySpec.js +++ b/Specs/Core/BoxOutlineGeometrySpec.js @@ -10,7 +10,6 @@ defineSuite([ Cartesian3, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor throws without minimum corner', function() { expect(function() { @@ -79,4 +78,4 @@ defineSuite([ minimumCorner : new Cartesian3(1.0, 2.0, 3.0), maximumCorner : new Cartesian3(4.0, 5.0, 6.0) }), [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]); -}); \ No newline at end of file +}); diff --git a/Specs/Core/Cartesian2Spec.js b/Specs/Core/Cartesian2Spec.js index b326d25c119b..33fa962ec989 100644 --- a/Specs/Core/Cartesian2Spec.js +++ b/Specs/Core/Cartesian2Spec.js @@ -8,7 +8,6 @@ defineSuite([ CesiumMath, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('construct with default values', function() { var cartesian = new Cartesian2(); @@ -803,4 +802,4 @@ defineSuite([ }); createPackableSpecs(Cartesian2, new Cartesian2(1, 2), [1, 2]); -}); \ No newline at end of file +}); diff --git a/Specs/Core/Cartesian3Spec.js b/Specs/Core/Cartesian3Spec.js index b45cd37a32cf..366358c24bed 100644 --- a/Specs/Core/Cartesian3Spec.js +++ b/Specs/Core/Cartesian3Spec.js @@ -12,7 +12,6 @@ defineSuite([ CesiumMath, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('construct with default values', function() { var cartesian = new Cartesian3(); @@ -1168,4 +1167,4 @@ defineSuite([ }); createPackableSpecs(Cartesian3, new Cartesian3(1, 2, 3), [1, 2, 3]); -}); \ No newline at end of file +}); diff --git a/Specs/Core/Cartesian4Spec.js b/Specs/Core/Cartesian4Spec.js index 158db7d8e8a0..2c93b4000c1c 100644 --- a/Specs/Core/Cartesian4Spec.js +++ b/Specs/Core/Cartesian4Spec.js @@ -10,7 +10,6 @@ defineSuite([ CesiumMath, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('construct with default values', function() { var cartesian = new Cartesian4(); @@ -902,4 +901,4 @@ defineSuite([ }); createPackableSpecs(Cartesian4, new Cartesian4(1, 2, 3, 4), [1, 2, 3, 4]); -}); \ No newline at end of file +}); diff --git a/Specs/Core/CartographicSpec.js b/Specs/Core/CartographicSpec.js index e5ba19434dde..0db64f4fe085 100644 --- a/Specs/Core/CartographicSpec.js +++ b/Specs/Core/CartographicSpec.js @@ -10,7 +10,6 @@ defineSuite([ Ellipsoid, CesiumMath) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var surfaceCartesian = new Cartesian3(4094327.7921465295, 1909216.4044747739, 4487348.4088659193); var surfaceCartographic = new Cartographic(CesiumMath.toRadians(25.0), CesiumMath.toRadians(45.0), 0.0); diff --git a/Specs/Core/CatmullRomSplineSpec.js b/Specs/Core/CatmullRomSplineSpec.js index ea78d08f5a85..fd5d49562692 100644 --- a/Specs/Core/CatmullRomSplineSpec.js +++ b/Specs/Core/CatmullRomSplineSpec.js @@ -10,7 +10,6 @@ defineSuite([ HermiteSpline, CesiumMath) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var points; var times; diff --git a/Specs/Core/CesiumTerrainProviderSpec.js b/Specs/Core/CesiumTerrainProviderSpec.js index 3cc9336accb3..3fc52881524c 100644 --- a/Specs/Core/CesiumTerrainProviderSpec.js +++ b/Specs/Core/CesiumTerrainProviderSpec.js @@ -28,7 +28,6 @@ defineSuite([ Uri, when) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ afterEach(function() { loadWithXhr.load = loadWithXhr.defaultLoad; @@ -53,14 +52,6 @@ defineSuite([ return returnTileJson('Data/CesiumTerrainTileJson/QuantizedMesh.tile.json'); } - function returnQuantizedMesh20TileJson() { - return returnTileJson('Data/CesiumTerrainTileJson/QuantizedMesh2.0.tile.json'); - } - - function returnQuantizedMesh11TileJson() { - return returnTileJson('Data/CesiumTerrainTileJson/QuantizedMesh1.1.tile.json'); - } - function returnVertexNormalTileJson() { return returnTileJson('Data/CesiumTerrainTileJson/VertexNormals.tile.json'); } @@ -442,8 +433,6 @@ defineSuite([ }); it('provides HeightmapTerrainData', function() { - var baseUrl = 'made/up/url'; - loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) { // Just return any old file, as long as its big enough loadWithXhr.defaultLoad('Data/EarthOrientationParameters/IcrfToFixedStkComponentsRotationData.json', responseType, method, data, headers, deferred); @@ -457,8 +446,6 @@ defineSuite([ }); it('provides QuantizedMeshTerrainData', function() { - var baseUrl = 'made/up/url'; - loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) { loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.terrain', responseType, method, data, headers, deferred); }; @@ -471,8 +458,6 @@ defineSuite([ }); it('provides QuantizedMeshTerrainData with 32bit indices', function() { - var baseUrl = 'made/up/url'; - loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) { loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.32bitIndices.terrain', responseType, method, data, headers, deferred); }; @@ -486,8 +471,6 @@ defineSuite([ }); it('provides QuantizedMeshTerrainData with VertexNormals', function() { - var baseUrl = 'made/up/url'; - loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) { loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.vertexnormals.terrain', responseType, method, data, headers, deferred); }; @@ -501,8 +484,6 @@ defineSuite([ }); it('provides QuantizedMeshTerrainData with WaterMask', function() { - var baseUrl = 'made/up/url'; - loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) { loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.watermask.terrain', responseType, method, data, headers, deferred); }; @@ -516,8 +497,6 @@ defineSuite([ }); it('provides QuantizedMeshTerrainData with VertexNormals and WaterMask', function() { - var baseUrl = 'made/up/url'; - loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) { loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.octvertexnormals.watermask.terrain', responseType, method, data, headers, deferred); }; @@ -532,8 +511,6 @@ defineSuite([ }); it('provides QuantizedMeshTerrainData with OctVertexNormals', function() { - var baseUrl = 'made/up/url'; - loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) { loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.octvertexnormals.terrain', responseType, method, data, headers, deferred); }; @@ -547,8 +524,6 @@ defineSuite([ }); it('provides QuantizedMeshTerrainData with VertexNormals and unknown extensions', function() { - var baseUrl = 'made/up/url'; - loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) { loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.vertexnormals.unknownext.terrain', responseType, method, data, headers, deferred); }; @@ -562,8 +537,6 @@ defineSuite([ }); it('provides QuantizedMeshTerrainData with OctVertexNormals and unknown extensions', function() { - var baseUrl = 'made/up/url'; - loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) { loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.octvertexnormals.unknownext.terrain', responseType, method, data, headers, deferred); }; @@ -577,8 +550,6 @@ defineSuite([ }); it('provides QuantizedMeshTerrainData with unknown extension', function() { - var baseUrl = 'made/up/url'; - loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) { loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.unknownext.terrain', responseType, method, data, headers, deferred); }; @@ -665,8 +636,6 @@ defineSuite([ }); it('supports a query string in the base URL', function() { - var baseUrl = 'made/up/url?a=some&b=query'; - loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) { // Just return any old file, as long as its big enough loadWithXhr.defaultLoad('Data/EarthOrientationParameters/IcrfToFixedStkComponentsRotationData.json', responseType, method, data, headers, deferred); diff --git a/Specs/Core/CircleGeometrySpec.js b/Specs/Core/CircleGeometrySpec.js index 15f70821bc5e..1f20394e997e 100644 --- a/Specs/Core/CircleGeometrySpec.js +++ b/Specs/Core/CircleGeometrySpec.js @@ -14,7 +14,6 @@ defineSuite([ VertexFormat, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('throws without a center', function() { expect(function() { diff --git a/Specs/Core/CircleOutlineGeometrySpec.js b/Specs/Core/CircleOutlineGeometrySpec.js index 0a2328b12e84..fe04068dd5d5 100644 --- a/Specs/Core/CircleOutlineGeometrySpec.js +++ b/Specs/Core/CircleOutlineGeometrySpec.js @@ -10,7 +10,6 @@ defineSuite([ Ellipsoid, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('throws without a center', function() { expect(function() { diff --git a/Specs/Core/ClockSpec.js b/Specs/Core/ClockSpec.js index c3ae4ddf7252..b7a64f7e9c15 100644 --- a/Specs/Core/ClockSpec.js +++ b/Specs/Core/ClockSpec.js @@ -12,7 +12,6 @@ defineSuite([ JulianDate, pollToPromise) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor sets default parameters', function() { var clock = new Clock(); diff --git a/Specs/Core/ColorGeometryInstanceAttributeSpec.js b/Specs/Core/ColorGeometryInstanceAttributeSpec.js index 4a385d2699c5..9399f54181fc 100644 --- a/Specs/Core/ColorGeometryInstanceAttributeSpec.js +++ b/Specs/Core/ColorGeometryInstanceAttributeSpec.js @@ -8,7 +8,6 @@ defineSuite([ Color, ComponentDatatype) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor', function() { var attribute = new ColorGeometryInstanceAttribute(1.0, 1.0, 0.0, 0.5); diff --git a/Specs/Core/ColorSpec.js b/Specs/Core/ColorSpec.js index 4278d9338a07..262e9a80d805 100644 --- a/Specs/Core/ColorSpec.js +++ b/Specs/Core/ColorSpec.js @@ -10,7 +10,6 @@ defineSuite([ CesiumMath, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('Constructing without arguments produces expected defaults', function() { var v = new Color(); diff --git a/Specs/Core/ComponentDatatypeSpec.js b/Specs/Core/ComponentDatatypeSpec.js index 5f8ef0b88ab3..7873bc91996e 100644 --- a/Specs/Core/ComponentDatatypeSpec.js +++ b/Specs/Core/ComponentDatatypeSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( ComponentDatatype) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('fromTypedArray works', function() { expect(ComponentDatatype.fromTypedArray(new Int8Array())).toBe(ComponentDatatype.BYTE); @@ -126,4 +125,4 @@ defineSuite([ ComponentDatatype.createTypedArray(ComponentDatatype.BYTE, undefined, 0, 1); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/CorridorGeometrySpec.js b/Specs/Core/CorridorGeometrySpec.js index 58ea955b6a55..f9853ba4bdf6 100644 --- a/Specs/Core/CorridorGeometrySpec.js +++ b/Specs/Core/CorridorGeometrySpec.js @@ -14,7 +14,6 @@ defineSuite([ VertexFormat, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('throws without positions', function() { expect(function() { diff --git a/Specs/Core/CorridorOutlineGeometrySpec.js b/Specs/Core/CorridorOutlineGeometrySpec.js index 7ab00c59d114..d177b09ccc47 100644 --- a/Specs/Core/CorridorOutlineGeometrySpec.js +++ b/Specs/Core/CorridorOutlineGeometrySpec.js @@ -12,7 +12,6 @@ defineSuite([ Ellipsoid, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('throws without positions', function() { expect(function() { @@ -146,4 +145,4 @@ defineSuite([ packedInstance.push(Ellipsoid.WGS84.radii.x, Ellipsoid.WGS84.radii.y, Ellipsoid.WGS84.radii.z); packedInstance.push(30000.0, 0.0, 0.0, 2.0, 0.1); createPackableSpecs(CorridorOutlineGeometry, corridor, packedInstance); -}); \ No newline at end of file +}); diff --git a/Specs/Core/CubicRealPolynomialSpec.js b/Specs/Core/CubicRealPolynomialSpec.js index 820a27377e59..088f98e20fbf 100644 --- a/Specs/Core/CubicRealPolynomialSpec.js +++ b/Specs/Core/CubicRealPolynomialSpec.js @@ -6,7 +6,6 @@ defineSuite([ CubicRealPolynomial, CesiumMath) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('discriminant throws without a', function() { expect(function() { @@ -134,4 +133,4 @@ defineSuite([ expect(roots.length).toEqual(1); expect(roots[0]).toEqual(0.0); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/CylinderGeometrySpec.js b/Specs/Core/CylinderGeometrySpec.js index af4aecec29b9..8946c7627f8d 100644 --- a/Specs/Core/CylinderGeometrySpec.js +++ b/Specs/Core/CylinderGeometrySpec.js @@ -8,7 +8,6 @@ defineSuite([ VertexFormat, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor throws with no length', function() { expect(function() { @@ -146,4 +145,4 @@ defineSuite([ }); var packedInstance = [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 3.0]; createPackableSpecs(CylinderGeometry, cylinder, packedInstance); -}); \ No newline at end of file +}); diff --git a/Specs/Core/CylinderOutlineGeometrySpec.js b/Specs/Core/CylinderOutlineGeometrySpec.js index 4e373bee09f8..5b9e45beb36a 100644 --- a/Specs/Core/CylinderOutlineGeometrySpec.js +++ b/Specs/Core/CylinderOutlineGeometrySpec.js @@ -6,7 +6,6 @@ defineSuite([ CylinderOutlineGeometry, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor throws with no length', function() { expect(function() { @@ -113,4 +112,4 @@ defineSuite([ }); var packedInstance = [1.0, 1.0, 0.0, 3.0, 0.0]; createPackableSpecs(CylinderOutlineGeometry, cylinder, packedInstance); -}); \ No newline at end of file +}); diff --git a/Specs/Core/DeveloperErrorSpec.js b/Specs/Core/DeveloperErrorSpec.js index 0b11119e064d..ee2856081fff 100644 --- a/Specs/Core/DeveloperErrorSpec.js +++ b/Specs/Core/DeveloperErrorSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( DeveloperError) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var name = 'DeveloperError'; var testMessage = 'Testing'; diff --git a/Specs/Core/EarthOrientationParametersSpec.js b/Specs/Core/EarthOrientationParametersSpec.js index 9b5edbe17504..f5ce2723edcb 100644 --- a/Specs/Core/EarthOrientationParametersSpec.js +++ b/Specs/Core/EarthOrientationParametersSpec.js @@ -10,7 +10,6 @@ defineSuite([ JulianDate, TimeStandard) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var officialLeapSeconds; @@ -193,4 +192,4 @@ defineSuite([ expect(Math.abs(resultBefore.ut1MinusUtc - resultAfter.ut1MinusUtc) > 0.5).toEqual(true); }); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/EllipseGeometrySpec.js b/Specs/Core/EllipseGeometrySpec.js index 1c72f7b57324..3b7bfaa77caa 100644 --- a/Specs/Core/EllipseGeometrySpec.js +++ b/Specs/Core/EllipseGeometrySpec.js @@ -14,7 +14,6 @@ defineSuite([ VertexFormat, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('throws without a center', function() { expect(function() { diff --git a/Specs/Core/EllipseOutlineGeometrySpec.js b/Specs/Core/EllipseOutlineGeometrySpec.js index cd0e3ceb9c58..43a37236318b 100644 --- a/Specs/Core/EllipseOutlineGeometrySpec.js +++ b/Specs/Core/EllipseOutlineGeometrySpec.js @@ -10,7 +10,6 @@ defineSuite([ Ellipsoid, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('throws without a center', function() { expect(function() { diff --git a/Specs/Core/EllipsoidGeodesicSpec.js b/Specs/Core/EllipsoidGeodesicSpec.js index 84d0e4f439bc..cd7cb09d722e 100644 --- a/Specs/Core/EllipsoidGeodesicSpec.js +++ b/Specs/Core/EllipsoidGeodesicSpec.js @@ -10,7 +10,6 @@ defineSuite([ Ellipsoid, CesiumMath) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('throws without start', function() { expect(function() { @@ -245,12 +244,4 @@ defineSuite([ expect(expectedMid.longitude).toEqualEpsilon(result.longitude, CesiumMath.EPSILON13); expect(expectedMid.latitude).toEqualEpsilon(result.latitude, CesiumMath.EPSILON13); }); - - it('doesn\'t modify incoming cartographics', function(){ - var start = new Cartographic(1,2,3); - var end = new Cartographic(2,3,4); - var geodesic = new EllipsoidGeodesic(start, end); - expect(start.height).toEqual(3); - expect(end.height).toEqual(4); - }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/EllipsoidGeometrySpec.js b/Specs/Core/EllipsoidGeometrySpec.js index 1b92a402fd51..6354995950f1 100644 --- a/Specs/Core/EllipsoidGeometrySpec.js +++ b/Specs/Core/EllipsoidGeometrySpec.js @@ -12,7 +12,6 @@ defineSuite([ VertexFormat, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor throws with invalid slicePartitions', function() { expect(function() { diff --git a/Specs/Core/EllipsoidOutlineGeometrySpec.js b/Specs/Core/EllipsoidOutlineGeometrySpec.js index e3c48e9761f7..c80897a74c90 100644 --- a/Specs/Core/EllipsoidOutlineGeometrySpec.js +++ b/Specs/Core/EllipsoidOutlineGeometrySpec.js @@ -8,7 +8,6 @@ defineSuite([ Cartesian3, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor throws if stackPartitions less than 1', function() { expect(function() { @@ -54,4 +53,4 @@ defineSuite([ }); var packedInstance = [1.0, 2.0, 3.0, 3.0, 3.0, 3.0]; createPackableSpecs(EllipsoidOutlineGeometry, ellipsoidgeometry, packedInstance); -}); \ No newline at end of file +}); diff --git a/Specs/Core/EllipsoidSpec.js b/Specs/Core/EllipsoidSpec.js index eb18e81fd01d..df755a3a1a10 100644 --- a/Specs/Core/EllipsoidSpec.js +++ b/Specs/Core/EllipsoidSpec.js @@ -12,7 +12,6 @@ defineSuite([ CesiumMath, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var radii = new Cartesian3(1.0, 2.0, 3.0); var radiiSquared = Cartesian3.multiplyComponents(radii, radii, new Cartesian3()); diff --git a/Specs/Core/EllipsoidTangentPlaneSpec.js b/Specs/Core/EllipsoidTangentPlaneSpec.js index bf88122417c1..f8535c399ccb 100644 --- a/Specs/Core/EllipsoidTangentPlaneSpec.js +++ b/Specs/Core/EllipsoidTangentPlaneSpec.js @@ -16,7 +16,6 @@ defineSuite([ Matrix3, OrientedBoundingBox) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor defaults to WGS84', function() { var origin = new Cartesian3(Ellipsoid.WGS84.radii.x, 0, 0); diff --git a/Specs/Core/EllipsoidTerrainProviderSpec.js b/Specs/Core/EllipsoidTerrainProviderSpec.js index 00736886b266..c2cfc15682c1 100644 --- a/Specs/Core/EllipsoidTerrainProviderSpec.js +++ b/Specs/Core/EllipsoidTerrainProviderSpec.js @@ -8,7 +8,6 @@ defineSuite([ TerrainProvider, createContext) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var context; @@ -49,4 +48,4 @@ defineSuite([ var provider = new EllipsoidTerrainProvider(); expect(provider.getTileDataAvailable()).toBeUndefined(); }); -}, 'WebGL'); \ No newline at end of file +}, 'WebGL'); diff --git a/Specs/Core/EllipsoidalOccluderSpec.js b/Specs/Core/EllipsoidalOccluderSpec.js index 000f4f643cef..f7a3524ffde8 100644 --- a/Specs/Core/EllipsoidalOccluderSpec.js +++ b/Specs/Core/EllipsoidalOccluderSpec.js @@ -18,7 +18,6 @@ defineSuite([ Ray, Rectangle) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('uses ellipsoid', function() { var ellipsoid = new Ellipsoid(2.0, 3.0, 4.0); diff --git a/Specs/Core/EncodedCartesian3Spec.js b/Specs/Core/EncodedCartesian3Spec.js index f68a750204f5..05ec90f02edc 100644 --- a/Specs/Core/EncodedCartesian3Spec.js +++ b/Specs/Core/EncodedCartesian3Spec.js @@ -6,7 +6,6 @@ defineSuite([ EncodedCartesian3, Cartesian3) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('construct with default values', function() { var encoded = new EncodedCartesian3(); diff --git a/Specs/Core/EventSpec.js b/Specs/Core/EventSpec.js index 8564a17aa788..47f26b336810 100644 --- a/Specs/Core/EventSpec.js +++ b/Specs/Core/EventSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( Event) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var event; var spyListener; @@ -203,4 +202,4 @@ defineSuite([ event.removeEventListener(null); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/FeatureDetectionSpec.js b/Specs/Core/FeatureDetectionSpec.js index 7f129d6ddf91..2acae758dfac 100644 --- a/Specs/Core/FeatureDetectionSpec.js +++ b/Specs/Core/FeatureDetectionSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( FeatureDetection) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ //generally, these tests just make sure the function runs, the test can't expect a value of true or false it('detects fullscreen support', function() { diff --git a/Specs/Core/FullscreenSpec.js b/Specs/Core/FullscreenSpec.js index fda6be67a616..0cf9747e9079 100644 --- a/Specs/Core/FullscreenSpec.js +++ b/Specs/Core/FullscreenSpec.js @@ -6,7 +6,6 @@ defineSuite([ Fullscreen, FeatureDetection) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('can tell if fullscreen is supported', function() { // just make sure the function runs, the test can't expect a particular result. @@ -64,4 +63,4 @@ defineSuite([ } }); } -}); \ No newline at end of file +}); diff --git a/Specs/Core/GeographicProjectionSpec.js b/Specs/Core/GeographicProjectionSpec.js index 04f35e34fe5e..4fad9b3f286f 100644 --- a/Specs/Core/GeographicProjectionSpec.js +++ b/Specs/Core/GeographicProjectionSpec.js @@ -12,7 +12,6 @@ defineSuite([ Ellipsoid, CesiumMath) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('construct0', function() { var projection = new GeographicProjection(); @@ -82,4 +81,4 @@ defineSuite([ return projection.unproject(); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/GeographicTilingSchemeSpec.js b/Specs/Core/GeographicTilingSchemeSpec.js index 2111a0a6b047..b246e65e7570 100644 --- a/Specs/Core/GeographicTilingSchemeSpec.js +++ b/Specs/Core/GeographicTilingSchemeSpec.js @@ -16,7 +16,6 @@ defineSuite([ Rectangle, TilingScheme) { "use strict"; - /*global describe,it,expect*/ it('conforms to TilingScheme interface.', function() { expect(GeographicTilingScheme).toConformToInterface(TilingScheme); @@ -179,4 +178,4 @@ defineSuite([ expect(resultParameter).toEqual(new Cartesian2(3, 0)); }); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/GeometryAttributeSpec.js b/Specs/Core/GeometryAttributeSpec.js index b38d5de98512..db69c29de245 100644 --- a/Specs/Core/GeometryAttributeSpec.js +++ b/Specs/Core/GeometryAttributeSpec.js @@ -6,7 +6,6 @@ defineSuite([ GeometryAttribute, ComponentDatatype) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor', function() { var color = new GeometryAttribute({ diff --git a/Specs/Core/GeometryInstanceAttributeSpec.js b/Specs/Core/GeometryInstanceAttributeSpec.js index 8f6496c3a2c8..0412db2bd079 100644 --- a/Specs/Core/GeometryInstanceAttributeSpec.js +++ b/Specs/Core/GeometryInstanceAttributeSpec.js @@ -6,7 +6,6 @@ defineSuite([ GeometryInstanceAttribute, ComponentDatatype) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor', function() { var color = new GeometryInstanceAttribute({ diff --git a/Specs/Core/GeometryInstanceSpec.js b/Specs/Core/GeometryInstanceSpec.js index e65e99a8a17a..7fe66d2b6c7f 100644 --- a/Specs/Core/GeometryInstanceSpec.js +++ b/Specs/Core/GeometryInstanceSpec.js @@ -20,7 +20,6 @@ defineSuite([ Matrix4, PrimitiveType) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor', function() { var geometry = new Geometry({ diff --git a/Specs/Core/GeometryPipelineSpec.js b/Specs/Core/GeometryPipelineSpec.js index b3ecfc138492..731719e95b29 100644 --- a/Specs/Core/GeometryPipelineSpec.js +++ b/Specs/Core/GeometryPipelineSpec.js @@ -44,7 +44,6 @@ defineSuite([ Tipsify, VertexFormat) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('converts triangles to wireframe in place', function() { var geometry = GeometryPipeline.toWireframe(new Geometry({ @@ -695,9 +694,6 @@ defineSuite([ }); it('projectTo2D throws when trying to project a point close to the origin', function() { - var p1 = new Cartesian3(100000, 200000, 300000); - var p2 = new Cartesian3(400000, 500000, 600000); - var geometry = {}; geometry.attributes = {}; geometry.attributes.position = { diff --git a/Specs/Core/GeometrySpec.js b/Specs/Core/GeometrySpec.js index 3d1daf7a7025..063b0facada8 100644 --- a/Specs/Core/GeometrySpec.js +++ b/Specs/Core/GeometrySpec.js @@ -16,7 +16,6 @@ defineSuite([ GeometryType, PrimitiveType) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor', function() { var attributes = { diff --git a/Specs/Core/HeadingPitchRangeSpec.js b/Specs/Core/HeadingPitchRangeSpec.js index 89e45d71eaec..7c222a55060d 100644 --- a/Specs/Core/HeadingPitchRangeSpec.js +++ b/Specs/Core/HeadingPitchRangeSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( HeadingPitchRange) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('construct with default values', function() { var hpr = new HeadingPitchRange(); @@ -35,4 +34,4 @@ defineSuite([ expect(hpr).toBe(returnedResult); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/HeightmapTerrainDataSpec.js b/Specs/Core/HeightmapTerrainDataSpec.js index 380437c88fef..84ec93ed5e8c 100644 --- a/Specs/Core/HeightmapTerrainDataSpec.js +++ b/Specs/Core/HeightmapTerrainDataSpec.js @@ -12,7 +12,6 @@ defineSuite([ TerrainData, when) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('conforms to TerrainData interface', function() { expect(HeightmapTerrainData).toConformToInterface(TerrainData); @@ -302,4 +301,4 @@ defineSuite([ }).toThrowDeveloperError(); }); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/HermitePolynomialApproximationSpec.js b/Specs/Core/HermitePolynomialApproximationSpec.js index 672ffc763e77..acfef730a26c 100644 --- a/Specs/Core/HermitePolynomialApproximationSpec.js +++ b/Specs/Core/HermitePolynomialApproximationSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( HermitePolynomialApproximation) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ //The results of these specs were validated against STK Components //an aerospace SDK available from Analytical Graphics. www.agi.com/components/ @@ -76,4 +75,4 @@ defineSuite([ expect(result).toEqualEpsilon(expectedResult, 1e-8); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/HermiteSplineSpec.js b/Specs/Core/HermiteSplineSpec.js index 8ef6f6e4360e..b7a584eb7198 100644 --- a/Specs/Core/HermiteSplineSpec.js +++ b/Specs/Core/HermiteSplineSpec.js @@ -8,7 +8,6 @@ defineSuite([ Cartesian3, CesiumMath) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var points; var times; diff --git a/Specs/Core/Iau2000OrientationSpec.js b/Specs/Core/Iau2000OrientationSpec.js index 82d28992ec99..f51d12fb9fde 100644 --- a/Specs/Core/Iau2000OrientationSpec.js +++ b/Specs/Core/Iau2000OrientationSpec.js @@ -8,7 +8,6 @@ defineSuite([ JulianDate, TimeStandard) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('compute moon', function() { var date = new JulianDate(2451545.0, -32.184, TimeStandard.TAI); diff --git a/Specs/Core/Iau2006XysDataSpec.js b/Specs/Core/Iau2006XysDataSpec.js index 131fcc28f37c..280e90df9d3f 100644 --- a/Specs/Core/Iau2006XysDataSpec.js +++ b/Specs/Core/Iau2006XysDataSpec.js @@ -10,7 +10,6 @@ defineSuite([ Iau2006XysSample, pollToPromise) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var xys; @@ -53,4 +52,4 @@ defineSuite([ it('returns undefined after the last XYS table sample', function() { expect(xys.computeXysRadians(2442396 + 27427, 0.0)).toBeUndefined(); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/IauOrientationAxesSpec.js b/Specs/Core/IauOrientationAxesSpec.js index 0915d64eee38..75d5e5c8eeac 100644 --- a/Specs/Core/IauOrientationAxesSpec.js +++ b/Specs/Core/IauOrientationAxesSpec.js @@ -14,7 +14,6 @@ defineSuite([ Matrix3, TimeStandard) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('compute ICRF to Moon Fixed', function() { var date = new JulianDate(2451545.0, -32.184, TimeStandard.TAI); diff --git a/Specs/Core/IndexDatatypeSpec.js b/Specs/Core/IndexDatatypeSpec.js index fe14bc8679e3..9721fa80b1aa 100644 --- a/Specs/Core/IndexDatatypeSpec.js +++ b/Specs/Core/IndexDatatypeSpec.js @@ -6,7 +6,6 @@ defineSuite([ IndexDatatype, CesiumMath) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('IndexDatatype.validate validates input', function() { expect(IndexDatatype.validate(IndexDatatype.UNSIGNED_SHORT)).toEqual(true); diff --git a/Specs/Core/IntersectionTestsSpec.js b/Specs/Core/IntersectionTestsSpec.js index 227d50361ab1..8eca66e54a7c 100644 --- a/Specs/Core/IntersectionTestsSpec.js +++ b/Specs/Core/IntersectionTestsSpec.js @@ -16,7 +16,6 @@ defineSuite([ Plane, Ray) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('rayPlane intersects', function() { var ray = new Ray(new Cartesian3(2.0, 0.0, 0.0), new Cartesian3(-1.0, 0.0, 0.0)); diff --git a/Specs/Core/Intersections2DSpec.js b/Specs/Core/Intersections2DSpec.js index 0fe3ea3eb2b4..c81e7a801186 100644 --- a/Specs/Core/Intersections2DSpec.js +++ b/Specs/Core/Intersections2DSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( Intersections2D) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ describe('clipTriangleAtAxisAlignedThreshold', function() { it('eliminates a triangle that is entirely on the wrong side of the threshold', function() { diff --git a/Specs/Core/IntervalSpec.js b/Specs/Core/IntervalSpec.js index 3479c1ff0984..7fc7638dfcfe 100644 --- a/Specs/Core/IntervalSpec.js +++ b/Specs/Core/IntervalSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( Interval) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructs without arguments', function() { var interval = new Interval(); @@ -19,4 +18,4 @@ defineSuite([ expect(interval.start).toEqual(start); expect(interval.stop).toEqual(stop); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/JulianDateSpec.js b/Specs/Core/JulianDateSpec.js index 933b3485ec50..4923e5ba3661 100644 --- a/Specs/Core/JulianDateSpec.js +++ b/Specs/Core/JulianDateSpec.js @@ -10,7 +10,6 @@ defineSuite([ TimeConstants, TimeStandard) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ // All exact Julian Dates found using NASA's Time Conversion Tool: http://ssd.jpl.nasa.gov/tc.cgi it('Construct a default date', function() { diff --git a/Specs/Core/LagrangePolynomialApproximationSpec.js b/Specs/Core/LagrangePolynomialApproximationSpec.js index 6b69940176ce..9364148f571d 100644 --- a/Specs/Core/LagrangePolynomialApproximationSpec.js +++ b/Specs/Core/LagrangePolynomialApproximationSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( LagrangePolynomialApproximation) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ //The results of these specs were validated against STK Components //an aerospace SDK available from Analytical Graphics. www.agi.com/components/ @@ -43,4 +42,4 @@ defineSuite([ expect(LagrangePolynomialApproximation.getRequiredDataPoints(2)).toEqual(3); expect(LagrangePolynomialApproximation.getRequiredDataPoints(3)).toEqual(4); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/LeapSecondSpec.js b/Specs/Core/LeapSecondSpec.js index ce6b0fa4f5a1..f172dec185d3 100644 --- a/Specs/Core/LeapSecondSpec.js +++ b/Specs/Core/LeapSecondSpec.js @@ -6,7 +6,6 @@ defineSuite([ LeapSecond, JulianDate) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('default constructor sets expected values', function() { var leapSecond = new LeapSecond(); diff --git a/Specs/Core/LinearApproximationSpec.js b/Specs/Core/LinearApproximationSpec.js index d539eb99e1e7..5a3ed5abe783 100644 --- a/Specs/Core/LinearApproximationSpec.js +++ b/Specs/Core/LinearApproximationSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( LinearApproximation) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('should produce correct results', function() { var xTable = [2.0, 4.0]; @@ -73,4 +72,4 @@ defineSuite([ it('getRequiredDataPoints returns 2', function() { expect(LinearApproximation.getRequiredDataPoints(1)).toEqual(2); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/LinearSplineSpec.js b/Specs/Core/LinearSplineSpec.js index 5ffd5af92322..34ef885d72f5 100644 --- a/Specs/Core/LinearSplineSpec.js +++ b/Specs/Core/LinearSplineSpec.js @@ -6,7 +6,6 @@ defineSuite([ LinearSpline, Cartesian3) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var points; var times; diff --git a/Specs/Core/MapboxApiSpec.js b/Specs/Core/MapboxApiSpec.js index d7fbe284d664..dbd6a38117b3 100644 --- a/Specs/Core/MapboxApiSpec.js +++ b/Specs/Core/MapboxApiSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( MapboxApi) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('getAccessToken returns provided access token if one is provided', function() { expect(MapboxApi.getAccessToken('foo')).toEqual('foo'); diff --git a/Specs/Core/MathSpec.js b/Specs/Core/MathSpec.js index b5bd77a22726..20d84846b476 100644 --- a/Specs/Core/MathSpec.js +++ b/Specs/Core/MathSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( CesiumMath) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('sign of -2', function() { expect(CesiumMath.sign(-2)).toEqual(-1); diff --git a/Specs/Core/Matrix2Spec.js b/Specs/Core/Matrix2Spec.js index 52331f275aeb..d8205ee3660c 100644 --- a/Specs/Core/Matrix2Spec.js +++ b/Specs/Core/Matrix2Spec.js @@ -8,7 +8,6 @@ defineSuite([ Cartesian2, CesiumMath) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('default constructor creates values array with all zeros.', function() { var matrix = new Matrix2(); diff --git a/Specs/Core/Matrix3Spec.js b/Specs/Core/Matrix3Spec.js index b70a41bfb410..e40e87801465 100644 --- a/Specs/Core/Matrix3Spec.js +++ b/Specs/Core/Matrix3Spec.js @@ -10,7 +10,6 @@ defineSuite([ CesiumMath, Quaternion) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('default constructor creates values array with all zeros.', function() { var matrix = new Matrix3(); diff --git a/Specs/Core/Matrix4Spec.js b/Specs/Core/Matrix4Spec.js index 5dc0e0f0d458..664b7dd56762 100644 --- a/Specs/Core/Matrix4Spec.js +++ b/Specs/Core/Matrix4Spec.js @@ -14,7 +14,6 @@ defineSuite([ Matrix3, Quaternion) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('default constructor creates values array with all zeros.', function() { var matrix = new Matrix4(); @@ -1681,14 +1680,13 @@ defineSuite([ it('computeInfinitePerspectiveOffCenter throws without near', function() { expect(function() { - var left = 0, right = 0, bottom = 0, top = 0, far = 0; + var left = 0, right = 0, bottom = 0, top = 0; Matrix4.computeInfinitePerspectiveOffCenter (left, right, bottom, top, 0); }).toThrowDeveloperError(); }); it('computeViewportTransformation works', function() { expect(function() { - var left = 0, right = 0, bottom = 0, top = 0, far = 0; Matrix4.computeViewportTransformation ({ x : 0, y : 0, diff --git a/Specs/Core/NearFarScalarSpec.js b/Specs/Core/NearFarScalarSpec.js index 4566634bc13d..139c8061ef59 100644 --- a/Specs/Core/NearFarScalarSpec.js +++ b/Specs/Core/NearFarScalarSpec.js @@ -6,7 +6,6 @@ defineSuite([ NearFarScalar, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructs without arguments', function() { var scalar = new NearFarScalar(); diff --git a/Specs/Core/OccluderSpec.js b/Specs/Core/OccluderSpec.js index 962d9716c8a0..5f1bcb4e2f0c 100644 --- a/Specs/Core/OccluderSpec.js +++ b/Specs/Core/OccluderSpec.js @@ -16,7 +16,6 @@ defineSuite([ Rectangle, Visibility) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('throws an exception during construction (1 of 3)', function() { expect(function() { diff --git a/Specs/Core/OrientedBoundingBoxSpec.js b/Specs/Core/OrientedBoundingBoxSpec.js index 7773d1f751e7..39eddb411624 100644 --- a/Specs/Core/OrientedBoundingBoxSpec.js +++ b/Specs/Core/OrientedBoundingBoxSpec.js @@ -30,7 +30,6 @@ defineSuite([ Quaternion, Rectangle) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var positions = [ new Cartesian3(2.0, 0.0, 0.0), @@ -41,15 +40,6 @@ defineSuite([ new Cartesian3(0.0, 0.0, -4.0) ]; - var positions2 = [ - new Cartesian3(4.0, 0.0, 0.0), - new Cartesian3(0.0, 3.0, 0.0), - new Cartesian3(0.0, 0.0, 2.0), - new Cartesian3(-4.0, 0.0, 0.0), - new Cartesian3(0.0, -3.0, 0.0), - new Cartesian3(0.0, 0.0, -2.0) - ]; - function rotatePositions(positions, axis, angle) { var points = []; @@ -157,7 +147,6 @@ defineSuite([ expect(box1.center).toEqualEpsilon(box2.center, CesiumMath.EPSILON15); - var rotScale = Matrix3.ZERO; expect(box1.halfAxes).toEqualEpsilon(box2.halfAxes, CesiumMath.EPSILON15); }); @@ -762,7 +751,6 @@ defineSuite([ it('clone undefined OBB with a result parameter', function() { var box = new OrientedBoundingBox(); - var box2 = new OrientedBoundingBox(); expect(OrientedBoundingBox.clone(undefined, box)).toBe(undefined); }); diff --git a/Specs/Core/PinBuilderSpec.js b/Specs/Core/PinBuilderSpec.js index 68586f7ac06b..65c0fd8ec839 100644 --- a/Specs/Core/PinBuilderSpec.js +++ b/Specs/Core/PinBuilderSpec.js @@ -12,7 +12,6 @@ defineSuite([ defined, when) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ function getPinColor(canvas) { var context2D = canvas.getContext("2d"); @@ -143,4 +142,4 @@ defineSuite([ builder.fromMakiIconId('hospital', Color.RED, undefined); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/PlaneSpec.js b/Specs/Core/PlaneSpec.js index 1d7d52dedbb6..bec3b90cbc5e 100644 --- a/Specs/Core/PlaneSpec.js +++ b/Specs/Core/PlaneSpec.js @@ -8,7 +8,6 @@ defineSuite([ Cartesian3, Cartesian4) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructs', function() { var normal = Cartesian3.UNIT_X; diff --git a/Specs/Core/PolygonGeometrySpec.js b/Specs/Core/PolygonGeometrySpec.js index b0bfef972f62..d337ebde433a 100644 --- a/Specs/Core/PolygonGeometrySpec.js +++ b/Specs/Core/PolygonGeometrySpec.js @@ -17,7 +17,6 @@ defineSuite([ VertexFormat, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('throws without hierarchy', function() { expect(function() { diff --git a/Specs/Core/PolygonOutlineGeometrySpec.js b/Specs/Core/PolygonOutlineGeometrySpec.js index adebd60042c3..da86e2594a2f 100644 --- a/Specs/Core/PolygonOutlineGeometrySpec.js +++ b/Specs/Core/PolygonOutlineGeometrySpec.js @@ -14,7 +14,6 @@ defineSuite([ CesiumMath, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('throws without hierarchy', function() { expect(function() { diff --git a/Specs/Core/PolygonPipelineSpec.js b/Specs/Core/PolygonPipelineSpec.js index ba3ea70e34b0..d2fe687dcfab 100644 --- a/Specs/Core/PolygonPipelineSpec.js +++ b/Specs/Core/PolygonPipelineSpec.js @@ -14,7 +14,6 @@ defineSuite([ CesiumMath, WindingOrder) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ beforeEach(function() { CesiumMath.setRandomNumberSeed(0.0); @@ -547,4 +546,4 @@ defineSuite([ expect(positions.length).toEqual(28); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/PolylineGeometrySpec.js b/Specs/Core/PolylineGeometrySpec.js index 661ed7cc0767..252dc15d3755 100644 --- a/Specs/Core/PolylineGeometrySpec.js +++ b/Specs/Core/PolylineGeometrySpec.js @@ -16,7 +16,6 @@ defineSuite([ VertexFormat, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor throws with no positions', function() { expect(function() { @@ -186,4 +185,4 @@ defineSuite([ }); packedInstance = [3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 12, 13, 14, 1, 0, 0, 0, 0, 0, 10, 0, 0, 11]; createPackableSpecs(PolylineGeometry, line, packedInstance); -}); \ No newline at end of file +}); diff --git a/Specs/Core/PolylinePipelineSpec.js b/Specs/Core/PolylinePipelineSpec.js index fb9ce7acc2f0..37cb7d2d5187 100644 --- a/Specs/Core/PolylinePipelineSpec.js +++ b/Specs/Core/PolylinePipelineSpec.js @@ -12,7 +12,6 @@ defineSuite([ CesiumMath, Transforms) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('wrapLongitude', function() { var positions = Cartesian3.fromDegreesArray([ diff --git a/Specs/Core/PolylineVolumeGeometrySpec.js b/Specs/Core/PolylineVolumeGeometrySpec.js index a8cec93e6a27..8671a3dbfb88 100644 --- a/Specs/Core/PolylineVolumeGeometrySpec.js +++ b/Specs/Core/PolylineVolumeGeometrySpec.js @@ -16,7 +16,6 @@ defineSuite([ VertexFormat, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var shape; beforeAll(function() { diff --git a/Specs/Core/PolylineVolumeOutlineGeometrySpec.js b/Specs/Core/PolylineVolumeOutlineGeometrySpec.js index ce290de21746..28589235f5fb 100644 --- a/Specs/Core/PolylineVolumeOutlineGeometrySpec.js +++ b/Specs/Core/PolylineVolumeOutlineGeometrySpec.js @@ -14,7 +14,6 @@ defineSuite([ Ellipsoid, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var shape; @@ -154,4 +153,4 @@ defineSuite([ }); var packedInstance = [3.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 2.0, 0.1]; createPackableSpecs(PolylineVolumeOutlineGeometry, volume, packedInstance); -}); \ No newline at end of file +}); diff --git a/Specs/Core/QuadraticRealPolynomialSpec.js b/Specs/Core/QuadraticRealPolynomialSpec.js index 53d5f9ddf8bc..013773399d8d 100644 --- a/Specs/Core/QuadraticRealPolynomialSpec.js +++ b/Specs/Core/QuadraticRealPolynomialSpec.js @@ -6,7 +6,6 @@ defineSuite([ QuadraticRealPolynomial, CesiumMath) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('discriminant throws without a', function() { expect(function() { @@ -118,4 +117,4 @@ defineSuite([ expect(roots[0]).toEqual(0.0); expect(roots[1]).toEqual(3.0); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/QuantizedMeshTerrainDataSpec.js b/Specs/Core/QuantizedMeshTerrainDataSpec.js index 31f618644e0a..b1ca56ebb17f 100644 --- a/Specs/Core/QuantizedMeshTerrainDataSpec.js +++ b/Specs/Core/QuantizedMeshTerrainDataSpec.js @@ -20,7 +20,6 @@ defineSuite([ TerrainMesh, when) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('conforms to TerrainData interface', function() { expect(QuantizedMeshTerrainData).toConformToInterface(TerrainData); @@ -795,4 +794,4 @@ defineSuite([ expect(data.isChildAvailable(10, 20, 21, 41)).toBe(false); }); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/QuarticRealPolynomialSpec.js b/Specs/Core/QuarticRealPolynomialSpec.js index b7799f569ee1..86596ca2d8f7 100644 --- a/Specs/Core/QuarticRealPolynomialSpec.js +++ b/Specs/Core/QuarticRealPolynomialSpec.js @@ -6,7 +6,6 @@ defineSuite([ QuarticRealPolynomial, CesiumMath) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('discriminant throws without a', function() { expect(function() { @@ -188,4 +187,4 @@ defineSuite([ expect(actual[0]).toEqualEpsilon(expected[0], CesiumMath.EPSILON11); expect(actual[1]).toEqualEpsilon(expected[1], CesiumMath.EPSILON11); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/QuaternionSpec.js b/Specs/Core/QuaternionSpec.js index 24f4700bbb28..1b01d410ff42 100644 --- a/Specs/Core/QuaternionSpec.js +++ b/Specs/Core/QuaternionSpec.js @@ -12,7 +12,6 @@ defineSuite([ Matrix3, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('construct with default values', function() { var quaternion = new Quaternion(); @@ -475,7 +474,6 @@ defineSuite([ it('slerp uses lerp when dot product is close to 1 and a result parameter', function() { var start = new Quaternion(0.0, 0.0, 0.0, 1.0); var end = new Quaternion(1.0, 2.0, 3.0, 1.0); - var expected = new Quaternion(0.5, 1.0, 1.5, 1.0); var result = new Quaternion(); var actual = Quaternion.slerp(start, end, 0.0, result); diff --git a/Specs/Core/QuaternionSplineSpec.js b/Specs/Core/QuaternionSplineSpec.js index 1aebf3386581..456968aa5849 100644 --- a/Specs/Core/QuaternionSplineSpec.js +++ b/Specs/Core/QuaternionSplineSpec.js @@ -10,7 +10,6 @@ defineSuite([ CesiumMath, Quaternion) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var points; var times; diff --git a/Specs/Core/QueueSpec.js b/Specs/Core/QueueSpec.js index df06887f58b6..96ba8b4deebd 100644 --- a/Specs/Core/QueueSpec.js +++ b/Specs/Core/QueueSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( Queue) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var queue; beforeEach(function() { diff --git a/Specs/Core/RaySpec.js b/Specs/Core/RaySpec.js index dafcfbe69e45..f84b7acd953f 100644 --- a/Specs/Core/RaySpec.js +++ b/Specs/Core/RaySpec.js @@ -6,7 +6,6 @@ defineSuite([ Ray, Cartesian3) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('default constructor create zero valued Ray', function() { var ray = new Ray(); diff --git a/Specs/Core/RectangleGeometrySpec.js b/Specs/Core/RectangleGeometrySpec.js index f8e96adf881c..74235895820d 100644 --- a/Specs/Core/RectangleGeometrySpec.js +++ b/Specs/Core/RectangleGeometrySpec.js @@ -22,7 +22,6 @@ defineSuite([ VertexFormat, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('computes positions', function() { var rectangle = new Rectangle(-2.0, -1.0, 0.0, 1.0); diff --git a/Specs/Core/RectangleOutlineGeometrySpec.js b/Specs/Core/RectangleOutlineGeometrySpec.js index f2911849d3b1..07a3a6368f11 100644 --- a/Specs/Core/RectangleOutlineGeometrySpec.js +++ b/Specs/Core/RectangleOutlineGeometrySpec.js @@ -20,7 +20,6 @@ defineSuite([ Rectangle, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('computes positions', function() { var rectangle = new Rectangle(-2.0, -1.0, 0.0, 1.0); diff --git a/Specs/Core/RectangleSpec.js b/Specs/Core/RectangleSpec.js index ea9eba8b6a18..8c6838dcdb30 100644 --- a/Specs/Core/RectangleSpec.js +++ b/Specs/Core/RectangleSpec.js @@ -14,7 +14,6 @@ defineSuite([ CesiumMath, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var west = -0.9; var south = 0.5; @@ -647,4 +646,4 @@ defineSuite([ var rectangle = new Rectangle(west, south, east, north); var packedInstance = [west, south, east, north]; createPackableSpecs(Rectangle, rectangle, packedInstance); -}); \ No newline at end of file +}); diff --git a/Specs/Core/RequestErrorEventSpec.js b/Specs/Core/RequestErrorEventSpec.js index 378febb855aa..6142fd0670f9 100644 --- a/Specs/Core/RequestErrorEventSpec.js +++ b/Specs/Core/RequestErrorEventSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( RequestErrorEvent) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('parses response headers provided as a string', function() { var event = new RequestErrorEvent(404, 'foo', 'This-is-a-test: first\r\nAnother: second value!'); @@ -24,4 +23,4 @@ defineSuite([ 'Another': 'second value!' }); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/RuntimeErrorSpec.js b/Specs/Core/RuntimeErrorSpec.js index 20acff6fd331..3ad348c7e788 100644 --- a/Specs/Core/RuntimeErrorSpec.js +++ b/Specs/Core/RuntimeErrorSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( RuntimeError) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var name = 'RuntimeError'; var testMessage = 'Testing'; diff --git a/Specs/Core/ScreenSpaceEventHandlerSpec.js b/Specs/Core/ScreenSpaceEventHandlerSpec.js index 02c69f6997a7..41995827ec81 100644 --- a/Specs/Core/ScreenSpaceEventHandlerSpec.js +++ b/Specs/Core/ScreenSpaceEventHandlerSpec.js @@ -20,7 +20,6 @@ defineSuite([ ScreenSpaceEventType, DomEventSimulator) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var usePointerEvents = FeatureDetection.supportsPointerEvents(); var element; diff --git a/Specs/Core/ShowGeometryInstanceAttributeSpec.js b/Specs/Core/ShowGeometryInstanceAttributeSpec.js index 7a6d5b0ced2c..2678e18a88cf 100644 --- a/Specs/Core/ShowGeometryInstanceAttributeSpec.js +++ b/Specs/Core/ShowGeometryInstanceAttributeSpec.js @@ -6,7 +6,6 @@ defineSuite([ ShowGeometryInstanceAttribute, ComponentDatatype) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor', function() { var attribute = new ShowGeometryInstanceAttribute(false); diff --git a/Specs/Core/Simon1994PlanetaryPositionsSpec.js b/Specs/Core/Simon1994PlanetaryPositionsSpec.js index 23c6f319f24f..5b357eb12d29 100644 --- a/Specs/Core/Simon1994PlanetaryPositionsSpec.js +++ b/Specs/Core/Simon1994PlanetaryPositionsSpec.js @@ -16,8 +16,6 @@ defineSuite([ TimeStandard, Transforms) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ - // Values for the X Y and Z were found using the STK Components GeometryTransformer on the position of the // sun center of mass point and the earth J2000 reference frame. diff --git a/Specs/Core/SimplePolylineGeometrySpec.js b/Specs/Core/SimplePolylineGeometrySpec.js index 6d7edc6c9a6e..05b63f59b9ac 100644 --- a/Specs/Core/SimplePolylineGeometrySpec.js +++ b/Specs/Core/SimplePolylineGeometrySpec.js @@ -18,7 +18,6 @@ defineSuite([ PrimitiveType, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor throws with no positions', function() { expect(function() { @@ -156,4 +155,4 @@ defineSuite([ }); packedInstance = [3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 12, 13, 14, 0, 0, 11]; createPackableSpecs(SimplePolylineGeometry, line, packedInstance); -}); \ No newline at end of file +}); diff --git a/Specs/Core/SphereGeometrySpec.js b/Specs/Core/SphereGeometrySpec.js index e140f4499b09..a6bc1b7a28aa 100644 --- a/Specs/Core/SphereGeometrySpec.js +++ b/Specs/Core/SphereGeometrySpec.js @@ -12,7 +12,6 @@ defineSuite([ VertexFormat, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor throws with invalid stackPartitions', function() { expect(function() { diff --git a/Specs/Core/SphereOutlineGeometrySpec.js b/Specs/Core/SphereOutlineGeometrySpec.js index e71b4209b107..dab6f5223085 100644 --- a/Specs/Core/SphereOutlineGeometrySpec.js +++ b/Specs/Core/SphereOutlineGeometrySpec.js @@ -6,7 +6,7 @@ defineSuite([ SphereOutlineGeometry, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ + it('constructor throws if stackPartitions less than 1', function() { expect(function() { return new SphereOutlineGeometry({ @@ -51,4 +51,4 @@ defineSuite([ }); var packedInstance = [1.0, 1.0, 1.0, 3.0, 3.0, 2.0]; createPackableSpecs(SphereOutlineGeometry, sphere, packedInstance); -}); \ No newline at end of file +}); diff --git a/Specs/Core/SphericalSpec.js b/Specs/Core/SphericalSpec.js index b5e23a1590a5..dc9da2a24ea1 100644 --- a/Specs/Core/SphericalSpec.js +++ b/Specs/Core/SphericalSpec.js @@ -8,7 +8,6 @@ defineSuite([ Cartesian3, CesiumMath) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ //Mock object to make sure methods take non-sphericals. function NotSpherical(clock, cone, magnitude) { @@ -109,4 +108,4 @@ defineSuite([ var v = new Spherical(1, 2, 3); expect(v.toString()).toEqual('(1, 2, 3)'); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/SplineSpec.js b/Specs/Core/SplineSpec.js index 1f5f4e149842..800aeb7fa364 100644 --- a/Specs/Core/SplineSpec.js +++ b/Specs/Core/SplineSpec.js @@ -8,7 +8,6 @@ defineSuite([ Cartesian3, HermiteSpline) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('contructor throws', function() { expect(function() { diff --git a/Specs/Core/TaskProcessorSpec.js b/Specs/Core/TaskProcessorSpec.js index 363d51e544a9..87a3953fb52e 100644 --- a/Specs/Core/TaskProcessorSpec.js +++ b/Specs/Core/TaskProcessorSpec.js @@ -8,7 +8,6 @@ defineSuite([ require, when) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,fail*/ var taskProcessor; @@ -126,4 +125,4 @@ defineSuite([ expect(error).toContain('postMessage failed'); }); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/TimeIntervalCollectionSpec.js b/Specs/Core/TimeIntervalCollectionSpec.js index bda3c7a50f91..f8be2ce05b78 100644 --- a/Specs/Core/TimeIntervalCollectionSpec.js +++ b/Specs/Core/TimeIntervalCollectionSpec.js @@ -8,7 +8,6 @@ defineSuite([ JulianDate, TimeInterval) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ function TestObject(value) { this.value = value; diff --git a/Specs/Core/TimeIntervalSpec.js b/Specs/Core/TimeIntervalSpec.js index bd5a04d7da65..e8ff01f9dd21 100644 --- a/Specs/Core/TimeIntervalSpec.js +++ b/Specs/Core/TimeIntervalSpec.js @@ -6,7 +6,6 @@ defineSuite([ TimeInterval, JulianDate) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ function returnTrue() { return true; @@ -464,4 +463,4 @@ defineSuite([ TimeInterval.contains(timeInterval, undefined); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/TipsifySpec.js b/Specs/Core/TipsifySpec.js index 0fb25cd1238e..0335b0bd536e 100644 --- a/Specs/Core/TipsifySpec.js +++ b/Specs/Core/TipsifySpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( Tipsify) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('can calculate the ACMR', function() { //Hexagon formed from 6 triangles, 7 vertices @@ -113,4 +112,4 @@ defineSuite([ maximumIndex : 28, cacheSize: 6})); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/TransformsSpec.js b/Specs/Core/TransformsSpec.js index d8390f7320b1..58fa82126557 100644 --- a/Specs/Core/TransformsSpec.js +++ b/Specs/Core/TransformsSpec.js @@ -38,7 +38,6 @@ defineSuite([ TimeInterval, when) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var negativeX = new Cartesian4(-1, 0, 0, 0); var negativeZ = new Cartesian4(0, 0, -1, 0); @@ -337,9 +336,6 @@ defineSuite([ describe('computeIcrfToFixedMatrix', function() { function preloadTransformationData(start, stop, eopDescription) { - var ready = false; - var failed = false; - Transforms.earthOrientationParameters = new EarthOrientationParameters(eopDescription); var preloadInterval = new TimeInterval({ start : start, diff --git a/Specs/Core/TridiagonalSystemSolverSpec.js b/Specs/Core/TridiagonalSystemSolverSpec.js index 5434c5c465e1..f9e5de75b770 100644 --- a/Specs/Core/TridiagonalSystemSolverSpec.js +++ b/Specs/Core/TridiagonalSystemSolverSpec.js @@ -8,7 +8,6 @@ defineSuite([ Cartesian3, CesiumMath) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('solve throws exception without lower diagonal', function() { expect(function() { diff --git a/Specs/Core/VRTheWorldTerrainProviderSpec.js b/Specs/Core/VRTheWorldTerrainProviderSpec.js index cf40d9e0fb44..2d4347ce2ac0 100644 --- a/Specs/Core/VRTheWorldTerrainProviderSpec.js +++ b/Specs/Core/VRTheWorldTerrainProviderSpec.js @@ -24,7 +24,6 @@ defineSuite([ pollToPromise, when) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ beforeEach(function() { loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) { @@ -125,7 +124,7 @@ defineSuite([ }); expect(function() { - var t = provider.tilingScheme; + return provider.tilingScheme; }).toThrowDeveloperError(); }); diff --git a/Specs/Core/VertexFormatSpec.js b/Specs/Core/VertexFormatSpec.js index 2beb4ad6a2d7..b41c630372db 100644 --- a/Specs/Core/VertexFormatSpec.js +++ b/Specs/Core/VertexFormatSpec.js @@ -6,7 +6,6 @@ defineSuite([ VertexFormat, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('clone', function() { var vertexFormat = new VertexFormat({ diff --git a/Specs/Core/WallGeometrySpec.js b/Specs/Core/WallGeometrySpec.js index 5834f894ff5c..93992c7ed793 100644 --- a/Specs/Core/WallGeometrySpec.js +++ b/Specs/Core/WallGeometrySpec.js @@ -14,7 +14,6 @@ defineSuite([ VertexFormat, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var ellipsoid = Ellipsoid.WGS84; diff --git a/Specs/Core/WallOutlineGeometrySpec.js b/Specs/Core/WallOutlineGeometrySpec.js index 7e2c4de2460e..a138b5276366 100644 --- a/Specs/Core/WallOutlineGeometrySpec.js +++ b/Specs/Core/WallOutlineGeometrySpec.js @@ -12,7 +12,6 @@ defineSuite([ CesiumMath, createPackableSpecs) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var ellipsoid = Ellipsoid.WGS84; diff --git a/Specs/Core/WebMercatorProjectionSpec.js b/Specs/Core/WebMercatorProjectionSpec.js index 0d36126cea15..b8629b95f55a 100644 --- a/Specs/Core/WebMercatorProjectionSpec.js +++ b/Specs/Core/WebMercatorProjectionSpec.js @@ -14,7 +14,6 @@ defineSuite([ Ellipsoid, CesiumMath) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('construct0', function() { var projection = new WebMercatorProjection(); @@ -157,4 +156,4 @@ defineSuite([ return projection.unproject(); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/WebMercatorTilingSchemeSpec.js b/Specs/Core/WebMercatorTilingSchemeSpec.js index ed6833590ef4..7065411cec96 100644 --- a/Specs/Core/WebMercatorTilingSchemeSpec.js +++ b/Specs/Core/WebMercatorTilingSchemeSpec.js @@ -18,7 +18,6 @@ defineSuite([ TilingScheme, WebMercatorProjection) { "use strict"; - /*global describe,it,expect,beforeEach*/ var tilingScheme; beforeEach(function() { @@ -276,4 +275,4 @@ defineSuite([ expect(resultParameter).toEqual(new Cartesian2(1, 0)); }); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/appendForwardSlashSpec.js b/Specs/Core/appendForwardSlashSpec.js index 17ce6464e401..670cf0a5699f 100644 --- a/Specs/Core/appendForwardSlashSpec.js +++ b/Specs/Core/appendForwardSlashSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( appendForwardSlash) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('Appends to a url', function() { expect(appendForwardSlash('http://cesiumjs.org')).toEqual('http://cesiumjs.org/'); @@ -17,4 +16,4 @@ defineSuite([ it('Appends to an empty string', function() { expect(appendForwardSlash('')).toEqual('/'); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/barycentricCoordinatesSpec.js b/Specs/Core/barycentricCoordinatesSpec.js index f8f62f6a9f1f..3d4a94b763fb 100644 --- a/Specs/Core/barycentricCoordinatesSpec.js +++ b/Specs/Core/barycentricCoordinatesSpec.js @@ -8,7 +8,6 @@ defineSuite([ Cartesian3, CesiumMath) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var p0 = new Cartesian3(-1.0, 0.0, 0.0); var p1 = new Cartesian3( 1.0, 0.0, 0.0); diff --git a/Specs/Core/binarySearchSpec.js b/Specs/Core/binarySearchSpec.js index 4a8c80fb1d2e..bcab8d2f5cd1 100644 --- a/Specs/Core/binarySearchSpec.js +++ b/Specs/Core/binarySearchSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( binarySearch) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('can perform a binary search for 0', function() { var array = [0, 1, 2, 3, 4, 5, 6, 7]; @@ -72,4 +71,4 @@ defineSuite([ binarySearch([0, 1, 2], 1, undefined); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/buildModuleUrlSpec.js b/Specs/Core/buildModuleUrlSpec.js index 2e40e819054b..680bb31cce40 100644 --- a/Specs/Core/buildModuleUrlSpec.js +++ b/Specs/Core/buildModuleUrlSpec.js @@ -1,4 +1,4 @@ -/*global defineSuite */ +/*global defineSuite*/ defineSuite([ 'Core/buildModuleUrl', 'Core/loadText', @@ -8,7 +8,6 @@ defineSuite([ loadText, Uri) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('produces an absolute URL for a module', function() { var url = buildModuleUrl('Workers/transferTypedArrayTest.js'); @@ -30,4 +29,4 @@ defineSuite([ expect(r.exec('assets/foo/bar.cesium.js')).toBeNull(); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/cloneSpec.js b/Specs/Core/cloneSpec.js index 68a1f54dfe48..5a75db9a12ba 100644 --- a/Specs/Core/cloneSpec.js +++ b/Specs/Core/cloneSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( clone) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('can make shallow clones', function() { var obj = { @@ -47,4 +46,4 @@ defineSuite([ expect(clonedObj.c.e.f).not.toBe(obj.c.e.f); expect(clonedObj.c.e.f.g).toEqual(obj.c.e.f.g); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/combineSpec.js b/Specs/Core/combineSpec.js index 24039f8ed239..53348f47bfbf 100644 --- a/Specs/Core/combineSpec.js +++ b/Specs/Core/combineSpec.js @@ -1,10 +1,9 @@ -/*global defineSuite */ +/*global defineSuite*/ defineSuite([ 'Core/combine' ], function( combine) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('can combine shallow references', function() { var obj1 = { @@ -80,4 +79,4 @@ defineSuite([ expect(combine(undefined, undefined)).toEqual({}); expect(combine(undefined, undefined, true)).toEqual({}); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/createGuidSpec.js b/Specs/Core/createGuidSpec.js index 09fbedfb11d7..21661aa187af 100644 --- a/Specs/Core/createGuidSpec.js +++ b/Specs/Core/createGuidSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( createGuid) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('creates GUIDs', function() { var isGuidRegex = /^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$/; diff --git a/Specs/Core/definedNotNullSpec.js b/Specs/Core/definedNotNullSpec.js index cb1c4f5eec01..f7016db1c5cb 100644 --- a/Specs/Core/definedNotNullSpec.js +++ b/Specs/Core/definedNotNullSpec.js @@ -4,11 +4,10 @@ defineSuite([ ], function( definedNotNull) { "use strict"; - /*global jasmine,it,expect*/ it('works', function() { expect(definedNotNull(0)).toEqual(true); expect(definedNotNull(undefined)).toEqual(false); expect(definedNotNull(null)).toEqual(false); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/definedSpec.js b/Specs/Core/definedSpec.js index 4096bede1486..cf57fe50e115 100644 --- a/Specs/Core/definedSpec.js +++ b/Specs/Core/definedSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( defined) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var obj = 42; var obj2; @@ -16,4 +15,4 @@ defineSuite([ it('works for undefined object', function() { expect(defined(obj2)).toEqual(false); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/deprecationWarningSpec.js b/Specs/Core/deprecationWarningSpec.js index e60a219fe8e2..a7333c87a668 100644 --- a/Specs/Core/deprecationWarningSpec.js +++ b/Specs/Core/deprecationWarningSpec.js @@ -4,7 +4,7 @@ defineSuite([ ], function( deprecationWarning) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,console*/ + /*global console*/ it('logs a warning', function() { spyOn(console, 'log'); @@ -29,4 +29,4 @@ defineSuite([ deprecationWarning('identifier'); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/getBaseUriSpec.js b/Specs/Core/getBaseUriSpec.js index cd45ddf19913..0cd6191fd166 100644 --- a/Specs/Core/getBaseUriSpec.js +++ b/Specs/Core/getBaseUriSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( getBaseUri) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('works as expected', function() { var result = getBaseUri('http://www.mysite.com/awesome?makeitawesome=true'); diff --git a/Specs/Core/getFilenameFromUriSpec.js b/Specs/Core/getFilenameFromUriSpec.js index 5c1dde70ad1f..8d45ce033960 100644 --- a/Specs/Core/getFilenameFromUriSpec.js +++ b/Specs/Core/getFilenameFromUriSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( getFilenameFromUri) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('works as expected', function() { var result = getFilenameFromUri('http://www.mysite.com/awesome?makeitawesome=true'); diff --git a/Specs/Core/getStringFromTypedArraySpec.js b/Specs/Core/getStringFromTypedArraySpec.js index 9a268df14bce..c2156bfa5bbc 100644 --- a/Specs/Core/getStringFromTypedArraySpec.js +++ b/Specs/Core/getStringFromTypedArraySpec.js @@ -1,10 +1,9 @@ -/*global defineSuite */ +/*global defineSuite*/ defineSuite([ 'Core/getStringFromTypedArray' ], function( getStringFromTypedArray) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/ function verifyString() { var arr = new Uint8Array([67, 101, 115, 105, 117, 109]); diff --git a/Specs/Core/isCrossOriginUrlSpec.js b/Specs/Core/isCrossOriginUrlSpec.js index 5011da949e23..6f03cabd8754 100644 --- a/Specs/Core/isCrossOriginUrlSpec.js +++ b/Specs/Core/isCrossOriginUrlSpec.js @@ -6,7 +6,6 @@ defineSuite([ isCrossOriginUrl, Uri) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('returns false for relative urls', function() { expect(isCrossOriginUrl('/some/url.jpg')).toEqual(false); @@ -40,4 +39,4 @@ defineSuite([ absoluteUrl = pageUri.toString(); expect(isCrossOriginUrl(absoluteUrl)).toEqual(true); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/isLeapYearSpec.js b/Specs/Core/isLeapYearSpec.js index fff595d7a923..04d72e2f4e02 100644 --- a/Specs/Core/isLeapYearSpec.js +++ b/Specs/Core/isLeapYearSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( isLeapYear) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('Check for valid leap years', function() { expect(isLeapYear(2000)).toEqual(true); @@ -33,4 +32,4 @@ defineSuite([ isLeapYear('asd'); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/joinUrlsSpec.js b/Specs/Core/joinUrlsSpec.js index 7d88e9ecba44..dfff47ae7eaa 100644 --- a/Specs/Core/joinUrlsSpec.js +++ b/Specs/Core/joinUrlsSpec.js @@ -6,7 +6,6 @@ defineSuite([ joinUrls, URI) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var queryString = "a=some&b=query"; var fragment = "#iamaframent"; diff --git a/Specs/Core/loadArrayBufferSpec.js b/Specs/Core/loadArrayBufferSpec.js index 2005a3b6a565..42122a786e45 100644 --- a/Specs/Core/loadArrayBufferSpec.js +++ b/Specs/Core/loadArrayBufferSpec.js @@ -6,7 +6,6 @@ defineSuite([ loadArrayBuffer, RequestErrorEvent) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var fakeXHR; @@ -136,4 +135,4 @@ defineSuite([ expect(rejectedError.statusCode).toEqual(404); expect(rejectedError.response).toEqual(error); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/loadBlobSpec.js b/Specs/Core/loadBlobSpec.js index aa6c86781d2d..c17a599942c9 100644 --- a/Specs/Core/loadBlobSpec.js +++ b/Specs/Core/loadBlobSpec.js @@ -6,7 +6,6 @@ defineSuite([ loadBlob, RequestErrorEvent) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var fakeXHR; @@ -136,4 +135,4 @@ defineSuite([ expect(rejectedError.statusCode).toEqual(404); expect(rejectedError.response).toEqual(error); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/loadImageFromTypedArraySpec.js b/Specs/Core/loadImageFromTypedArraySpec.js index c5230bb4bb4b..0826912fbb94 100644 --- a/Specs/Core/loadImageFromTypedArraySpec.js +++ b/Specs/Core/loadImageFromTypedArraySpec.js @@ -10,7 +10,6 @@ defineSuite([ loadArrayBuffer, when) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor,fail*/ it('can load an image', function() { return loadArrayBuffer('./Data/Images/Blue10x10.png').then(function(arrayBuffer) { @@ -41,4 +40,4 @@ defineSuite([ loadImageFromTypedArray(new Uint8Array()); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/loadImageSpec.js b/Specs/Core/loadImageSpec.js index 318801199ab3..ce90229cab71 100644 --- a/Specs/Core/loadImageSpec.js +++ b/Specs/Core/loadImageSpec.js @@ -8,7 +8,6 @@ defineSuite([ defined, when) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var dataUri = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIW2Nk+M/wHwAEBgIA5agATwAAAABJRU5ErkJggg=='; diff --git a/Specs/Core/loadImageViaBlobSpec.js b/Specs/Core/loadImageViaBlobSpec.js index f6b401c834dd..9eebb11236ab 100644 --- a/Specs/Core/loadImageViaBlobSpec.js +++ b/Specs/Core/loadImageViaBlobSpec.js @@ -8,7 +8,6 @@ defineSuite([ defined, when) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var dataUri = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIW2Nk+M/wHwAEBgIA5agATwAAAABJRU5ErkJggg=='; diff --git a/Specs/Core/loadJsonSpec.js b/Specs/Core/loadJsonSpec.js index 78d5409a6e21..5f04b3ba5c81 100644 --- a/Specs/Core/loadJsonSpec.js +++ b/Specs/Core/loadJsonSpec.js @@ -6,7 +6,6 @@ defineSuite([ loadJson, RequestErrorEvent) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var fakeXHR; @@ -140,4 +139,4 @@ defineSuite([ expect(rejectedError.statusCode).toEqual(404); expect(rejectedError.response).toEqual(error); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/loadJsonpSpec.js b/Specs/Core/loadJsonpSpec.js index 8a857d49f418..3c9de15ca54d 100644 --- a/Specs/Core/loadJsonpSpec.js +++ b/Specs/Core/loadJsonpSpec.js @@ -8,7 +8,6 @@ defineSuite([ DefaultProxy, RequestErrorEvent) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('throws with no url', function() { expect(function() { diff --git a/Specs/Core/loadTextSpec.js b/Specs/Core/loadTextSpec.js index dbc921c386f0..ffe8f98281a3 100644 --- a/Specs/Core/loadTextSpec.js +++ b/Specs/Core/loadTextSpec.js @@ -1,3 +1,4 @@ +/* jshint jasmine: true*/ /*global defineSuite*/ defineSuite([ 'Core/loadText', @@ -6,7 +7,6 @@ defineSuite([ loadText, RequestErrorEvent) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var fakeXHR; @@ -136,4 +136,4 @@ defineSuite([ expect(rejectedError.statusCode).toEqual(404); expect(rejectedError.response).toEqual(error); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/loadWithXhrSpec.js b/Specs/Core/loadWithXhrSpec.js index 4e6d93af95cf..3a6ab59e4434 100644 --- a/Specs/Core/loadWithXhrSpec.js +++ b/Specs/Core/loadWithXhrSpec.js @@ -6,7 +6,6 @@ defineSuite([ loadWithXhr, loadImage) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ describe('data URI loading', function() { it('can load URI escaped text with default response type', function() { @@ -134,4 +133,4 @@ defineSuite([ }); }); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/loadXMLSpec.js b/Specs/Core/loadXMLSpec.js index 48b4584920a8..a9ee9467a7e4 100644 --- a/Specs/Core/loadXMLSpec.js +++ b/Specs/Core/loadXMLSpec.js @@ -6,7 +6,6 @@ defineSuite([ loadXML, RequestErrorEvent) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var fakeXHR; @@ -138,4 +137,4 @@ defineSuite([ expect(rejectedError.statusCode).toEqual(404); expect(rejectedError.response).toEqual(error); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/mergeSortSpec.js b/Specs/Core/mergeSortSpec.js index 73a1570574ec..70e16fb363b0 100644 --- a/Specs/Core/mergeSortSpec.js +++ b/Specs/Core/mergeSortSpec.js @@ -8,7 +8,6 @@ defineSuite([ BoundingSphere, Cartesian3) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('sorts', function() { var array = [0, 9, 1, 8, 2, 7, 3, 6, 4, 5]; @@ -58,4 +57,4 @@ defineSuite([ mergeSort([0, 1, 2], undefined); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/objectToQuerySpec.js b/Specs/Core/objectToQuerySpec.js index 9c1f7a916732..43285d666f5a 100644 --- a/Specs/Core/objectToQuerySpec.js +++ b/Specs/Core/objectToQuerySpec.js @@ -6,7 +6,6 @@ defineSuite([ objectToQuery, queryToObject) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('can encode data', function() { var obj = { @@ -56,4 +55,4 @@ defineSuite([ objectToQuery(); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/parseResponseHeadersSpec.js b/Specs/Core/parseResponseHeadersSpec.js index 341b2f77cbd1..3453912a69fe 100644 --- a/Specs/Core/parseResponseHeadersSpec.js +++ b/Specs/Core/parseResponseHeadersSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( parseResponseHeaders) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('returns an empty object literal when given falsy input', function() { expect(parseResponseHeaders()).toEqual({}); @@ -29,4 +28,4 @@ defineSuite([ 'Content-Type': 'text/plain; charset=utf-8' }); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/pointInsideTriangleSpec.js b/Specs/Core/pointInsideTriangleSpec.js index 7d4a4dbbdf87..8e96569b7d5c 100644 --- a/Specs/Core/pointInsideTriangleSpec.js +++ b/Specs/Core/pointInsideTriangleSpec.js @@ -6,7 +6,6 @@ defineSuite([ pointInsideTriangle, Cartesian2) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('pointInsideTriangle has point inside', function() { expect(pointInsideTriangle(new Cartesian2(0.25, 0.25), Cartesian2.ZERO, new Cartesian2(1.0, 0.0), new Cartesian2(0.0, 1.0))).toEqual(true); @@ -55,4 +54,4 @@ defineSuite([ pointInsideTriangle(new Cartesian2(), new Cartesian2(), new Cartesian2()); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/queryToObjectSpec.js b/Specs/Core/queryToObjectSpec.js index 1d2846caa875..154b23b8b4ee 100644 --- a/Specs/Core/queryToObjectSpec.js +++ b/Specs/Core/queryToObjectSpec.js @@ -4,7 +4,6 @@ defineSuite([ ], function( queryToObject) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('can decode data', function() { var str = 'key1=some%20value&key2=a%2Fb'; @@ -49,4 +48,4 @@ defineSuite([ queryToObject(); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/requestAnimationFrameSpec.js b/Specs/Core/requestAnimationFrameSpec.js index 7f284e30ec69..af3534f3b31e 100644 --- a/Specs/Core/requestAnimationFrameSpec.js +++ b/Specs/Core/requestAnimationFrameSpec.js @@ -8,7 +8,6 @@ defineSuite([ cancelAnimationFrame, when) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('calls the callback', function() { var deferred = when.defer(); diff --git a/Specs/Core/sampleTerrainSpec.js b/Specs/Core/sampleTerrainSpec.js index 58e0ae4aca30..b323759f2eaf 100644 --- a/Specs/Core/sampleTerrainSpec.js +++ b/Specs/Core/sampleTerrainSpec.js @@ -10,7 +10,6 @@ defineSuite([ CesiumTerrainProvider, when) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var terrainProvider = new CesiumTerrainProvider({ url : '//assets.agi.com/stk-terrain/world' diff --git a/Specs/Core/subdivideArraySpec.js b/Specs/Core/subdivideArraySpec.js index 07de2f85a2e7..d424c0a3f402 100644 --- a/Specs/Core/subdivideArraySpec.js +++ b/Specs/Core/subdivideArraySpec.js @@ -1,10 +1,9 @@ -/*global defineSuite */ +/*global defineSuite*/ defineSuite([ 'Core/subdivideArray' ], function( subdivideArray) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('Splits evenly divided arrays', function() { var values = [1, 2, 3, 4]; @@ -42,4 +41,4 @@ defineSuite([ subdivideArray([], -1); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/Core/throttleRequestByServerSpec.js b/Specs/Core/throttleRequestByServerSpec.js index a5891b7d3e18..2853bcefddd7 100644 --- a/Specs/Core/throttleRequestByServerSpec.js +++ b/Specs/Core/throttleRequestByServerSpec.js @@ -6,7 +6,6 @@ defineSuite([ throttleRequestByServer, when) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var originalMaximumRequestsPerServer; diff --git a/Specs/Core/writeTextToCanvasSpec.js b/Specs/Core/writeTextToCanvasSpec.js index d703c4bcdc5e..d89ffaa9ac93 100644 --- a/Specs/Core/writeTextToCanvasSpec.js +++ b/Specs/Core/writeTextToCanvasSpec.js @@ -1,4 +1,4 @@ -/*global defineSuite */ +/*global defineSuite*/ defineSuite([ 'Core/writeTextToCanvas', 'Core/Color' @@ -6,7 +6,6 @@ defineSuite([ writeTextToCanvas, Color) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('returns undefined when text is blank', function() { var canvas = writeTextToCanvas(''); @@ -94,4 +93,4 @@ defineSuite([ // canvas2 is stroked, so there should be four "edges" expect(getColorChangeCount(canvas2)).toEqual(4); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/BillboardGraphicsSpec.js b/Specs/DataSources/BillboardGraphicsSpec.js index 78668621865d..8d6f1dc08c27 100644 --- a/Specs/DataSources/BillboardGraphicsSpec.js +++ b/Specs/DataSources/BillboardGraphicsSpec.js @@ -18,7 +18,6 @@ defineSuite([ HorizontalOrigin, VerticalOrigin) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('creates expected instance from raw assignment and construction', function() { var options = { @@ -240,4 +239,4 @@ defineSuite([ target.merge(undefined); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/BillboardVisualizerSpec.js b/Specs/DataSources/BillboardVisualizerSpec.js index bed4d9cf49de..f549a03837b3 100644 --- a/Specs/DataSources/BillboardVisualizerSpec.js +++ b/Specs/DataSources/BillboardVisualizerSpec.js @@ -36,7 +36,6 @@ defineSuite([ createScene, pollToPromise) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var scene; var visualizer; diff --git a/Specs/DataSources/BoxGeometryUpdaterSpec.js b/Specs/DataSources/BoxGeometryUpdaterSpec.js index 9fbde34caf92..540756e54f36 100644 --- a/Specs/DataSources/BoxGeometryUpdaterSpec.js +++ b/Specs/DataSources/BoxGeometryUpdaterSpec.js @@ -42,7 +42,6 @@ defineSuite([ createDynamicProperty, createScene) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var scene; var time; @@ -467,4 +466,4 @@ defineSuite([ createDynamicGeometryBoundingSphereSpecs(BoxGeometryUpdater, entity, entity.box, function() { return scene; }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/BoxGraphicsSpec.js b/Specs/DataSources/BoxGraphicsSpec.js index 132cb85fcbb8..85d71a98b3d2 100644 --- a/Specs/DataSources/BoxGraphicsSpec.js +++ b/Specs/DataSources/BoxGraphicsSpec.js @@ -16,7 +16,6 @@ defineSuite([ testDefinitionChanged, testMaterialDefinitionChanged) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('creates expected instance from raw assignment and construction', function() { var options = { @@ -137,4 +136,4 @@ defineSuite([ testDefinitionChanged(property, 'outlineWidth', 2, 3); testDefinitionChanged(property, 'dimensions', new Cartesian3(0, 0, 0), new Cartesian3(1, 1, 1)); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/CallbackPropertySpec.js b/Specs/DataSources/CallbackPropertySpec.js index ea3f9c542a35..cfcd97872f7a 100644 --- a/Specs/DataSources/CallbackPropertySpec.js +++ b/Specs/DataSources/CallbackPropertySpec.js @@ -8,7 +8,6 @@ defineSuite([ Cartesian3, JulianDate) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var time = JulianDate.now(); @@ -30,7 +29,6 @@ defineSuite([ }); it('isConstant returns correct value', function() { - var result = {}; var property = new CallbackProperty(function() { }, true); expect(property.isConstant).toBe(true); @@ -78,4 +76,4 @@ defineSuite([ }, true); expect(left.equals(right)).toEqual(false); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/CheckerboardMaterialPropertySpec.js b/Specs/DataSources/CheckerboardMaterialPropertySpec.js index 651e4cba9cb3..b9e31c4866b1 100644 --- a/Specs/DataSources/CheckerboardMaterialPropertySpec.js +++ b/Specs/DataSources/CheckerboardMaterialPropertySpec.js @@ -18,7 +18,6 @@ defineSuite([ TimeIntervalCollectionProperty, testDefinitionChanged) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor provides the expected defaults', function() { var property = new CheckerboardMaterialProperty(); @@ -147,4 +146,4 @@ defineSuite([ testDefinitionChanged(property, 'oddColor', Color.RED, Color.BLUE); testDefinitionChanged(property, 'repeat', new Cartesian2(5, 5), new Cartesian2(7, 7)); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/ColorMaterialPropertySpec.js b/Specs/DataSources/ColorMaterialPropertySpec.js index 84582db6b8fe..640670f471f6 100644 --- a/Specs/DataSources/ColorMaterialPropertySpec.js +++ b/Specs/DataSources/ColorMaterialPropertySpec.js @@ -14,7 +14,6 @@ defineSuite([ ConstantProperty, TimeIntervalCollectionProperty) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor provides the expected defaults', function() { var property = new ColorMaterialProperty(); @@ -102,4 +101,4 @@ defineSuite([ property.color = property.color; expect(listener.calls.count()).toEqual(0); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/CompositeEntityCollectionSpec.js b/Specs/DataSources/CompositeEntityCollectionSpec.js index 43974ef38c8b..3bc417a7aed2 100644 --- a/Specs/DataSources/CompositeEntityCollectionSpec.js +++ b/Specs/DataSources/CompositeEntityCollectionSpec.js @@ -24,7 +24,6 @@ defineSuite([ Entity, EntityCollection) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var CollectionListener = function() { this.timesCalled = 0; diff --git a/Specs/DataSources/CompositeMaterialPropertySpec.js b/Specs/DataSources/CompositeMaterialPropertySpec.js index 028b8960a754..ef594604124e 100644 --- a/Specs/DataSources/CompositeMaterialPropertySpec.js +++ b/Specs/DataSources/CompositeMaterialPropertySpec.js @@ -16,7 +16,6 @@ defineSuite([ ColorMaterialProperty, GridMaterialProperty) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('default constructor has expected values', function() { var property = new CompositeMaterialProperty(); @@ -186,4 +185,4 @@ defineSuite([ property.getType(undefined); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/CompositePositionPropertySpec.js b/Specs/DataSources/CompositePositionPropertySpec.js index c2b9922d62fd..b1116a9cdb32 100644 --- a/Specs/DataSources/CompositePositionPropertySpec.js +++ b/Specs/DataSources/CompositePositionPropertySpec.js @@ -18,7 +18,6 @@ defineSuite([ ConstantPositionProperty, PositionProperty) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('default constructor has expected values', function() { var property = new CompositePositionProperty(); @@ -303,4 +302,4 @@ defineSuite([ interval1.data.setValue(new Cartesian3()); expect(listener.calls.count()).toBe(2); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/CompositePropertySpec.js b/Specs/DataSources/CompositePropertySpec.js index e5b5b95c8856..a81e48088b2f 100644 --- a/Specs/DataSources/CompositePropertySpec.js +++ b/Specs/DataSources/CompositePropertySpec.js @@ -14,7 +14,6 @@ defineSuite([ TimeIntervalCollection, ConstantProperty) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('default constructor has expected values', function() { var property = new CompositeProperty(); @@ -173,4 +172,4 @@ defineSuite([ property.getValue(undefined); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/ConstantPositionPropertySpec.js b/Specs/DataSources/ConstantPositionPropertySpec.js index 7872e3522a1a..3355e5c878f0 100644 --- a/Specs/DataSources/ConstantPositionPropertySpec.js +++ b/Specs/DataSources/ConstantPositionPropertySpec.js @@ -12,7 +12,6 @@ defineSuite([ ReferenceFrame, PositionProperty) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var time = JulianDate.now(); @@ -131,4 +130,4 @@ defineSuite([ property.getValueInReferenceFrame(time, undefined); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/ConstantPropertySpec.js b/Specs/DataSources/ConstantPropertySpec.js index 9db8d28af527..c1e635bce581 100644 --- a/Specs/DataSources/ConstantPropertySpec.js +++ b/Specs/DataSources/ConstantPropertySpec.js @@ -8,7 +8,6 @@ defineSuite([ Cartesian3, JulianDate) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var time = JulianDate.now(); @@ -97,4 +96,4 @@ defineSuite([ right = new ConstantProperty(2); expect(left.equals(right)).toEqual(false); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/CorridorGeometryUpdaterSpec.js b/Specs/DataSources/CorridorGeometryUpdaterSpec.js index df8c92d256bb..dd56757993c6 100644 --- a/Specs/DataSources/CorridorGeometryUpdaterSpec.js +++ b/Specs/DataSources/CorridorGeometryUpdaterSpec.js @@ -46,7 +46,6 @@ defineSuite([ createDynamicProperty, createScene) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var scene; var time; @@ -550,4 +549,4 @@ defineSuite([ createDynamicGeometryBoundingSphereSpecs(CorridorGeometryUpdater, entity, entity.corridor, function() { return scene; }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/CorridorGraphicsSpec.js b/Specs/DataSources/CorridorGraphicsSpec.js index e0bb54f5caf5..712c78f01c60 100644 --- a/Specs/DataSources/CorridorGraphicsSpec.js +++ b/Specs/DataSources/CorridorGraphicsSpec.js @@ -16,7 +16,6 @@ defineSuite([ testDefinitionChanged, testMaterialDefinitionChanged) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('creates expected instance from raw assignment and construction', function() { var options = { @@ -192,4 +191,4 @@ defineSuite([ testDefinitionChanged(property, 'outlineWidth', 2, 3); testDefinitionChanged(property, 'cornerType', CornerType.BEVELED, CornerType.MITERED); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/CustomDataSourceSpec.js b/Specs/DataSources/CustomDataSourceSpec.js index 95f1e1ba5588..6c1d78447230 100644 --- a/Specs/DataSources/CustomDataSourceSpec.js +++ b/Specs/DataSources/CustomDataSourceSpec.js @@ -10,7 +10,6 @@ defineSuite([ DataSourceClock, EntityCollection) { "use strict"; - /*global jasmine,it,expect*/ it('constructor has expected defaults', function() { var dataSource = new CustomDataSource(); @@ -70,4 +69,4 @@ defineSuite([ expect(entityCollection.owner).toEqual(dataSource); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/CylinderGeometryUpdaterSpec.js b/Specs/DataSources/CylinderGeometryUpdaterSpec.js index ad483a15b766..d5c1b9881546 100644 --- a/Specs/DataSources/CylinderGeometryUpdaterSpec.js +++ b/Specs/DataSources/CylinderGeometryUpdaterSpec.js @@ -46,7 +46,6 @@ defineSuite([ createDynamicProperty, createScene) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var scene; var time; @@ -541,4 +540,4 @@ defineSuite([ createDynamicGeometryBoundingSphereSpecs(CylinderGeometryUpdater, entity, entity.cylinder, function() { return scene; }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/CylinderGraphicsSpec.js b/Specs/DataSources/CylinderGraphicsSpec.js index c3de9a70c274..95bac8303565 100644 --- a/Specs/DataSources/CylinderGraphicsSpec.js +++ b/Specs/DataSources/CylinderGraphicsSpec.js @@ -14,7 +14,6 @@ defineSuite([ testDefinitionChanged, testMaterialDefinitionChanged) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('creates expected instance from raw assignment and construction', function() { var options = { @@ -171,4 +170,4 @@ defineSuite([ testDefinitionChanged(property, 'outlineColor', Color.RED, Color.BLUE); testDefinitionChanged(property, 'outlineWidth', 2, 3); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/CzmlDataSourceSpec.js b/Specs/DataSources/CzmlDataSourceSpec.js index cf44481f5ebd..eb8b681d76e9 100644 --- a/Specs/DataSources/CzmlDataSourceSpec.js +++ b/Specs/DataSources/CzmlDataSourceSpec.js @@ -54,7 +54,6 @@ defineSuite([ pollToPromise, when) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,fail*/ function makePacket(packet) { return [{ @@ -548,7 +547,6 @@ defineSuite([ var dataSource = new CzmlDataSource(); dataSource.load(clockPacket); - var entity = dataSource.entities.values[0]; expect(dataSource.clock).toBeDefined(); expect(dataSource.clock.startTime).toEqual(interval.start); @@ -1908,8 +1906,6 @@ defineSuite([ }); it('Can use interval reference properties for positions', function() { - var time = JulianDate.now(); - var packets = [{ id : 'document', version : '1.0' @@ -1998,7 +1994,6 @@ defineSuite([ }); it('Polyline glow.', function() { - var time = JulianDate.now(); var packet = { id : 'polylineGlow', polyline : { diff --git a/Specs/DataSources/DataSourceClockSpec.js b/Specs/DataSources/DataSourceClockSpec.js index c32368975637..10d6cf4d6841 100644 --- a/Specs/DataSources/DataSourceClockSpec.js +++ b/Specs/DataSources/DataSourceClockSpec.js @@ -10,7 +10,6 @@ defineSuite([ ClockStep, JulianDate) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('merge assigns unassigned properties', function() { var source = new DataSourceClock(); @@ -90,4 +89,4 @@ defineSuite([ target.merge(undefined); }).toThrowDeveloperError(); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/DataSourceCollectionSpec.js b/Specs/DataSources/DataSourceCollectionSpec.js index efc49ba04023..ef0417f3e248 100644 --- a/Specs/DataSources/DataSourceCollectionSpec.js +++ b/Specs/DataSources/DataSourceCollectionSpec.js @@ -8,7 +8,6 @@ defineSuite([ MockDataSource, when) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('contains, get, getLength, and indexOf work', function() { var collection = new DataSourceCollection(); diff --git a/Specs/DataSources/DataSourceDisplaySpec.js b/Specs/DataSources/DataSourceDisplaySpec.js index abc290ea7962..3e769bc7190c 100644 --- a/Specs/DataSources/DataSourceDisplaySpec.js +++ b/Specs/DataSources/DataSourceDisplaySpec.js @@ -20,7 +20,6 @@ defineSuite([ createScene, MockDataSource) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var dataSourceCollection; var scene; @@ -206,7 +205,6 @@ defineSuite([ dataSourceCollection : dataSourceCollection, scene : scene }); - var entity = new Entity(); var result = new BoundingSphere(); expect(function() { display.getBoundingSphere(undefined, false, result); diff --git a/Specs/DataSources/EllipseGeometryUpdaterSpec.js b/Specs/DataSources/EllipseGeometryUpdaterSpec.js index 873d4df400e2..a580ee33e1cb 100644 --- a/Specs/DataSources/EllipseGeometryUpdaterSpec.js +++ b/Specs/DataSources/EllipseGeometryUpdaterSpec.js @@ -44,7 +44,6 @@ defineSuite([ createDynamicProperty, createScene) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var scene; var time; @@ -593,4 +592,4 @@ defineSuite([ createDynamicGeometryBoundingSphereSpecs(EllipseGeometryUpdater, entity, entity.ellipse, function() { return scene; }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/EllipseGraphicsSpec.js b/Specs/DataSources/EllipseGraphicsSpec.js index 39c20445fc42..99c242b1d11e 100644 --- a/Specs/DataSources/EllipseGraphicsSpec.js +++ b/Specs/DataSources/EllipseGraphicsSpec.js @@ -14,7 +14,6 @@ defineSuite([ testDefinitionChanged, testMaterialDefinitionChanged) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('creates expected instance from raw assignment and construction', function() { var options = { @@ -212,4 +211,4 @@ defineSuite([ testDefinitionChanged(property, 'outlineWidth', 2, 3); testDefinitionChanged(property, 'numberOfVerticalLines', 16, 32); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/EllipsoidGeometryUpdaterSpec.js b/Specs/DataSources/EllipsoidGeometryUpdaterSpec.js index ecc199402fe6..f62f4f8432ec 100644 --- a/Specs/DataSources/EllipsoidGeometryUpdaterSpec.js +++ b/Specs/DataSources/EllipsoidGeometryUpdaterSpec.js @@ -46,7 +46,6 @@ defineSuite([ createDynamicProperty, createScene) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var time = JulianDate.now(); var scene; @@ -595,4 +594,4 @@ defineSuite([ createDynamicGeometryBoundingSphereSpecs(EllipsoidGeometryUpdater, entity, entity.ellipsoid, function() { return scene; }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/EllipsoidGraphicsSpec.js b/Specs/DataSources/EllipsoidGraphicsSpec.js index 568f1c404cdf..3863849ae91f 100644 --- a/Specs/DataSources/EllipsoidGraphicsSpec.js +++ b/Specs/DataSources/EllipsoidGraphicsSpec.js @@ -16,7 +16,6 @@ defineSuite([ testDefinitionChanged, testMaterialDefinitionChanged) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('creates expected instance from raw assignment and construction', function() { var options = { @@ -167,4 +166,4 @@ defineSuite([ testDefinitionChanged(property, 'outlineColor', Color.RED, Color.BLUE); testDefinitionChanged(property, 'outlineWidth', 2, 3); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/EntityCollectionSpec.js b/Specs/DataSources/EntityCollectionSpec.js index 9f9640e0f09c..e1991f341164 100644 --- a/Specs/DataSources/EntityCollectionSpec.js +++ b/Specs/DataSources/EntityCollectionSpec.js @@ -14,7 +14,6 @@ defineSuite([ TimeIntervalCollection, Entity) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var CollectionListener = function() { this.timesCalled = 0; diff --git a/Specs/DataSources/EntitySpec.js b/Specs/DataSources/EntitySpec.js index 35b34c13d103..e3d61de4dd12 100644 --- a/Specs/DataSources/EntitySpec.js +++ b/Specs/DataSources/EntitySpec.js @@ -54,7 +54,6 @@ defineSuite([ RectangleGraphics, WallGraphics) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor sets expected properties.', function() { var entity = new Entity(); @@ -224,8 +223,6 @@ defineSuite([ source.addProperty(propertyName); source[propertyName] = value; - var listener = jasmine.createSpy('listener'); - var target = new Entity({ id : 'target' }); @@ -479,4 +476,4 @@ defineSuite([ expect(listener.calls.argsFor(0)).toEqual([entity, 'isShowing', true, false]); expect(entity.isShowing).toBe(true); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/EntityViewSpec.js b/Specs/DataSources/EntityViewSpec.js index b3500145badd..779be1345ecd 100644 --- a/Specs/DataSources/EntityViewSpec.js +++ b/Specs/DataSources/EntityViewSpec.js @@ -18,7 +18,6 @@ defineSuite([ Entity, createScene) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var scene; var defaultOffset = EntityView.defaultOffset3D; diff --git a/Specs/DataSources/GeoJsonDataSourceSpec.js b/Specs/DataSources/GeoJsonDataSourceSpec.js index e0f55dfb7346..86d4f493c58e 100644 --- a/Specs/DataSources/GeoJsonDataSourceSpec.js +++ b/Specs/DataSources/GeoJsonDataSourceSpec.js @@ -22,7 +22,6 @@ defineSuite([ EntityCollection, when) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,fail*/ var defaultMarkerSize; var defaultSymbol; diff --git a/Specs/DataSources/GeometryVisualizerSpec.js b/Specs/DataSources/GeometryVisualizerSpec.js index 2b884ed42028..b92c5cdc5a47 100644 --- a/Specs/DataSources/GeometryVisualizerSpec.js +++ b/Specs/DataSources/GeometryVisualizerSpec.js @@ -44,7 +44,6 @@ defineSuite([ createScene, pollToPromise) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ var time = JulianDate.now(); diff --git a/Specs/DataSources/GridMaterialPropertySpec.js b/Specs/DataSources/GridMaterialPropertySpec.js index 271778b0a456..2bbde794525b 100644 --- a/Specs/DataSources/GridMaterialPropertySpec.js +++ b/Specs/DataSources/GridMaterialPropertySpec.js @@ -18,7 +18,6 @@ defineSuite([ SampledProperty, TimeIntervalCollectionProperty) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor provides the expected defaults', function() { var property = new GridMaterialProperty(); @@ -284,4 +283,4 @@ defineSuite([ property.lineOffset.addSample(JulianDate.now(), 1); expect(property.isConstant).toBe(false); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/ImageMaterialPropertySpec.js b/Specs/DataSources/ImageMaterialPropertySpec.js index db1407e5377a..cbcd08334f95 100644 --- a/Specs/DataSources/ImageMaterialPropertySpec.js +++ b/Specs/DataSources/ImageMaterialPropertySpec.js @@ -14,7 +14,6 @@ defineSuite([ ConstantProperty, TimeIntervalCollectionProperty) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn*/ it('constructor provides the expected defaults', function() { var property = new ImageMaterialProperty(); @@ -165,4 +164,4 @@ defineSuite([ })); expect(property.isConstant).toBe(false); }); -}); \ No newline at end of file +}); diff --git a/Specs/DataSources/KmlDataSourceSpec.js b/Specs/DataSources/KmlDataSourceSpec.js index 5dae4a3bffd7..2343f35c9cc2 100644 --- a/Specs/DataSources/KmlDataSourceSpec.js +++ b/Specs/DataSources/KmlDataSourceSpec.js @@ -46,7 +46,6 @@ defineSuite([ HorizontalOrigin, LabelStyle) { "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs*/ var parser = new DOMParser(); @@ -89,7 +88,6 @@ defineSuite([ var uberIconColor = Color.fromBytes(0xdd, 0xdd, 0xdd, 0xdd); var uberIconScale = 3; var uberIconHeading = CesiumMath.toRadians(-45); - var uberIcon = 'test.png'; var uberIconHotspot = new Cartesian2(45, -46); var uberLabelColor = Color.fromBytes(0xee, 0xee, 0xee, 0xee); @@ -458,9 +456,6 @@ defineSuite([ }); it('Feature: TimeSpan gracefully handles empty fields', function() { - var endDate = JulianDate.fromIso8601('1945-08-06'); - var beginDate = JulianDate.fromIso8601('1941-12-07'); - var kml = '\ \ \ @@ -1899,7 +1894,6 @@ defineSuite([ }); it('PolyStyle: Sets fill', function() { - var color = Color.fromBytes(0xcc, 0xdd, 0xee, 0xff); var kml = '\ \ +
+

Loading...

+
+
+
+ + + \ No newline at end of file diff --git a/Apps/Sandcastle/gallery/Terrain Exaggeration.jpg b/Apps/Sandcastle/gallery/Terrain Exaggeration.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b553cda9190717eaf3880e9e9c83941b3fdb73cc GIT binary patch literal 21676 zcmbUIbyS;A)CP(ME3U=ep}1Rtlv2DvafjmW#RCCaptwVewnbW?Kyh~n4#jEEAfrp4s!b{J04q(^S<^1z=!c0N$d1fJYcW zKqc7K2>{U62Jis@06g?JQ2-|TjR2kL(HWrT=jiC=@8bOq@VEj{24G@f{P+AH2@417 zzw`tf8w&^b2`=t`84sTj9}kZJ4;Pn!n1Fzg2%T{8Nl1x_Nd9~Ouaf`7|C2&LM0mJ( z|CRW^mmYfomq6;*U zp_`9|g^6w~4mLKrbU6Au0Gk|#f=yKE$x}UBTy|edv8eQ~cpNY5`l$40;GE)ie$n^@ z)HJko^jzFLywCU~B&DQfWaX4!si>-{YiJr68X23Inwi@>I667IxVrhj3kVDf4hen# zAtpBNV|+qJW>$7i?x)Xr-%3i$%D?}psH|^jY-(<4ZENoz7#xBOkBpAZ&do0@E-n9o z!nU?|cK`1E+dnuvzqq`*zCqmH{f7$!fc3wy{!e88U%1H8xG>RufQ|bfE)2{dbjBjb z#$gkELZPIGYwP=zT`UTZ@@4whx;}gkaeX+Io!<-rHKzoO>+C;h|AXxRKVZ@SkC6SJ z!2T~>Pyi7Y2DRt4=@;U&+$8mY^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izedTerrainMesh.js index 116073429c0f..c26759561c14 100644 --- a/Source/Workers/createVerticesFromQuantizedTerrainMesh.js +++ b/Source/Workers/createVerticesFromQuantizedTerrainMesh.js @@ -44,6 +44,9 @@ define([ var cartesian3Scratch = new Cartesian3(); var cartographicScratch = new Cartographic(); var toPack = new Cartesian2(); + var scratchNormal = new Cartesian3(); + var scratchToENU = new Matrix4(); + var scratchFromENU = new Matrix4(); function createVerticesFromQuantizedTerrainMesh(parameters, transferableObjects) { var quantizedVertices = parameters.quantizedVertices; @@ -101,9 +104,9 @@ define([ toPack.y = octEncodedNormals[n + 1]; if (exaggeration !== 1.0) { - var normal = AttributeCompression.octDecode(toPack.x, toPack.y, new Cartesian3()); - var fromENU = Transforms.eastNorthUpToFixedFrame(cartesian3Scratch); - var toENU = Matrix4.inverseTransformation(fromENU, new Matrix4()); + var normal = AttributeCompression.octDecode(toPack.x, toPack.y, scratchNormal); + var fromENU = Transforms.eastNorthUpToFixedFrame(cartesian3Scratch, ellipsoid, scratchFromENU); + var toENU = Matrix4.inverseTransformation(fromENU, scratchToENU); Matrix4.multiplyByPointAsVector(toENU, normal, normal); normal.z *= exaggeration; From c911e60a31fed5db0aa1a6086ddb3609b3987922 Mon Sep 17 00:00:00 2001 From: Patrick Cozzi Date: Mon, 16 Nov 2015 13:09:37 -0500 Subject: [PATCH 50/59] Added Sarah Chow to CONTRIBUTORS.md --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index f63543bad9be..6561b7005a3e 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -27,6 +27,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu * [Sean Lilley](https://github.com/lilleyse) * [Katherina Lim](https://github.com/klim705) * [Gabrielle Getz](https://github.com/ggetz) + * [Sarah Chow](https://github.com/slchow) * [NICTA](http://www.nicta.com.au/) * [Chris Cooper](https://github.com/chris-cooper) * [Kevin Ring](https://github.com/kring) From d1aa6fbc2b184df0c2c47907998d05d53ca7d506 Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Mon, 16 Nov 2015 14:04:07 -0500 Subject: [PATCH 51/59] Ability to adjust image material translucency Fixes #2484 1. Adds alpha uniform to material `Image` types, defualts to 1.0. 2. Exposes uniform in `ImageMaterialProperty.alpha` --- CHANGES.md | 1 + Source/DataSources/ImageMaterialProperty.js | 15 ++++++++++++++- Source/Scene/Material.js | 9 ++++++--- Specs/DataSources/ImageMaterialPropertySpec.js | 6 +++++- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index e6343dbd37e7..8527f586352d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,6 +21,7 @@ Change Log * Added support for incrementally loading textures after a Model is ready. This allows the Model to be visible as soon as possible while its textures are loaded in the background. * Added `Cartographic.fromCartesian` function. * Added `Camera.getPixelSize` function to get the size of a pixel in meters based on the current view. +* Added `ImageMaterialProperty.alpha` and a `alpha` uniform to `Image` `Material` types to control overall image opacity. It defaults to 1.0, fully opaque. ### 1.15 - 2015-11-02 diff --git a/Source/DataSources/ImageMaterialProperty.js b/Source/DataSources/ImageMaterialProperty.js index 81edbe839d3e..2e6c5698d7d6 100644 --- a/Source/DataSources/ImageMaterialProperty.js +++ b/Source/DataSources/ImageMaterialProperty.js @@ -18,6 +18,7 @@ define([ "use strict"; var defaultRepeat = new Cartesian2(1, 1); + var defaultAlpha = 1.0; /** * A {@link MaterialProperty} that maps to image {@link Material} uniforms. @@ -36,9 +37,12 @@ define([ this._imageSubscription = undefined; this._repeat = undefined; this._repeatSubscription = undefined; + this._alpha = undefined; + this._alphaSubscription = undefined; this.image = options.image; this.repeat = options.repeat; + this.alpha = options.alpha; }; defineProperties(ImageMaterialProperty.prototype, { @@ -81,7 +85,14 @@ define([ * @type {Property} * @default new Cartesian2(1, 1) */ - repeat : createPropertyDescriptor('repeat') + repeat : createPropertyDescriptor('repeat'), + /** + * Gets or sets the Number Property specifying the desired opacity of the overall image. + * @memberof ImageMaterialProperty.prototype + * @type {Property} + * @default 1.0 + */ + alpha : createPropertyDescriptor('alpha') }); /** @@ -108,6 +119,7 @@ define([ result.image = Property.getValueOrUndefined(this._image, time); result.repeat = Property.getValueOrClonedDefault(this._repeat, time, defaultRepeat, result.repeat); + result.alpha = Property.getValueOrDefault(this._alpha, time, defaultAlpha); return result; }; @@ -122,6 +134,7 @@ define([ return this === other || // (other instanceof ImageMaterialProperty && // Property.equals(this._image, other._image) && // + Property.equals(this._alpha, other._alpha) && // Property.equals(this._repeat, other._repeat)); }; diff --git a/Source/Scene/Material.js b/Source/Scene/Material.js index f265e8b551e6..d79a4ad4e316 100644 --- a/Source/Scene/Material.js +++ b/Source/Scene/Material.js @@ -998,14 +998,17 @@ define([ type : Material.ImageType, uniforms : { image : Material.DefaultImageId, - repeat : new Cartesian2(1.0, 1.0) + repeat : new Cartesian2(1.0, 1.0), + alpha : 1.0 }, components : { diffuse : 'texture2D(image, fract(repeat * materialInput.st)).rgb', - alpha : 'texture2D(image, fract(repeat * materialInput.st)).a' + alpha : 'texture2D(image, fract(repeat * materialInput.st)).a * alpha' } }, - translucent : true + translucent : function(material) { + return material.uniforms.alpha < 1.0; + } }); /** diff --git a/Specs/DataSources/ImageMaterialPropertySpec.js b/Specs/DataSources/ImageMaterialPropertySpec.js index cbcd08334f95..66683ae3ad4d 100644 --- a/Specs/DataSources/ImageMaterialPropertySpec.js +++ b/Specs/DataSources/ImageMaterialPropertySpec.js @@ -22,20 +22,24 @@ defineSuite([ var result = property.getValue(); expect(result.image).toBeUndefined(); expect(result.repeat).toEqual(new Cartesian2(1.0, 1.0)); + expect(result.alpha).toEqual(1.0); }); it('constructor sets options and allows raw assignment', function() { var options = { image : 'test.invalid', - repeat : new Cartesian2(1, 2) + repeat : new Cartesian2(1, 2), + alpha : 0.5 }; var property = new ImageMaterialProperty(options); expect(property.image).toBeInstanceOf(ConstantProperty); expect(property.repeat).toBeInstanceOf(ConstantProperty); + expect(property.alpha).toBeInstanceOf(ConstantProperty); expect(property.image.getValue()).toEqual(options.image); expect(property.repeat.getValue()).toEqual(options.repeat); + expect(property.alpha.getValue()).toEqual(options.alpha); }); it('works with constant values', function() { From faac4b9c98c29f8986edd5ca239a76fb7bd8b6b4 Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Mon, 16 Nov 2015 14:08:41 -0500 Subject: [PATCH 52/59] Add support for video materials This extends the `Material` object to support `HTMLVideoElement`, similar to how we already support `Canvas`. It also adds similar support to the `Entity` layer, via the `ImageMaterialProperty`. Also added `VideoSynchronizer`. By default, video materials just use the current video frame as the texture, so if you pause, seek, or otherwise change the video, the material is updated to match. `VideoSynchronizer` is a helper class that flips this so that the video time is controlled by the simulation clock, allowing for you to synchronize the video with the rest of your scene. Added a new Sandcastle example using Big Buck Bunny, an open source blender movie project from a few years ago. To avoid bloating the repository and release zip size, movie files are hosted on cesiumjs.org. Browser Support IE will most likely never support video textures, but they are being added to Edge. Chrome and Firefox work great, Safari should work as well. Sound Sound works as expected, even when playing faster or slower than normal. Ultimately it's browser controlled and users determine whether to include sound or not directly on the video element. Our Sandcastle demo has sound. --- Apps/Sandcastle/gallery/Video.html | 119 ++++++++++ Apps/Sandcastle/gallery/Video.jpg | Bin 0 -> 21184 bytes CHANGES.md | 4 + LICENSE.md | 6 + Source/Core/VideoSynchronizer.js | 220 ++++++++++++++++++ Source/DataSources/ImageMaterialProperty.js | 5 +- .../createMaterialPropertyDescriptor.js | 4 +- Source/Renderer/Texture.js | 14 +- Source/Scene/Material.js | 30 +++ Specs/Core/VideoSynchronizerSpec.js | 188 +++++++++++++++ 10 files changed, 584 insertions(+), 6 deletions(-) create mode 100644 Apps/Sandcastle/gallery/Video.html create mode 100644 Apps/Sandcastle/gallery/Video.jpg create mode 100644 Source/Core/VideoSynchronizer.js create mode 100644 Specs/Core/VideoSynchronizerSpec.js diff --git a/Apps/Sandcastle/gallery/Video.html b/Apps/Sandcastle/gallery/Video.html new file mode 100644 index 000000000000..4b39f89fffee --- /dev/null +++ b/Apps/Sandcastle/gallery/Video.html @@ -0,0 +1,119 @@ + + + + + + + + + Cesium Demo + + + + + + + +
+

Loading...

+
+ + + + + diff --git a/Apps/Sandcastle/gallery/Video.jpg b/Apps/Sandcastle/gallery/Video.jpg new file mode 100644 index 0000000000000000000000000000000000000000..dd2b3542beb69d06cb8114eb6261372dde62d3b7 GIT binary patch literal 21184 zcmbTdbyOTr@GrUqS%L<4Nmw9wa0nJ4K?5YX1W9lfTXb=PCAdTI5Zr?zy%z>6nVed7PfgS(*GuOO!WT<3j+fk6Nm)_{>RwQai3#j z<6r}UIQTd?xOh(ld`>`!k4Nxd{=b*}*ZsdWPi2IhYg+B0+vOspr7aB!a*)V_EUA07SKldzZ=7*DNzp6US@ zM3}@cd8M&PK7R$if{^lkkIlwrlBw()7M51lHqI`tZthSI&%mJIkRLxo!{Xu-5|fgDrKJAJ z$<50zC@dzn^@p#jkUFIfKv+5ZC<(G#v`Pji3){0|q}GxsM(C&Ivd$%{oS{TcWbLh_35J2t6I zY<6YGb0&WEW3q2f<2d9Xfi>on|DgR3vj2C$0{(v?`#-?`Z(MKy9y;37Y=gtT6+Nu!#OBK^kQOoOoG5mv~7Hk8e4_aHT!Zjxaf!=lwzxP&1 zTj_G$h4S~r<|^=)^8e{zk6>_j42S|MXw)S5fk=*g!#xISZ!t?B_cb3D6{msjJ}fhigH5e|Ik2*(nr%ZS4GPBC{nZFynQxQ4Uu|H=iI0N zYr>wrx3=<2we{}3$8&HoDorJldJ@srC8m4gZ<=(6j(h~r>lTcxw~>7rjub{>9-msu z){{v7R`uL|5N`oT9}6E;uk(ab`zAvQz{bzb(lmqVIlyJsOpWSGL@^tOWA?R`c@KR? zFXMZJjp$XJ*MOJj)CHFY28u-$Nd^|kwHqWbilR(s`ruH0R;qbOXZ8U!{erWNzLidK z3@}#cr%YtDcI>da1os_;CwI%Cq8|az<%)7qe-;#8K%v5yV43~rX1|8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++^kbD*59W%qeH}DwKHS`O443_gqNl%zEv4{|TvyW;hsrtoB?h>U0 zwmcU~)c!br%byXvMdD8k_}|0&Zo95Zwztxzn-$D*^O1#~7YYZk2EB9Qr@;RJ+7tHi z)BGQ(c;m(B^JXr2Gf$t{{T3KAP+d`2hxfwx7tgU9Py_Ydzrtt2gJXNzqY@D z{5Rpx6UpFhFH7*tM$j&s_MUJ6&ejBE*Mj(uT8qQpC|gOjKM+SHo~b+L)#6lxF>T)v zWh6Q1a&d|%uM3Cq)$8J=?PYsM%ew4w)LI;`_Ne~=pS@H5`%nHRiYTwByD>li*}v5E A6#xJL literal 0 HcmV?d00001 diff --git a/CHANGES.md b/CHANGES.md index 8527f586352d..005d407ef76a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -22,6 +22,10 @@ Change Log * Added `Cartographic.fromCartesian` function. * Added `Camera.getPixelSize` function to get the size of a pixel in meters based on the current view. * Added `ImageMaterialProperty.alpha` and a `alpha` uniform to `Image` `Material` types to control overall image opacity. It defaults to 1.0, fully opaque. +* `ImageMaterialProperty.image` now accepts an `HTMLVideoElement`. You can also assign a video element directly to an Entity `material` property. +* `Material` image uniforms now accept and `HTMLVideoElement` anywhere it could previously take a `Canvas` element. +* Added `VideoSynchronizer` helper object for keeping an `HTMLVideoElement` in sync with a scene's clock. +* Added 'Video' Sandcastle showcase to demonstrate video materials. ### 1.15 - 2015-11-02 diff --git a/LICENSE.md b/LICENSE.md index 879dfec721ef..2c7a465bc96b 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -356,6 +356,12 @@ https://www.mapbox.com/maki/ https://github.com/mapbox/maki +### Big Buck Bunny trailer + +Creative Commons Attribution 3.0 +(c) copyright 2008, Blender Foundation +www.bigbuckbunny.org + ### population909500.json ### https://github.com/dataarts/webgl-globe diff --git a/Source/Core/VideoSynchronizer.js b/Source/Core/VideoSynchronizer.js new file mode 100644 index 000000000000..4570cae1ed68 --- /dev/null +++ b/Source/Core/VideoSynchronizer.js @@ -0,0 +1,220 @@ +/*global define*/ +define([ + './defaultValue', + './defined', + './defineProperties', + './destroyObject', + './DeveloperError', + './Event', + './Iso8601', + './JulianDate' + ], function( + defaultValue, + defined, + defineProperties, + destroyObject, + DeveloperError, + Event, + Iso8601, + JulianDate) { + "use strict"; + + /** + * Synchronizes a video element with a simulation clock. + * + * @alias VideoSynchronizer + * @constructor + * + * @param {Object} [options] Object with the following properties: + * @param {Clock} [options.clock] The clock instance used to drive the video. + * @param {HTMLVideoElement} [options.element] The video element to be synchronized. + * @param {JulianDate} [options.epoch=Iso8601.MINIMUM_VALUE] The simulation time that marks the start of the video. + * @param {Number} [options.tolerance=1.0] The maximum amount of time, in seconds, that the clock and video can diverge. + * + * @demo {@link http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Video.html|Video Material Demo} + */ + var VideoSynchronizer = function(options) { + options = defaultValue(options, defaultValue.EMPTY_OBJECT); + + this._clock = undefined; + this._element = undefined; + this._clockSubscription = undefined; + this._seekFunction = undefined; + + this.clock = options.clock; + this.element = options.element; + + /** + * Gets or sets the simulation time that marks the start of the video. + * @type {JulianDate} + * @default Iso8601.MINIMUM_VALUE + */ + this.epoch = defaultValue(options.epoch, Iso8601.MINIMUM_VALUE); + + /** + * Gets or sets the amount of time in seconds the video's currentTime + * and the clock's currentTime can diverge before a video seek is performed. + * Lower values make the synchronization more accurate but video + * performance might suffer. Higher values provide better performance + * but at the cost of accuracy. + * @type {Number} + * @default 1.0 + */ + this.tolerance = defaultValue(options.tolerance, 1.0); + + this._seeking = false; + this._seekFunction = undefined; + this._firstTickAfterSeek = false; + }; + + defineProperties(VideoSynchronizer.prototype, { + /** + * Gets or sets the clock used to drive the video element. + * + * @memberof VideoSynchronizer.prototype + * @type {Clock} + */ + clock : { + get : function() { + return this._clock; + }, + set : function(value) { + var oldValue = this._clock; + + if (oldValue === value) { + return; + } + + if (defined(oldValue)) { + this._clockSubscription(); + this._clockSubscription = undefined; + } + + if (defined(value)) { + this._clockSubscription = value.onTick.addEventListener(VideoSynchronizer.prototype._onTick, this); + } + + this._clock = value; + } + }, + /** + * Gets or sets the video element to synchronize. + * + * @memberof VideoSynchronizer.prototype + * @type {HTMLVideoElement} + */ + element : { + get : function() { + return this._element; + }, + set : function(value) { + var oldValue = this._element; + + if (oldValue === value) { + return; + } + + if (defined(oldValue)) { + oldValue.removeEventListener("seeked", this._seekFunction, false); + } + + if (defined(value)) { + this._seeking = false; + this._seekFunction = createSeekFunction(this); + value.addEventListener("seeked", this._seekFunction, false); + } + + this._element = value; + this._seeking = false; + this._firstTickAfterSeek = false; + } + } + }); + + /** + * Destroys and resources used by the object. Once an object is destroyed, it should not be used. + * + * @exception {DeveloperError} This object was destroyed, i.e., destroy() was called. + */ + VideoSynchronizer.prototype.destroy = function() { + this.element = undefined; + this.clock = undefined; + return destroyObject(this); + }; + + /** + * Returns true if this object was destroyed; otherwise, false. + * + * @returns {Boolean} True if this object was destroyed; otherwise, false. + */ + VideoSynchronizer.prototype.isDestroyed = function() { + return false; + }; + + VideoSynchronizer.prototype._onTick = function(clock) { + var element = this._element; + if (!defined(element) || element.readyState < 2) { + return; + } + + var paused = element.paused; + var shouldAnimate = clock.shouldAnimate; + if (shouldAnimate === paused) { + if (shouldAnimate) { + element.play(); + } else { + element.pause(); + } + } + + //We need to avoid constant seeking or the video will + //never contain a complete frame for us to render. + //So don't do anything if we're seeing or on the first + //tick after a seek (the latter of which allows the frame + //to actually be rendered. + if (this._seeking || this._firstTickAfterSeek) { + this._firstTickAfterSeek = false; + return; + } + + element.playbackRate = clock.multiplier; + + var clockTime = clock.currentTime; + var epoch = defaultValue(this.epoch, Iso8601.MINIMUM_VALUE); + var videoTime = JulianDate.secondsDifference(clockTime, epoch); + + var duration = element.duration; + var desiredTime; + var currentTime = element.currentTime; + if (element.loop) { + videoTime = videoTime % duration; + if (videoTime < 0.0) { + videoTime = duration - videoTime; + } + desiredTime = videoTime; + } else if (videoTime > duration) { + desiredTime = duration; + } else if (videoTime < 0.0) { + desiredTime = 0.0; + } else { + desiredTime = videoTime; + } + + //If the playing video's time and the scene's clock time + //ever drift too far apart, we want to set the video to match + var tolerance = shouldAnimate ? defaultValue(this.tolerance, 1.0) : 0.001; + if (Math.abs(desiredTime - currentTime) > tolerance) { + this._seeking = true; + element.currentTime = desiredTime; + } + }; + + function createSeekFunction(that) { + return function() { + that._seeking = false; + that._firstTickAfterSeek = true; + }; + } + + return VideoSynchronizer; +}); diff --git a/Source/DataSources/ImageMaterialProperty.js b/Source/DataSources/ImageMaterialProperty.js index 2e6c5698d7d6..57859f8d7fa9 100644 --- a/Source/DataSources/ImageMaterialProperty.js +++ b/Source/DataSources/ImageMaterialProperty.js @@ -26,7 +26,7 @@ define([ * @constructor * * @param {Object} [options] Object with the following properties: - * @param {Property} [options.image] A Property specifying the Image, URL, or Canvas. + * @param {Property} [options.image] A Property specifying the Image, URL, Canvas, or Video. * @param {Property} [options.repeat=new Cartesian2(1.0, 1.0)] A {@link Cartesian2} Property specifying the number of times the image repeats in each direction. */ var ImageMaterialProperty = function(options) { @@ -74,7 +74,7 @@ define([ } }, /** - * Gets or sets the Property specifying Image, URL, or Canvas. + * Gets or sets the Property specifying Image, URL, Canvas, or Video to use. * @memberof ImageMaterialProperty.prototype * @type {Property} */ @@ -120,6 +120,7 @@ define([ result.image = Property.getValueOrUndefined(this._image, time); result.repeat = Property.getValueOrClonedDefault(this._repeat, time, defaultRepeat, result.repeat); result.alpha = Property.getValueOrDefault(this._alpha, time, defaultAlpha); + return result; }; diff --git a/Source/DataSources/createMaterialPropertyDescriptor.js b/Source/DataSources/createMaterialPropertyDescriptor.js index e83658b19929..8cc018e6b860 100644 --- a/Source/DataSources/createMaterialPropertyDescriptor.js +++ b/Source/DataSources/createMaterialPropertyDescriptor.js @@ -18,7 +18,7 @@ define([ return new ColorMaterialProperty(value); } - if (typeof value === 'string' || value instanceof HTMLCanvasElement) { + if (typeof value === 'string' || value instanceof HTMLCanvasElement || value instanceof HTMLVideoElement) { var result = new ImageMaterialProperty(); result.image = value; return result; @@ -37,4 +37,4 @@ define([ } return createMaterialPropertyDescriptor; -}); \ No newline at end of file +}); diff --git a/Source/Renderer/Texture.js b/Source/Renderer/Texture.js index 531e646e7435..275e6d5857e0 100644 --- a/Source/Renderer/Texture.js +++ b/Source/Renderer/Texture.js @@ -45,9 +45,19 @@ define([ //>>includeEnd('debug'); var context = options.context; + var width = options.width; + var height = options.height; var source = options.source; - var width = defined(source) ? source.width : options.width; - var height = defined(source) ? source.height : options.height; + + if (defined(source)) { + if (!defined(width)) { + width = defaultValue(source.videoWidth, source.width); + } + if (!defined(height)) { + height = defaultValue(source.videoHeight, source.height); + } + } + var pixelFormat = defaultValue(options.pixelFormat, PixelFormat.RGBA); var pixelDatatype = defaultValue(options.pixelDatatype, PixelDatatype.UNSIGNED_BYTE); var internalFormat = pixelFormat; diff --git a/Source/Scene/Material.js b/Source/Scene/Material.js index d79a4ad4e316..898f92aa7c7c 100644 --- a/Source/Scene/Material.js +++ b/Source/Scene/Material.js @@ -657,14 +657,44 @@ define([ }; function createTexture2DUpdateFunction(uniformId) { + var oldUniformValue; return function(material, context) { var uniforms = material.uniforms; var uniformValue = uniforms[uniformId]; + var uniformChanged = oldUniformValue !== uniformValue; + oldUniformValue = uniformValue; var texture = material._textures[uniformId]; var uniformDimensionsName; var uniformDimensions; + if (uniformValue instanceof HTMLVideoElement) { + // HTMLVideoElement.readyState >=2 means we have enough data for the current frame. + // See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState + if (uniformValue.readyState >= 2) { + if (uniformChanged && defined(texture)) { + if (texture !== context.defaultTexture) { + texture.destroy(); + } + texture = undefined; + } + + if (!defined(texture) || texture === context.defaultTexture) { + texture = new Texture({ + context : context, + source : uniformValue + }); + material._textures[uniformId] = texture; + return; + } + + texture.copyFrom(uniformValue); + } else if (!defined(texture)) { + material._textures[uniformId] = context.defaultTexture; + } + return; + } + if (uniformValue instanceof Texture && uniformValue !== texture) { material._texturePaths[uniformId] = undefined; var tmp = material._textures[uniformId]; diff --git a/Specs/Core/VideoSynchronizerSpec.js b/Specs/Core/VideoSynchronizerSpec.js new file mode 100644 index 000000000000..3ff98bf6ba43 --- /dev/null +++ b/Specs/Core/VideoSynchronizerSpec.js @@ -0,0 +1,188 @@ +/*global defineSuite*/ +defineSuite([ + 'Core/VideoSynchronizer', + 'Core/Clock', + 'Core/FeatureDetection', + 'Core/Iso8601', + 'Core/JulianDate', + 'Core/Math', + 'Specs/pollToPromise' + ], function( + VideoSynchronizer, + Clock, + FeatureDetection, + Iso8601, + JulianDate, + CesiumMath, + pollToPromise) { + "use strict"; + + //Video textures do not work on Internet Explorer + if (FeatureDetection.isInternetExplorer()) { + return; + } + + function loadVideo() { + var element = document.createElement('video'); + var source = document.createElement('source'); + source.setAttribute('src', 'http://cesiumjs.org/videos/Sandcastle/big-buck-bunny_trailer.webm'); + source.setAttribute('type', 'video/webm'); + element.appendChild(source); + + source = document.createElement('source'); + source.setAttribute('src', 'http://cesiumjs.org/videos/Sandcastle/big-buck-bunny_trailer.mp4'); + source.setAttribute('type', 'video/mp4'); + element.appendChild(source); + + source = document.createElement('source'); + source.setAttribute('src', 'http://cesiumjs.org/videos/Sandcastle/big-buck-bunny_trailer.mov'); + source.setAttribute('type', 'video/quicktime'); + element.appendChild(source); + + return element; + } + + it('Can default construct', function() { + var videoSynchronizer = new VideoSynchronizer(); + + expect(videoSynchronizer.clock).not.toBeDefined(); + expect(videoSynchronizer.element).not.toBeDefined(); + expect(videoSynchronizer.epoch).toBe(Iso8601.MINIMUM_VALUE); + expect(videoSynchronizer.tolerance).toBe(1.0); + expect(videoSynchronizer.isDestroyed()).toBe(false); + expect(videoSynchronizer.destroy()).not.toBeDefined(); + expect(videoSynchronizer.isDestroyed()).toBe(true); + }); + + it('Can construct with options', function() { + var clock = new Clock(); + var element = document.createElement('video'); + var epoch = new JulianDate(); + var tolerance = 0.15; + + var videoSynchronizer = new VideoSynchronizer({ + clock : clock, + element : element, + epoch : epoch, + tolerance: tolerance + }); + + expect(videoSynchronizer.clock).toBe(clock); + expect(videoSynchronizer.element).toBe(element); + expect(videoSynchronizer.epoch).toBe(epoch); + expect(videoSynchronizer.tolerance).toBe(tolerance); + expect(videoSynchronizer.isDestroyed()).toBe(false); + expect(videoSynchronizer.destroy()).not.toBeDefined(); + expect(videoSynchronizer.isDestroyed()).toBe(true); + }); + + it('Syncs time when looping', function() { + var epoch = JulianDate.fromIso8601('2015-11-01T00:00:00Z'); + var clock = new Clock(); + clock.shouldAnimate = false; + clock.currentTime = epoch.clone(); + + var element = loadVideo(); + element.loop = true; + + var videoSynchronizer = new VideoSynchronizer({ + clock : clock, + element : element, + epoch : epoch + }); + + return pollToPromise(function() { + clock.tick(); + return element.currentTime === 0; + }).then(function() { + clock.currentTime = JulianDate.addSeconds(epoch, 10, clock.currentTime); + return pollToPromise(function() { + clock.tick(); + return element.currentTime === 10; + }); + }).then(function() { + clock.currentTime = JulianDate.addSeconds(epoch, 60, clock.currentTime); + return pollToPromise(function() { + clock.tick(); + return CesiumMath.equalsEpsilon(element.currentTime, 60 - element.duration, CesiumMath.EPSILON3); + }); + }).then(function() { + clock.currentTime = JulianDate.addSeconds(epoch, -1, clock.currentTime); + return pollToPromise(function() { + clock.tick(); + return CesiumMath.equalsEpsilon(element.currentTime, element.duration - 1, CesiumMath.EPSILON1); + }); + }).then(function() { + videoSynchronizer.destroy(); + }); + }); + + it('Syncs time when not looping', function() { + var epoch = JulianDate.fromIso8601('2015-11-01T00:00:00Z'); + var clock = new Clock(); + clock.shouldAnimate = false; + clock.currentTime = epoch.clone(); + + var element = loadVideo(); + + var videoSynchronizer = new VideoSynchronizer({ + clock : clock, + element : element, + epoch : epoch + }); + + return pollToPromise(function() { + clock.tick(); + return element.currentTime === 0; + }).then(function() { + clock.currentTime = JulianDate.addSeconds(epoch, 10, clock.currentTime); + return pollToPromise(function() { + clock.tick(); + return element.currentTime === 10; + }); + }).then(function() { + clock.currentTime = JulianDate.addSeconds(epoch, 60, clock.currentTime); + return pollToPromise(function() { + clock.tick(); + return CesiumMath.equalsEpsilon(element.currentTime, element.duration, CesiumMath.EPSILON3); + }); + }).then(function() { + clock.currentTime = JulianDate.addSeconds(epoch, -1, clock.currentTime); + return pollToPromise(function() { + clock.tick(); + return element.currentTime === 0; + }); + }).then(function() { + videoSynchronizer.destroy(); + }); + }); + + it('Plays/pauses video based on clock', function() { + var epoch = JulianDate.fromIso8601('2015-11-01T00:00:00Z'); + var clock = new Clock(); + + var element = loadVideo(); + + var videoSynchronizer = new VideoSynchronizer({ + clock : clock, + element : element, + epoch : epoch + }); + + return pollToPromise(function() { + clock.shouldAnimate = false; + clock.tick(); + return element.paused === true; + }).then(function() { + clock.shouldAnimate = true; + clock.tick(); + return element.paused === false; + }).then(function() { + clock.shouldAnimate = false; + clock.tick(); + return element.paused === true; + }).then(function() { + videoSynchronizer.destroy(); + }); + }); +}); From d26210351cffb55ea3a1a91dc986f9c0785da5c3 Mon Sep 17 00:00:00 2001 From: Ed Mackey Date: Mon, 16 Nov 2015 14:14:33 -0500 Subject: [PATCH 53/59] Update LICENSE.md --- LICENSE.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/LICENSE.md b/LICENSE.md index 879dfec721ef..cd6bb9c149a7 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -263,6 +263,18 @@ Copyright (c) 2008-2015 Pivotal Labs > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +Cesium Documentation +==================== + +The Cesium documentation files include the following third-party content. + +### Source Sans Pro (Font) + +SourceĀ® Sans Pro, Adobe's first open source typeface family, was designed by Paul D. Hunt. It is a sans serif typeface intended to work well in user interfaces. + +[SIL Open Font License, 1.1](http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL) ([text](http://scripts.sil.org/cms/scripts/render_download.php?format=file&media_id=OFL_plaintext&filename=OFL.txt)) + + Example Applications ==================== From ad8fe7f064e6a52a5cee509f1049b969d0db3bf8 Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Mon, 16 Nov 2015 17:25:33 -0500 Subject: [PATCH 54/59] Improve error handling in Video demo. --- Apps/Sandcastle/gallery/Video.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Apps/Sandcastle/gallery/Video.html b/Apps/Sandcastle/gallery/Video.html index 4b39f89fffee..1aff99ae3c68 100644 --- a/Apps/Sandcastle/gallery/Video.html +++ b/Apps/Sandcastle/gallery/Video.html @@ -43,7 +43,7 @@ function startup(Cesium) { "use strict"; //Sandcastle_Begin -var viewer = new Cesium.Viewer('cesiumContainer'); +var viewer = new Cesium.Viewer('cesiumContainer', {showRenderLoopErrors : false}); var videoElement = document.getElementById('trailer'); @@ -106,6 +106,16 @@ } videoElement.style.display = 'none'; }); + +// Older browsers do not support WebGL video textures, +// put up a friendly error message indicating such. +viewer.scene.renderError.addEventListener(function() { + if(!videoElement.paused){ + videoElement.pause(); + } + viewer.cesiumWidget.showErrorPanel('This browser does not support cross-origin WebGL video textures.', '', ''); +}); + //Sandcastle_End Sandcastle.finishedLoading(); } From 874cc126b0cbb930e71d5be3e8c3344b5204c265 Mon Sep 17 00:00:00 2001 From: bflood-agi Date: Tue, 17 Nov 2015 08:33:07 -0500 Subject: [PATCH 55/59] JulianDate creation from ISO8601 hours-minutes strings --- Source/Core/JulianDate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/JulianDate.js b/Source/Core/JulianDate.js index 390ff91b975f..c4b1a7a0f162 100644 --- a/Source/Core/JulianDate.js +++ b/Source/Core/JulianDate.js @@ -360,7 +360,7 @@ define([ tokens = time.match(matchHoursMinutes); if (tokens !== null) { dashCount = time.split(':').length - 1; - if (dashCount > 0 && dashCount !== 1) { + if (dashCount > 2) { throw new DeveloperError(iso8601ErrorMessage); } From 43e03beddf17cdb9f8c482409ff7f1fdf3501f0d Mon Sep 17 00:00:00 2001 From: bflood-agi Date: Tue, 17 Nov 2015 08:37:27 -0500 Subject: [PATCH 56/59] JulianDate creation from ISO8601 hours-minutes strings --- Specs/Core/JulianDateSpec.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Specs/Core/JulianDateSpec.js b/Specs/Core/JulianDateSpec.js index 4923e5ba3661..8990061810cc 100644 --- a/Specs/Core/JulianDateSpec.js +++ b/Specs/Core/JulianDateSpec.js @@ -434,6 +434,18 @@ defineSuite([ expect(julianDate).toEqual(expectedDate); }); + it('Construct from ISO8601 local calendar date and time with no seconds and UTC offset in basic format', function() { + var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 30, 0))); + var computedDate = JulianDate.fromIso8601('20090801T0730-0500'); + expect(computedDate).toEqual(expectedDate); + }); + + it('Construct from ISO8601 local calendar date and time with no seconds and UTC offset in extended format', function() { + var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 30, 0))); + var computedDate = JulianDate.fromIso8601('2009-08-01T07:30-05:00'); + expect(computedDate).toEqual(expectedDate); + }); + it('Fails to construct an ISO8601 ordinal date with day less than 1', function() { expect(function() { return JulianDate.fromIso8601('2009-000'); From 5a97e7b81d9e9a580878a002903b01854dec93cb Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Tue, 17 Nov 2015 09:23:00 -0500 Subject: [PATCH 57/59] Add bflood-agi to contributors Also update CHANGES after #3213 --- CHANGES.md | 1 + CONTRIBUTORS.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index e874f1e7ba31..ab9561f19445 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,7 @@ Change Log * Entity collections have a reference to their owner (usually a data source, but can be a `CompositeEntityCollection`). * `GeoJsonDataSource.load` now takes an optional `describeProperty` function for generating feature description properties. [#3140](https://github.com/AnalyticalGraphicsInc/cesium/pull/3140) * Fixed a bug which caused `Entity` polyline graphics to be incorrect when a scene's ellipsoid was not WGS84. [#3174](https://github.com/AnalyticalGraphicsInc/cesium/pull/3174) +* Fixed `JulianDate.fromIso8601 ` so that it correctly parses the `YYYY-MM-DDThh:mmTZD` format. * Added `ImageryProvider.readyPromise` and `TerrainProvider.readyPromise` and implemented it in all terrain and imagery providers. This is a promise which resolves when `ready` becomes true and rejected if there is an error during initialization. [#3175](https://github.com/AnalyticalGraphicsInc/cesium/pull/3175) * Added support for fog near the horizon, which improves performance by rendering less terrain tiles and reduces terrain tile requests. This is enabled by default. See `Scene.fog` for options. [#3154](https://github.com/AnalyticalGraphicsInc/cesium/pull/3154) * Added `Queue.peek` to return the item at the front of a Queue. diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 6561b7005a3e..1a079714c39f 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -28,6 +28,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu * [Katherina Lim](https://github.com/klim705) * [Gabrielle Getz](https://github.com/ggetz) * [Sarah Chow](https://github.com/slchow) + * [Brendan Flood](https://github.com/bflood-agi) * [NICTA](http://www.nicta.com.au/) * [Chris Cooper](https://github.com/chris-cooper) * [Kevin Ring](https://github.com/kring) From b441fb6e5a6315bd5639f5793dbc9486e5064c86 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 17 Nov 2015 17:29:16 -0500 Subject: [PATCH 58/59] Remove code to fill the poles with screen space quads. --- Source/Scene/Globe.js | 380 +------------------------------- Source/Shaders/GlobeFSPole.glsl | 29 --- Source/Shaders/GlobeVSPole.glsl | 12 - 3 files changed, 3 insertions(+), 418 deletions(-) delete mode 100644 Source/Shaders/GlobeFSPole.glsl delete mode 100644 Source/Shaders/GlobeVSPole.glsl diff --git a/Source/Scene/Globe.js b/Source/Scene/Globe.js index 13c0a4b50cdf..a4011095d2f5 100644 --- a/Source/Scene/Globe.js +++ b/Source/Scene/Globe.js @@ -1,13 +1,9 @@ /*global define*/ define([ - '../Core/BoundingRectangle', '../Core/BoundingSphere', '../Core/buildModuleUrl', - '../Core/Cartesian2', '../Core/Cartesian3', '../Core/Cartographic', - '../Core/combine', - '../Core/ComponentDatatype', '../Core/defaultValue', '../Core/defined', '../Core/defineProperties', @@ -15,49 +11,27 @@ define([ '../Core/DeveloperError', '../Core/Ellipsoid', '../Core/EllipsoidTerrainProvider', - '../Core/FeatureDetection', '../Core/GeographicProjection', - '../Core/Geometry', - '../Core/GeometryAttribute', - '../Core/Intersect', '../Core/IntersectionTests', '../Core/loadImage', - '../Core/Math', - '../Core/Matrix4', - '../Core/Occluder', - '../Core/PrimitiveType', '../Core/Ray', '../Core/Rectangle', - '../Core/Transforms', - '../Renderer/BufferUsage', - '../Renderer/DrawCommand', - '../Renderer/RenderState', - '../Renderer/ShaderProgram', '../Renderer/ShaderSource', '../Renderer/Texture', - '../Renderer/VertexArray', '../Shaders/GlobeFS', - '../Shaders/GlobeFSPole', '../Shaders/GlobeVS', - '../Shaders/GlobeVSPole', '../Shaders/GroundAtmosphere', '../ThirdParty/when', './GlobeSurfaceShaderSet', './GlobeSurfaceTileProvider', './ImageryLayerCollection', - './Pass', './QuadtreePrimitive', - './SceneMode', - './terrainAttributeLocations' + './SceneMode' ], function( - BoundingRectangle, BoundingSphere, buildModuleUrl, - Cartesian2, Cartesian3, Cartographic, - combine, - ComponentDatatype, defaultValue, defined, defineProperties, @@ -65,40 +39,22 @@ define([ DeveloperError, Ellipsoid, EllipsoidTerrainProvider, - FeatureDetection, GeographicProjection, - Geometry, - GeometryAttribute, - Intersect, IntersectionTests, loadImage, - CesiumMath, - Matrix4, - Occluder, - PrimitiveType, Ray, Rectangle, - Transforms, - BufferUsage, - DrawCommand, - RenderState, - ShaderProgram, ShaderSource, Texture, - VertexArray, GlobeFS, - GlobeFSPole, GlobeVS, - GlobeVSPole, GroundAtmosphere, when, GlobeSurfaceShaderSet, GlobeSurfaceTileProvider, ImageryLayerCollection, - Pass, QuadtreePrimitive, - SceneMode, - terrainAttributeLocations) { + SceneMode) { "use strict"; /** @@ -139,49 +95,12 @@ define([ }) }); - this._occluder = new Occluder(new BoundingSphere(Cartesian3.ZERO, ellipsoid.minimumRadius), Cartesian3.ZERO); - - this._rsColor = undefined; - this._rsColorWithoutDepthTest = undefined; - - this._northPoleCommand = new DrawCommand({ - pass : Pass.OPAQUE, - owner : this - }); - this._southPoleCommand = new DrawCommand({ - pass : Pass.OPAQUE, - owner : this - }); - - this._drawNorthPole = false; - this._drawSouthPole = false; - - this._mode = SceneMode.SCENE3D; - /** * The terrain provider providing surface geometry for this globe. * @type {TerrainProvider} */ this.terrainProvider = terrainProvider; - /** - * Determines the color of the north pole. If the day tile provider imagery does not - * extend over the north pole, it will be filled with this color before applying lighting. - * - * @type {Cartesian3} - * @default Cartesian3(2.0 / 255.0, 6.0 / 255.0, 18.0 / 255.0) - */ - this.northPoleColor = new Cartesian3(2.0 / 255.0, 6.0 / 255.0, 18.0 / 255.0); - - /** - * Determines the color of the south pole. If the day tile provider imagery does not - * extend over the south pole, it will be filled with this color before applying lighting. - * - * @type {Cartesian3} - * @default Cartesian3(1.0, 1.0, 1.0) - */ - this.southPoleColor = new Cartesian3(1.0, 1.0, 1.0); - /** * Determines if the globe will be shown. * @@ -271,21 +190,6 @@ define([ this._oceanNormalMap = undefined; this._zoomedOutOceanSpecularIntensity = 0.5; - this._lightingFadeDistance = new Cartesian2(this.lightingFadeOutDistance, this.lightingFadeInDistance); - - var that = this; - - this._drawUniforms = { - u_zoomedOutOceanSpecularIntensity : function() { - return that._zoomedOutOceanSpecularIntensity; - }, - u_oceanNormalMap : function() { - return that._oceanNormalMap; - }, - u_lightingFadeDistance : function() { - return that._lightingFadeDistance; - } - }; }; defineProperties(Globe.prototype, { @@ -482,206 +386,6 @@ define([ return ellipsoid.cartesianToCartographic(intersection, scratchGetHeightCartographic).height; }; - var rightScratch = new Cartesian3(); - var upScratch = new Cartesian3(); - var negativeZ = Cartesian3.negate(Cartesian3.UNIT_Z, new Cartesian3()); - var cartographicScratch = new Cartographic(0.0, 0.0); - var pt1Scratch = new Cartesian3(); - var pt2Scratch = new Cartesian3(); - - function computePoleQuad(globe, frameState, maxLat, maxGivenLat, viewProjMatrix, viewportTransformation) { - cartographicScratch.longitude = 0.0; - cartographicScratch.latitude = maxGivenLat; - var pt1 = globe._ellipsoid.cartographicToCartesian(cartographicScratch, pt1Scratch); - - cartographicScratch.longitude = Math.PI; - var pt2 = globe._ellipsoid.cartographicToCartesian(cartographicScratch, pt2Scratch); - - var radius = Cartesian3.magnitude(Cartesian3.subtract(pt1, pt2, rightScratch), rightScratch) * 0.5; - - cartographicScratch.longitude = 0.0; - cartographicScratch.latitude = maxLat; - var center = globe._ellipsoid.cartographicToCartesian(cartographicScratch, pt1Scratch); - - var right; - var dir = frameState.camera.direction; - if (1.0 - Cartesian3.dot(negativeZ, dir) < CesiumMath.EPSILON6) { - right = Cartesian3.UNIT_X; - } else { - right = Cartesian3.normalize(Cartesian3.cross(dir, Cartesian3.UNIT_Z, rightScratch), rightScratch); - } - - var screenRight = Cartesian3.add(center, Cartesian3.multiplyByScalar(right, radius, rightScratch), rightScratch); - var screenUp = Cartesian3.add(center, Cartesian3.multiplyByScalar(Cartesian3.normalize(Cartesian3.cross(Cartesian3.UNIT_Z, right, upScratch), upScratch), radius, upScratch), upScratch); - - Transforms.pointToGLWindowCoordinates(viewProjMatrix, viewportTransformation, center, center); - Transforms.pointToGLWindowCoordinates(viewProjMatrix, viewportTransformation, screenRight, screenRight); - Transforms.pointToGLWindowCoordinates(viewProjMatrix, viewportTransformation, screenUp, screenUp); - - var halfWidth = Math.floor(Math.max(Cartesian3.distance(screenUp, center), Cartesian3.distance(screenRight, center))); - var halfHeight = halfWidth; - - return new BoundingRectangle( - Math.floor(center.x) - halfWidth, - Math.floor(center.y) - halfHeight, - halfWidth * 2.0, - halfHeight * 2.0); - } - - var viewportScratch = new BoundingRectangle(); - var vpTransformScratch = new Matrix4(); - var polePositionsScratch = FeatureDetection.supportsTypedArrays() ? new Float32Array(8) : []; - - function fillPoles(globe, frameState) { - var terrainProvider = globe.terrainProvider; - if (frameState.mode !== SceneMode.SCENE3D) { - return; - } - - if (!terrainProvider.ready) { - return; - } - - var terrainMaxRectangle = terrainProvider.tilingScheme.rectangle; - - var context = frameState.context; - var viewProjMatrix = context.uniformState.viewProjection; - var viewport = viewportScratch; - viewport.width = context.drawingBufferWidth; - viewport.height = context.drawingBufferHeight; - var viewportTransformation = Matrix4.computeViewportTransformation(viewport, 0.0, 1.0, vpTransformScratch); - var latitudeExtension = 0.05; - - var rectangle; - var boundingVolume; - var frustumCull; - var occludeePoint; - var occluded; - var geometry; - var rect; - var occluder = globe._occluder; - - // handle north pole - if (terrainMaxRectangle.north < CesiumMath.PI_OVER_TWO) { - rectangle = new Rectangle(-Math.PI, terrainMaxRectangle.north, Math.PI, CesiumMath.PI_OVER_TWO); - boundingVolume = BoundingSphere.fromRectangle3D(rectangle, globe._ellipsoid); - frustumCull = frameState.cullingVolume.computeVisibility(boundingVolume) === Intersect.OUTSIDE; - occludeePoint = Occluder.computeOccludeePointFromRectangle(rectangle, globe._ellipsoid); - occluded = (occludeePoint && !occluder.isPointVisible(occludeePoint, 0.0)) || !occluder.isBoundingSphereVisible(boundingVolume); - - globe._drawNorthPole = !frustumCull && !occluded; - if (globe._drawNorthPole) { - rect = computePoleQuad(globe, frameState, rectangle.north, rectangle.south - latitudeExtension, viewProjMatrix, viewportTransformation); - polePositionsScratch[0] = rect.x; - polePositionsScratch[1] = rect.y; - polePositionsScratch[2] = rect.x + rect.width; - polePositionsScratch[3] = rect.y; - polePositionsScratch[4] = rect.x + rect.width; - polePositionsScratch[5] = rect.y + rect.height; - polePositionsScratch[6] = rect.x; - polePositionsScratch[7] = rect.y + rect.height; - - if (!defined(globe._northPoleCommand.vertexArray)) { - globe._northPoleCommand.boundingVolume = BoundingSphere.fromRectangle3D(rectangle, globe._ellipsoid); - geometry = new Geometry({ - attributes : { - position : new GeometryAttribute({ - componentDatatype : ComponentDatatype.FLOAT, - componentsPerAttribute : 2, - values : polePositionsScratch - }) - } - }); - globe._northPoleCommand.vertexArray = VertexArray.fromGeometry({ - context : context, - geometry : geometry, - attributeLocations : { - position : 0 - }, - bufferUsage : BufferUsage.STREAM_DRAW - }); - } else { - globe._northPoleCommand.vertexArray.getAttribute(0).vertexBuffer.copyFromArrayView(polePositionsScratch); - } - } - } - - // handle south pole - if (terrainMaxRectangle.south > -CesiumMath.PI_OVER_TWO) { - rectangle = new Rectangle(-Math.PI, -CesiumMath.PI_OVER_TWO, Math.PI, terrainMaxRectangle.south); - boundingVolume = BoundingSphere.fromRectangle3D(rectangle, globe._ellipsoid); - frustumCull = frameState.cullingVolume.computeVisibility(boundingVolume) === Intersect.OUTSIDE; - occludeePoint = Occluder.computeOccludeePointFromRectangle(rectangle, globe._ellipsoid); - occluded = (occludeePoint && !occluder.isPointVisible(occludeePoint)) || !occluder.isBoundingSphereVisible(boundingVolume); - - globe._drawSouthPole = !frustumCull && !occluded; - if (globe._drawSouthPole) { - rect = computePoleQuad(globe, frameState, rectangle.south, rectangle.north + latitudeExtension, viewProjMatrix, viewportTransformation); - polePositionsScratch[0] = rect.x; - polePositionsScratch[1] = rect.y; - polePositionsScratch[2] = rect.x + rect.width; - polePositionsScratch[3] = rect.y; - polePositionsScratch[4] = rect.x + rect.width; - polePositionsScratch[5] = rect.y + rect.height; - polePositionsScratch[6] = rect.x; - polePositionsScratch[7] = rect.y + rect.height; - - if (!defined(globe._southPoleCommand.vertexArray)) { - globe._southPoleCommand.boundingVolume = BoundingSphere.fromRectangle3D(rectangle, globe._ellipsoid); - geometry = new Geometry({ - attributes : { - position : new GeometryAttribute({ - componentDatatype : ComponentDatatype.FLOAT, - componentsPerAttribute : 2, - values : polePositionsScratch - }) - } - }); - globe._southPoleCommand.vertexArray = VertexArray.fromGeometry({ - context : context, - geometry : geometry, - attributeLocations : { - position : 0 - }, - bufferUsage : BufferUsage.STREAM_DRAW - }); - } else { - globe._southPoleCommand.vertexArray.getAttribute(0).vertexBuffer.copyFromArrayView(polePositionsScratch); - } - } - } - - var poleIntensity = 0.0; - var baseLayer = globe._imageryLayerCollection.length > 0 ? globe._imageryLayerCollection.get(0) : undefined; - if (defined(baseLayer) && defined(baseLayer.imageryProvider) && defined(baseLayer.imageryProvider.getPoleIntensity)) { - poleIntensity = baseLayer.imageryProvider.getPoleIntensity(); - } - - var drawUniforms = { - u_dayIntensity : function() { - return poleIntensity; - } - }; - - if (!defined(globe._northPoleCommand.uniformMap)) { - var northPoleUniforms = combine(drawUniforms, { - u_color : function() { - return globe.northPoleColor; - } - }); - globe._northPoleCommand.uniformMap = combine(northPoleUniforms, globe._drawUniforms); - } - - if (!defined(globe._southPoleCommand.uniformMap)) { - var southPoleUniforms = combine(drawUniforms, { - u_color : function() { - return globe.southPoleColor; - } - }); - globe._southPoleCommand.uniformMap = combine(southPoleUniforms, globe._drawUniforms); - } - } - /** * @private */ @@ -698,45 +402,6 @@ define([ return; } - var mode = frameState.mode; - - if (this._mode !== mode || !defined(this._rsColor)) { - if (mode === SceneMode.SCENE3D || mode === SceneMode.COLUMBUS_VIEW) { - this._rsColor = RenderState.fromCache({ // Write color and depth - cull : { - enabled : true - }, - depthTest : { - enabled : true - } - }); - this._rsColorWithoutDepthTest = RenderState.fromCache({ // Write color, not depth - cull : { - enabled : true - } - }); - } else { - this._rsColor = RenderState.fromCache({ - cull : { - enabled : true - } - }); - this._rsColorWithoutDepthTest = RenderState.fromCache({ - cull : { - enabled : true - } - }); - } - } - - this._mode = mode; - - var northPoleCommand = this._northPoleCommand; - var southPoleCommand = this._southPoleCommand; - - northPoleCommand.renderState = this._rsColorWithoutDepthTest; - southPoleCommand.renderState = this._rsColorWithoutDepthTest; - var surface = this._surface; var tileProvider = surface.tileProvider; var terrainProvider = this.terrainProvider; @@ -766,40 +431,10 @@ define([ } } - if (!defined(northPoleCommand.shaderProgram) || - !defined(southPoleCommand.shaderProgram)) { - - var poleShaderProgram = ShaderProgram.replaceCache({ - context : context, - shaderProgram : northPoleCommand.shaderProgram, - vertexShaderSource : GlobeVSPole, - fragmentShaderSource : GlobeFSPole, - attributeLocations : terrainAttributeLocations - }); - - northPoleCommand.shaderProgram = poleShaderProgram; - southPoleCommand.shaderProgram = poleShaderProgram; - } - - this._occluder.cameraPosition = frameState.camera.positionWC; - - fillPoles(this, frameState); - - var commandList = frameState.commandList; + var mode = frameState.mode; var pass = frameState.passes; if (pass.render) { - // render quads to fill the poles - if (mode === SceneMode.SCENE3D) { - if (this._drawNorthPole) { - commandList.push(northPoleCommand); - } - - if (this._drawSouthPole) { - commandList.push(southPoleCommand); - } - } - // Don't show the ocean specular highlights when zoomed out in 2D and Columbus View. if (mode === SceneMode.SCENE3D) { this._zoomedOutOceanSpecularIntensity = 0.5; @@ -858,18 +493,9 @@ define([ * globe = globe && globe.destroy(); */ Globe.prototype.destroy = function() { - this._northPoleCommand.vertexArray = this._northPoleCommand.vertexArray && this._northPoleCommand.vertexArray.destroy(); - this._southPoleCommand.vertexArray = this._southPoleCommand.vertexArray && this._southPoleCommand.vertexArray.destroy(); - this._surfaceShaderSet = this._surfaceShaderSet && this._surfaceShaderSet.destroy(); - - this._northPoleCommand.shaderProgram = this._northPoleCommand.shaderProgram && this._northPoleCommand.shaderProgram.destroy(); - this._southPoleCommand.shaderProgram = this._northPoleCommand.shaderProgram; - this._surface = this._surface && this._surface.destroy(); - this._oceanNormalMap = this._oceanNormalMap && this._oceanNormalMap.destroy(); - return destroyObject(this); }; diff --git a/Source/Shaders/GlobeFSPole.glsl b/Source/Shaders/GlobeFSPole.glsl deleted file mode 100644 index bf541874bafd..000000000000 --- a/Source/Shaders/GlobeFSPole.glsl +++ /dev/null @@ -1,29 +0,0 @@ -uniform vec3 u_color; - -varying vec2 v_textureCoordinates; - -void main() -{ - // TODO: make arbitrary ellipsoid - czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC(); - vec3 direction = normalize(czm_windowToEyeCoordinates(gl_FragCoord).xyz); - czm_ray ray = czm_ray(vec3(0.0), direction); - czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid); - - if (!czm_isEmpty(intersection)) - { - vec3 positionEC = czm_pointAlongRay(ray, intersection.start); - vec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz; - - vec3 normalMC = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), vec3(1.0))); - vec3 normalEC = normalize(czm_normal * normalMC); - - vec3 startDayColor = u_color; - - gl_FragColor = vec4(startDayColor, 1.0); - } - else - { - discard; - } -} \ No newline at end of file diff --git a/Source/Shaders/GlobeVSPole.glsl b/Source/Shaders/GlobeVSPole.glsl deleted file mode 100644 index 251ba1e88386..000000000000 --- a/Source/Shaders/GlobeVSPole.glsl +++ /dev/null @@ -1,12 +0,0 @@ -attribute vec4 position; - -varying vec2 v_textureCoordinates; - -void main() -{ - float x = (position.x - czm_viewport.x) / czm_viewport.z; - float y = (position.y - czm_viewport.y) / czm_viewport.w; - v_textureCoordinates = vec2(x, y); - - gl_Position = czm_viewportOrthographic * position; -} \ No newline at end of file From 8d384d3c2e385f0fe7c33b2a54530c2438301b80 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Wed, 18 Nov 2015 12:20:22 -0500 Subject: [PATCH 59/59] Use optimized commands that render depth only when picking the globe. --- Source/Scene/GlobeSurfaceTileProvider.js | 2 +- Source/Scene/QuadtreePrimitive.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Scene/GlobeSurfaceTileProvider.js b/Source/Scene/GlobeSurfaceTileProvider.js index 1c4117f7a93c..63d9da528037 100644 --- a/Source/Scene/GlobeSurfaceTileProvider.js +++ b/Source/Scene/GlobeSurfaceTileProvider.js @@ -1181,7 +1181,7 @@ define([ var useWebMercatorProjection = frameState.projection instanceof WebMercatorProjection; - pickCommand.shaderProgram = tileProvider._surfaceShaderSet.getShaderProgram(frameState.context, frameState.mode, useWebMercatorProjection); + pickCommand.shaderProgram = tileProvider._surfaceShaderSet.getPickShaderProgram(frameState.context, frameState.mode, useWebMercatorProjection); pickCommand.renderState = tileProvider._pickRenderState; pickCommand.owner = drawCommand.owner; diff --git a/Source/Scene/QuadtreePrimitive.js b/Source/Scene/QuadtreePrimitive.js index 8298f25f81df..9a328d117c52 100644 --- a/Source/Scene/QuadtreePrimitive.js +++ b/Source/Scene/QuadtreePrimitive.js @@ -258,7 +258,7 @@ define([ } if (passes.pick && this._tilesToRender.length > 0) { - this._tileProvider.endUpdate(frameState); + this._tileProvider.updateForPick(frameState); } };