From 87fb7c37c81de43ad6c7f2bb49edb3103f5282b3 Mon Sep 17 00:00:00 2001 From: Bogumil Wrona Date: Sat, 13 Aug 2016 11:30:28 +0200 Subject: [PATCH] feat(cesium): update to v1.24 --- Gemfile.lock | 2 +- app/assets/javascripts/Cesium/Cesium.js | 2 +- .../Cesium/Core/AttributeCompression.js | 68 ++++++-- .../Cesium/Core/BoundingRectangle.js | 4 + .../javascripts/Cesium/Core/BoundingSphere.js | 4 + .../javascripts/Cesium/Core/BoxGeometry.js | 12 +- .../Cesium/Core/BoxOutlineGeometry.js | 9 +- .../javascripts/Cesium/Core/Cartesian2.js | 4 + .../javascripts/Cesium/Core/Cartesian3.js | 4 + .../javascripts/Cesium/Core/Cartesian4.js | 4 + .../javascripts/Cesium/Core/CircleGeometry.js | 6 +- .../Cesium/Core/CircleOutlineGeometry.js | 4 +- app/assets/javascripts/Cesium/Core/Color.js | 8 +- .../Cesium/Core/CorridorGeometry.js | 4 + .../Cesium/Core/CorridorOutlineGeometry.js | 4 + .../Cesium/Core/CylinderGeometry.js | 4 + .../Cesium/Core/CylinderOutlineGeometry.js | 5 + .../Cesium/Core/EllipseGeometry.js | 4 + .../Cesium/Core/EllipseOutlineGeometry.js | 4 + .../javascripts/Cesium/Core/Ellipsoid.js | 4 + .../Cesium/Core/EllipsoidGeometry.js | 4 + .../Cesium/Core/EllipsoidOutlineGeometry.js | 4 + .../javascripts/Cesium/Core/JulianDate.js | 3 +- app/assets/javascripts/Cesium/Core/Math.js | 18 ++- app/assets/javascripts/Cesium/Core/Matrix2.js | 6 +- app/assets/javascripts/Cesium/Core/Matrix3.js | 6 +- app/assets/javascripts/Cesium/Core/Matrix4.js | 8 +- .../javascripts/Cesium/Core/NearFarScalar.js | 4 + .../Cesium/Core/PolygonGeometry.js | 4 + .../Cesium/Core/PolygonOutlineGeometry.js | 4 + .../Cesium/Core/PolylineGeometry.js | 4 + .../Cesium/Core/PolylinePipeline.js | 3 +- .../Cesium/Core/PolylineVolumeGeometry.js | 4 + .../Core/PolylineVolumeOutlineGeometry.js | 4 + .../javascripts/Cesium/Core/Quaternion.js | 6 +- .../javascripts/Cesium/Core/Rectangle.js | 4 + .../Cesium/Core/RectangleGeometry.js | 4 + .../Cesium/Core/RectangleOutlineGeometry.js | 4 + .../Cesium/Core/SimplePolylineGeometry.js | 4 + .../javascripts/Cesium/Core/SphereGeometry.js | 4 +- .../Cesium/Core/SphereOutlineGeometry.js | 4 +- .../javascripts/Cesium/Core/VertexFormat.js | 4 + .../javascripts/Cesium/Core/WallGeometry.js | 4 + .../Cesium/Core/WallOutlineGeometry.js | 4 + .../Cesium/DataSources/BillboardGraphics.js | 4 +- .../Cesium/DataSources/CzmlDataSource.js | 20 ++- .../Cesium/DataSources/Rotation.js | 6 +- .../StaticGeometryPerMaterialBatch.js | 9 +- .../VelocityOrientationProperty.js | 2 +- .../DataSources/VelocityVectorProperty.js | 41 ++++- app/assets/javascripts/Cesium/Scene/Scene.js | 2 +- .../Scene/UrlTemplateImageryProvider.js | 71 ++++++++- .../createDefaultImageryProviderViewModels.js | 12 -- .../Cesium/Workers/combineGeometry.js | 132 ++++++++++++---- .../Cesium/Workers/createBoxGeometry.js | 68 ++++++-- .../Workers/createBoxOutlineGeometry.js | 61 ++++++-- .../Cesium/Workers/createCircleGeometry.js | 147 +++++++++++++---- .../Workers/createCircleOutlineGeometry.js | 66 ++++++-- .../Cesium/Workers/createCorridorGeometry.js | 76 +++++++-- .../Workers/createCorridorOutlineGeometry.js | 72 +++++++-- .../Cesium/Workers/createCylinderGeometry.js | 64 ++++++-- .../Workers/createCylinderOutlineGeometry.js | 61 ++++++-- .../Cesium/Workers/createEllipseGeometry.js | 141 +++++++++++++---- .../Workers/createEllipseOutlineGeometry.js | 62 ++++++-- .../Cesium/Workers/createEllipsoidGeometry.js | 64 ++++++-- .../Workers/createEllipsoidOutlineGeometry.js | 56 +++++-- .../Cesium/Workers/createGeometry.js | 132 ++++++++++++---- .../Cesium/Workers/createPointGeometry.js | 52 ++++-- .../Cesium/Workers/createPolygonGeometry.js | 145 +++++++++++++---- .../Workers/createPolygonOutlineGeometry.js | 137 ++++++++++++---- .../Cesium/Workers/createPolylineGeometry.js | 71 +++++++-- .../Workers/createPolylineVolumeGeometry.js | 148 ++++++++++++++---- .../createPolylineVolumeOutlineGeometry.js | 76 +++++++-- .../Cesium/Workers/createRectangleGeometry.js | 147 +++++++++++++---- .../Workers/createRectangleOutlineGeometry.js | 75 +++++++-- .../Workers/createSimplePolylineGeometry.js | 67 ++++++-- .../Cesium/Workers/createSphereGeometry.js | 68 ++++++-- .../Workers/createSphereOutlineGeometry.js | 60 +++++-- .../Workers/createVerticesFromHeightmap.js | 133 ++++++++++++---- .../createVerticesFromQuantizedTerrainMesh.js | 133 ++++++++++++---- .../Cesium/Workers/createWallGeometry.js | 76 +++++++-- .../Workers/createWallOutlineGeometry.js | 72 +++++++-- .../Workers/upsampleQuantizedTerrainMesh.js | 133 ++++++++++++---- lib/cesium/version.rb | 2 +- 84 files changed, 2617 insertions(+), 625 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index f2a5eed..a88dab9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,7 +9,7 @@ GIT PATH remote: . specs: - cesium (1.18.0) + cesium (1.24.0) jquery-rails railties (>= 3.1.1) requirejs-rails diff --git a/app/assets/javascripts/Cesium/Cesium.js b/app/assets/javascripts/Cesium/Cesium.js index ab74ac0..3d74faf 100644 --- a/app/assets/javascripts/Cesium/Cesium.js +++ b/app/assets/javascripts/Cesium/Cesium.js @@ -3,7 +3,7 @@ define(['./Core/appendForwardSlash', './Core/ArcGisImageServerTerrainProvider', 'use strict'; /*jshint sub:true*/ var Cesium = { - VERSION : "1.23", + VERSION : "1.24", _shaders : {} }; Cesium['appendForwardSlash'] = Core_appendForwardSlash; diff --git a/app/assets/javascripts/Cesium/Core/AttributeCompression.js b/app/assets/javascripts/Cesium/Core/AttributeCompression.js index cac2425..f4a41c5 100644 --- a/app/assets/javascripts/Cesium/Core/AttributeCompression.js +++ b/app/assets/javascripts/Cesium/Core/AttributeCompression.js @@ -2,12 +2,14 @@ define([ './Cartesian2', './Cartesian3', + './defaultValue', './defined', './DeveloperError', './Math' ], function( Cartesian2, Cartesian3, + defaultValue, defined, DeveloperError, CesiumMath) { @@ -23,21 +25,22 @@ define([ var AttributeCompression = {}; /** - * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * Encodes a normalized vector into 2 SNORM values in the range of [0-rangeMax] following the 'oct' encoding. * - * Oct encoding is a compact representation of unit length vectors. The encoding and decoding functions are low cost, and represent the normalized vector within 1 degree of error. + * Oct encoding is a compact representation of unit length vectors. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors", * Cigolle et al 2014: {@link http://jcgt.org/published/0003/02/01/} * - * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. - * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. - * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * @param {Cartesian3} vector The normalized vector to be compressed into 2 component 'oct' encoding. + * @param {Cartesian2} result The 2 component oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. + * @returns {Cartesian2} The 2 component oct-encoded unit length vector. * * @exception {DeveloperError} vector must be normalized. * - * @see AttributeCompression.octDecode + * @see AttributeCompression.octDecodeInRange */ - AttributeCompression.octEncode = function(vector, result) { + AttributeCompression.octEncodeInRange = function(vector, rangeMax, result) { //>>includeStart('debug', pragmas.debug); if (!defined(vector)) { throw new DeveloperError('vector is required.'); @@ -60,36 +63,53 @@ define([ result.y = (1.0 - Math.abs(x)) * CesiumMath.signNotZero(y); } - result.x = CesiumMath.toSNorm(result.x); - result.y = CesiumMath.toSNorm(result.y); + result.x = CesiumMath.toSNorm(result.x, rangeMax); + result.y = CesiumMath.toSNorm(result.y, rangeMax); return result; }; + /** + * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * + * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. + * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. + * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * + * @exception {DeveloperError} vector must be normalized. + * + * @see AttributeCompression.octEncodeInRange + * @see AttributeCompression.octDecode + */ + AttributeCompression.octEncode = function(vector, result) { + return AttributeCompression.octEncodeInRange(vector, 255, result); + }; + /** * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component vector. * * @param {Number} x The x component of the oct-encoded unit length vector. * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. * @param {Cartesian3} result The decoded and normalized vector * @returns {Cartesian3} The decoded and normalized vector. * - * @exception {DeveloperError} x and y must be a signed normalized integer between 0 and 255. + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and rangeMax. * - * @see AttributeCompression.octEncode + * @see AttributeCompression.octEncodeInRange */ - AttributeCompression.octDecode = function(x, y, result) { + AttributeCompression.octDecodeInRange = function(x, y, rangeMax, result) { //>>includeStart('debug', pragmas.debug); if (!defined(result)) { throw new DeveloperError('result is required.'); } - if (x < 0 || x > 255 || y < 0 || y > 255) { - throw new DeveloperError('x and y must be a signed normalized integer between 0 and 255'); + if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) { + throw new DeveloperError('x and y must be a signed normalized integer between 0 and ' + rangeMax); } //>>includeEnd('debug'); - result.x = CesiumMath.fromSNorm(x); - result.y = CesiumMath.fromSNorm(y); + result.x = CesiumMath.fromSNorm(x, rangeMax); + result.y = CesiumMath.fromSNorm(y, rangeMax); result.z = 1.0 - (Math.abs(result.x) + Math.abs(result.y)); if (result.z < 0.0) @@ -102,6 +122,22 @@ define([ return Cartesian3.normalize(result, result); }; + /** + * Decodes a unit-length vector in 2 byte 'oct' encoding to a normalized 3-component vector. + * + * @param {Number} x The x component of the oct-encoded unit length vector. + * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Cartesian3} result The decoded and normalized vector. + * @returns {Cartesian3} The decoded and normalized vector. + * + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and 255. + * + * @see AttributeCompression.octDecodeInRange + */ + AttributeCompression.octDecode = function(x, y, result) { + return AttributeCompression.octDecodeInRange(x, y, 255, result); + }; + /** * Packs an oct encoded vector into a single floating-point number. * diff --git a/app/assets/javascripts/Cesium/Core/BoundingRectangle.js b/app/assets/javascripts/Cesium/Core/BoundingRectangle.js index 0438f81..029a752 100644 --- a/app/assets/javascripts/Cesium/Core/BoundingRectangle.js +++ b/app/assets/javascripts/Cesium/Core/BoundingRectangle.js @@ -74,6 +74,8 @@ define([ * @param {BoundingRectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingRectangle.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -91,6 +93,8 @@ define([ array[startingIndex++] = value.y; array[startingIndex++] = value.width; array[startingIndex] = value.height; + + return array; }; /** diff --git a/app/assets/javascripts/Cesium/Core/BoundingSphere.js b/app/assets/javascripts/Cesium/Core/BoundingSphere.js index 69711c9..78f7ddf 100644 --- a/app/assets/javascripts/Cesium/Core/BoundingSphere.js +++ b/app/assets/javascripts/Cesium/Core/BoundingSphere.js @@ -811,6 +811,8 @@ define([ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -830,6 +832,8 @@ define([ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** diff --git a/app/assets/javascripts/Cesium/Core/BoxGeometry.js b/app/assets/javascripts/Cesium/Core/BoxGeometry.js index 0a85220..4930026 100644 --- a/app/assets/javascripts/Cesium/Core/BoxGeometry.js +++ b/app/assets/javascripts/Cesium/Core/BoxGeometry.js @@ -85,14 +85,14 @@ define([ * * @exception {DeveloperError} All dimensions components must be greater than or equal to zero. * - * + * * @example * var box = Cesium.BoxGeometry.fromDimensions({ * vertexFormat : Cesium.VertexFormat.POSITION_ONLY, * dimensions : new Cesium.Cartesian3(500000.0, 500000.0, 500000.0) * }); * var geometry = Cesium.BoxGeometry.createGeometry(box); - * + * * @see BoxGeometry.createGeometry */ BoxGeometry.fromDimensions = function(options) { @@ -124,7 +124,7 @@ define([ * @returns {BoxGeometry} * * - * + * * @example * var aabb = Cesium.AxisAlignedBoundingBox.fromPoints(Cesium.Cartesian3.fromDegreesArray([ * -72.0, 40.0, @@ -134,7 +134,7 @@ define([ * -68.0, 40.0 * ])); * var box = Cesium.BoxGeometry.fromAxisAlignedBoundingBox(aabb); - * + * * @see BoxGeometry.createGeometry */ BoxGeometry.fromAxisAlignedBoundingBox = function (boundingBox) { @@ -160,6 +160,8 @@ define([ * @param {BoxGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoxGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -176,6 +178,8 @@ define([ Cartesian3.pack(value._minimum, array, startingIndex); Cartesian3.pack(value._maximum, array, startingIndex + Cartesian3.packedLength); VertexFormat.pack(value._vertexFormat, array, startingIndex + 2 * Cartesian3.packedLength); + + return array; }; var scratchMin = new Cartesian3(); diff --git a/app/assets/javascripts/Cesium/Core/BoxOutlineGeometry.js b/app/assets/javascripts/Cesium/Core/BoxOutlineGeometry.js index 35747d9..b0dca55 100644 --- a/app/assets/javascripts/Cesium/Core/BoxOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Core/BoxOutlineGeometry.js @@ -75,13 +75,13 @@ define([ * * @exception {DeveloperError} All dimensions components must be greater than or equal to zero. * - * + * * @example * var box = Cesium.BoxOutlineGeometry.fromDimensions({ * dimensions : new Cesium.Cartesian3(500000.0, 500000.0, 500000.0) * }); * var geometry = Cesium.BoxOutlineGeometry.createGeometry(box); - * + * * @see BoxOutlineGeometry.createGeometry */ BoxOutlineGeometry.fromDimensions = function(options) { @@ -122,7 +122,7 @@ define([ * -68.0, 40.0 * ])); * var box = Cesium.BoxOutlineGeometry.fromAxisAlignedBoundingBox(aabb); - * + * * @see BoxOutlineGeometry.createGeometry */ BoxOutlineGeometry.fromAxisAlignedBoundingBox = function(boundingBox) { @@ -148,6 +148,8 @@ define([ * @param {BoxOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoxOutlineGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -163,6 +165,7 @@ define([ Cartesian3.pack(value._min, array, startingIndex); Cartesian3.pack(value._max, array, startingIndex + Cartesian3.packedLength); + return array; }; var scratchMin = new Cartesian3(); diff --git a/app/assets/javascripts/Cesium/Core/Cartesian2.js b/app/assets/javascripts/Cesium/Core/Cartesian2.js index a8c7ca2..f5dd314 100644 --- a/app/assets/javascripts/Cesium/Core/Cartesian2.js +++ b/app/assets/javascripts/Cesium/Core/Cartesian2.js @@ -113,6 +113,8 @@ define([ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -128,6 +130,8 @@ define([ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** diff --git a/app/assets/javascripts/Cesium/Core/Cartesian3.js b/app/assets/javascripts/Cesium/Core/Cartesian3.js index 2566a28..f79730c 100644 --- a/app/assets/javascripts/Cesium/Core/Cartesian3.js +++ b/app/assets/javascripts/Cesium/Core/Cartesian3.js @@ -141,6 +141,8 @@ define([ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -158,6 +160,8 @@ define([ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** diff --git a/app/assets/javascripts/Cesium/Core/Cartesian4.js b/app/assets/javascripts/Cesium/Core/Cartesian4.js index 9e1a3b4..fda43f9 100644 --- a/app/assets/javascripts/Cesium/Core/Cartesian4.js +++ b/app/assets/javascripts/Cesium/Core/Cartesian4.js @@ -140,6 +140,8 @@ define([ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -157,6 +159,8 @@ define([ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** diff --git a/app/assets/javascripts/Cesium/Core/CircleGeometry.js b/app/assets/javascripts/Cesium/Core/CircleGeometry.js index afafc05..bd22568 100644 --- a/app/assets/javascripts/Cesium/Core/CircleGeometry.js +++ b/app/assets/javascripts/Cesium/Core/CircleGeometry.js @@ -88,6 +88,8 @@ define([ * @param {CircleGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ CircleGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -95,7 +97,7 @@ define([ throw new DeveloperError('value is required'); } //>>includeEnd('debug'); - EllipseGeometry.pack(value._ellipseGeometry, array, startingIndex); + return EllipseGeometry.pack(value._ellipseGeometry, array, startingIndex); }; var scratchEllipseGeometry = new EllipseGeometry({ @@ -176,7 +178,7 @@ define([ vertexFormat : VertexFormat.POSITION_ONLY }); }; - + defineProperties(CircleGeometry.prototype, { /** * @private diff --git a/app/assets/javascripts/Cesium/Core/CircleOutlineGeometry.js b/app/assets/javascripts/Cesium/Core/CircleOutlineGeometry.js index 04a98d1..8b864b6 100644 --- a/app/assets/javascripts/Cesium/Core/CircleOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Core/CircleOutlineGeometry.js @@ -80,6 +80,8 @@ define([ * @param {CircleOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ CircleOutlineGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -87,7 +89,7 @@ define([ throw new DeveloperError('value is required'); } //>>includeEnd('debug'); - EllipseOutlineGeometry.pack(value._ellipseGeometry, array, startingIndex); + return EllipseOutlineGeometry.pack(value._ellipseGeometry, array, startingIndex); }; var scratchEllipseGeometry = new EllipseOutlineGeometry({ diff --git a/app/assets/javascripts/Cesium/Core/Color.js b/app/assets/javascripts/Cesium/Core/Color.js index b78212c..59b682b 100644 --- a/app/assets/javascripts/Cesium/Core/Color.js +++ b/app/assets/javascripts/Cesium/Core/Color.js @@ -369,7 +369,7 @@ define([ * @example * var cesiumBlue = Cesium.Color.fromCssColorString('#67ADDF'); * var green = Cesium.Color.fromCssColorString('green'); - * + * * @see {@link http://www.w3.org/TR/css3-color|CSS color values} */ Color.fromCssColorString = function(color, result) { @@ -440,6 +440,8 @@ define([ * @param {Color} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Color.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -456,6 +458,8 @@ define([ array[startingIndex++] = value.green; array[startingIndex++] = value.blue; array[startingIndex] = value.alpha; + + return array; }; /** @@ -648,7 +652,7 @@ define([ * * @example * var rgba = Cesium.Color.BLUE.toRgba(); - * + * * @see Color.fromRgba */ Color.prototype.toRgba = function() { diff --git a/app/assets/javascripts/Cesium/Core/CorridorGeometry.js b/app/assets/javascripts/Cesium/Core/CorridorGeometry.js index c2d719c..08682a3 100644 --- a/app/assets/javascripts/Cesium/Core/CorridorGeometry.js +++ b/app/assets/javascripts/Cesium/Core/CorridorGeometry.js @@ -808,6 +808,8 @@ define([ * @param {CorridorGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ CorridorGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -843,6 +845,8 @@ define([ array[startingIndex++] = value._extrudedHeight; array[startingIndex++] = value._cornerType; array[startingIndex] = value._granularity; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/Core/CorridorOutlineGeometry.js b/app/assets/javascripts/Cesium/Core/CorridorOutlineGeometry.js index a4a5650..9e18d75 100644 --- a/app/assets/javascripts/Cesium/Core/CorridorOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Core/CorridorOutlineGeometry.js @@ -361,6 +361,8 @@ define([ * @param {CorridorOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ CorridorOutlineGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -390,6 +392,8 @@ define([ array[startingIndex++] = value._extrudedHeight; array[startingIndex++] = value._cornerType; array[startingIndex] = value._granularity; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/Core/CylinderGeometry.js b/app/assets/javascripts/Cesium/Core/CylinderGeometry.js index 49fb9aa..b9a952f 100644 --- a/app/assets/javascripts/Cesium/Core/CylinderGeometry.js +++ b/app/assets/javascripts/Cesium/Core/CylinderGeometry.js @@ -114,6 +114,8 @@ define([ * @param {CylinderGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ CylinderGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -134,6 +136,8 @@ define([ array[startingIndex++] = value._topRadius; array[startingIndex++] = value._bottomRadius; array[startingIndex] = value._slices; + + return array; }; var scratchVertexFormat = new VertexFormat(); diff --git a/app/assets/javascripts/Cesium/Core/CylinderOutlineGeometry.js b/app/assets/javascripts/Cesium/Core/CylinderOutlineGeometry.js index c4b2870..60b3446 100644 --- a/app/assets/javascripts/Cesium/Core/CylinderOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Core/CylinderOutlineGeometry.js @@ -1,3 +1,4 @@ + /*global define*/ define([ './BoundingSphere', @@ -105,6 +106,8 @@ define([ * @param {CylinderOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ CylinderOutlineGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -123,6 +126,8 @@ define([ array[startingIndex++] = value._bottomRadius; array[startingIndex++] = value._slices; array[startingIndex] = value._numberOfVerticalLines; + + return array; }; var scratchOptions = { diff --git a/app/assets/javascripts/Cesium/Core/EllipseGeometry.js b/app/assets/javascripts/Cesium/Core/EllipseGeometry.js index 7e5a110..59193cf 100644 --- a/app/assets/javascripts/Cesium/Core/EllipseGeometry.js +++ b/app/assets/javascripts/Cesium/Core/EllipseGeometry.js @@ -741,6 +741,8 @@ define([ * @param {EllipseGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ EllipseGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -774,6 +776,8 @@ define([ array[startingIndex++] = value._granularity; array[startingIndex++] = value._extrudedHeight; array[startingIndex] = value._extrude ? 1.0 : 0.0; + + return array; }; var scratchCenter = new Cartesian3(); diff --git a/app/assets/javascripts/Cesium/Core/EllipseOutlineGeometry.js b/app/assets/javascripts/Cesium/Core/EllipseOutlineGeometry.js index 3c23302..7269c45 100644 --- a/app/assets/javascripts/Cesium/Core/EllipseOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Core/EllipseOutlineGeometry.js @@ -211,6 +211,8 @@ define([ * @param {EllipseOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ EllipseOutlineGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -239,6 +241,8 @@ define([ array[startingIndex++] = defaultValue(value._extrudedHeight, 0.0); array[startingIndex++] = value._extrude ? 1.0 : 0.0; array[startingIndex] = value._numberOfVerticalLines; + + return array; }; var scratchCenter = new Cartesian3(); diff --git a/app/assets/javascripts/Cesium/Core/Ellipsoid.js b/app/assets/javascripts/Cesium/Core/Ellipsoid.js index cd1f607..5428122 100644 --- a/app/assets/javascripts/Cesium/Core/Ellipsoid.js +++ b/app/assets/javascripts/Cesium/Core/Ellipsoid.js @@ -271,6 +271,8 @@ define([ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -285,6 +287,8 @@ define([ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** diff --git a/app/assets/javascripts/Cesium/Core/EllipsoidGeometry.js b/app/assets/javascripts/Cesium/Core/EllipsoidGeometry.js index 13c7e71..662a715 100644 --- a/app/assets/javascripts/Cesium/Core/EllipsoidGeometry.js +++ b/app/assets/javascripts/Cesium/Core/EllipsoidGeometry.js @@ -103,6 +103,8 @@ define([ * @param {EllipsoidGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ EllipsoidGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -124,6 +126,8 @@ define([ array[startingIndex++] = value._stackPartitions; array[startingIndex] = value._slicePartitions; + + return array; }; var scratchRadii = new Cartesian3(); diff --git a/app/assets/javascripts/Cesium/Core/EllipsoidOutlineGeometry.js b/app/assets/javascripts/Cesium/Core/EllipsoidOutlineGeometry.js index c0eee85..6e60a9f 100644 --- a/app/assets/javascripts/Cesium/Core/EllipsoidOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Core/EllipsoidOutlineGeometry.js @@ -96,6 +96,8 @@ define([ * @param {EllipsoidOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ EllipsoidOutlineGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -115,6 +117,8 @@ define([ array[startingIndex++] = value._stackPartitions; array[startingIndex++] = value._slicePartitions; array[startingIndex] = value._subdivisions; + + return array; }; var scratchRadii = new Cartesian3(); diff --git a/app/assets/javascripts/Cesium/Core/JulianDate.js b/app/assets/javascripts/Cesium/Core/JulianDate.js index e091ae1..b4ac57e 100644 --- a/app/assets/javascripts/Cesium/Core/JulianDate.js +++ b/app/assets/javascripts/Cesium/Core/JulianDate.js @@ -1011,7 +1011,8 @@ define([ new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35), // July 1, 2012 00:00:00 UTC - new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36) // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36), // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457754, 43237.0, TimeStandard.TAI), 37) // January 1, 2017 00:00:00 UTC ]; return JulianDate; diff --git a/app/assets/javascripts/Cesium/Core/Math.js b/app/assets/javascripts/Cesium/Core/Math.js index 0e06c0a..7ca053d 100644 --- a/app/assets/javascripts/Cesium/Core/Math.js +++ b/app/assets/javascripts/Cesium/Core/Math.js @@ -218,25 +218,29 @@ define([ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** diff --git a/app/assets/javascripts/Cesium/Core/Matrix2.js b/app/assets/javascripts/Cesium/Core/Matrix2.js index 453d2d2..ead1b25 100644 --- a/app/assets/javascripts/Cesium/Core/Matrix2.js +++ b/app/assets/javascripts/Cesium/Core/Matrix2.js @@ -52,6 +52,8 @@ define([ * @param {Matrix2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix2.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -70,6 +72,8 @@ define([ array[startingIndex++] = value[1]; array[startingIndex++] = value[2]; array[startingIndex++] = value[3]; + + return array; }; /** @@ -686,7 +690,7 @@ define([ * @example * // Instead of Cesium.Matrix2.multiply(m, Cesium.Matrix2.fromScale(scale), m); * Cesium.Matrix2.multiplyByScale(m, scale, m); - * + * * @see Matrix2.fromScale * @see Matrix2.multiplyByUniformScale */ diff --git a/app/assets/javascripts/Cesium/Core/Matrix3.js b/app/assets/javascripts/Cesium/Core/Matrix3.js index 6dbd511..c6c3e26 100644 --- a/app/assets/javascripts/Cesium/Core/Matrix3.js +++ b/app/assets/javascripts/Cesium/Core/Matrix3.js @@ -67,6 +67,8 @@ define([ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -90,6 +92,8 @@ define([ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -977,7 +981,7 @@ define([ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ diff --git a/app/assets/javascripts/Cesium/Core/Matrix4.js b/app/assets/javascripts/Cesium/Core/Matrix4.js index b38e98e..53ed124 100644 --- a/app/assets/javascripts/Cesium/Core/Matrix4.js +++ b/app/assets/javascripts/Cesium/Core/Matrix4.js @@ -99,6 +99,8 @@ define([ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -129,6 +131,8 @@ define([ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -1795,7 +1799,7 @@ define([ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -1834,7 +1838,7 @@ define([ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ diff --git a/app/assets/javascripts/Cesium/Core/NearFarScalar.js b/app/assets/javascripts/Cesium/Core/NearFarScalar.js index bb60ab1..f73d1df 100644 --- a/app/assets/javascripts/Cesium/Core/NearFarScalar.js +++ b/app/assets/javascripts/Cesium/Core/NearFarScalar.js @@ -84,6 +84,8 @@ define([ * @param {NearFarScalar} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ NearFarScalar.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -101,6 +103,8 @@ define([ array[startingIndex++] = value.nearValue; array[startingIndex++] = value.far; array[startingIndex] = value.farValue; + + return array; }; /** diff --git a/app/assets/javascripts/Cesium/Core/PolygonGeometry.js b/app/assets/javascripts/Cesium/Core/PolygonGeometry.js index bebf673..0b2d7db 100644 --- a/app/assets/javascripts/Cesium/Core/PolygonGeometry.js +++ b/app/assets/javascripts/Cesium/Core/PolygonGeometry.js @@ -661,6 +661,8 @@ define([ * @param {PolygonGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ PolygonGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -694,6 +696,8 @@ define([ array[startingIndex++] = value._closeTop ? 1.0 : 0.0; array[startingIndex++] = value._closeBottom ? 1.0 : 0.0; array[startingIndex] = value.packedLength; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/Core/PolygonOutlineGeometry.js b/app/assets/javascripts/Cesium/Core/PolygonOutlineGeometry.js index 834743e..1a7ad97 100644 --- a/app/assets/javascripts/Cesium/Core/PolygonOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Core/PolygonOutlineGeometry.js @@ -330,6 +330,8 @@ define([ * @param {PolygonOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ PolygonOutlineGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -354,6 +356,8 @@ define([ array[startingIndex++] = value._extrude ? 1.0 : 0.0; array[startingIndex++] = value._perPositionHeight ? 1.0 : 0.0; array[startingIndex++] = value.packedLength; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/Core/PolylineGeometry.js b/app/assets/javascripts/Cesium/Core/PolylineGeometry.js index 7764fbb..228ff63 100644 --- a/app/assets/javascripts/Cesium/Core/PolylineGeometry.js +++ b/app/assets/javascripts/Cesium/Core/PolylineGeometry.js @@ -158,6 +158,8 @@ define([ * @param {PolylineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ PolylineGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -199,6 +201,8 @@ define([ array[startingIndex++] = value._colorsPerVertex ? 1.0 : 0.0; array[startingIndex++] = value._followSurface ? 1.0 : 0.0; array[startingIndex] = value._granularity; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/Core/PolylinePipeline.js b/app/assets/javascripts/Cesium/Core/PolylinePipeline.js index d7fbb27..99422e9 100644 --- a/app/assets/javascripts/Cesium/Core/PolylinePipeline.js +++ b/app/assets/javascripts/Cesium/Core/PolylinePipeline.js @@ -233,11 +233,13 @@ define([ var length = positions.length; var ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84); var height = defaultValue(options.height, 0); + var hasHeightArray = isArray(height); if (length < 1) { return []; } else if (length === 1) { var p = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst); + height = hasHeightArray ? height[0] : height; if (height !== 0) { var n = ellipsoid.geodeticSurfaceNormal(p, cartesian); Cartesian3.multiplyByScalar(n, height, n); @@ -263,7 +265,6 @@ define([ var arrayLength = (numPoints + 1) * 3; var newPositions = new Array(arrayLength); var offset = 0; - var hasHeightArray = isArray(height); for (i = 0; i < length - 1; i++) { var p0 = positions[i]; diff --git a/app/assets/javascripts/Cesium/Core/PolylineVolumeGeometry.js b/app/assets/javascripts/Cesium/Core/PolylineVolumeGeometry.js index 78cba20..35bdc40 100644 --- a/app/assets/javascripts/Cesium/Core/PolylineVolumeGeometry.js +++ b/app/assets/javascripts/Cesium/Core/PolylineVolumeGeometry.js @@ -253,6 +253,8 @@ define([ * @param {PolylineVolumeGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ PolylineVolumeGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -292,6 +294,8 @@ define([ array[startingIndex++] = value._cornerType; array[startingIndex] = value._granularity; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/Core/PolylineVolumeOutlineGeometry.js b/app/assets/javascripts/Cesium/Core/PolylineVolumeOutlineGeometry.js index 7087a5b..aa2789d 100644 --- a/app/assets/javascripts/Cesium/Core/PolylineVolumeOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Core/PolylineVolumeOutlineGeometry.js @@ -165,6 +165,8 @@ define([ * @param {PolylineVolumeOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ PolylineVolumeOutlineGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -201,6 +203,8 @@ define([ array[startingIndex++] = value._cornerType; array[startingIndex] = value._granularity; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/Core/Quaternion.js b/app/assets/javascripts/Cesium/Core/Quaternion.js index b64bd4b..bef64c8 100644 --- a/app/assets/javascripts/Cesium/Core/Quaternion.js +++ b/app/assets/javascripts/Cesium/Core/Quaternion.js @@ -226,6 +226,8 @@ define([ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -244,6 +246,8 @@ define([ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -911,7 +915,7 @@ define([ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { diff --git a/app/assets/javascripts/Cesium/Core/Rectangle.js b/app/assets/javascripts/Cesium/Core/Rectangle.js index caeddb1..b3f1743 100644 --- a/app/assets/javascripts/Cesium/Core/Rectangle.js +++ b/app/assets/javascripts/Cesium/Core/Rectangle.js @@ -102,6 +102,8 @@ define([ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -120,6 +122,8 @@ define([ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** diff --git a/app/assets/javascripts/Cesium/Core/RectangleGeometry.js b/app/assets/javascripts/Cesium/Core/RectangleGeometry.js index 08c4574..f69cd25 100644 --- a/app/assets/javascripts/Cesium/Core/RectangleGeometry.js +++ b/app/assets/javascripts/Cesium/Core/RectangleGeometry.js @@ -630,6 +630,8 @@ define([ * @param {RectangleGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ RectangleGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -664,6 +666,8 @@ define([ array[startingIndex++] = value._extrude ? 1.0 : 0.0; array[startingIndex++] = value._closeTop ? 1.0 : 0.0; array[startingIndex] = value._closeBottom ? 1.0 : 0.0; + + return array; }; var scratchRectangle = new Rectangle(); diff --git a/app/assets/javascripts/Cesium/Core/RectangleOutlineGeometry.js b/app/assets/javascripts/Cesium/Core/RectangleOutlineGeometry.js index 30b7e19..1d6cc7c 100644 --- a/app/assets/javascripts/Cesium/Core/RectangleOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Core/RectangleOutlineGeometry.js @@ -230,6 +230,8 @@ define([ * @param {RectangleOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ RectangleOutlineGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -255,6 +257,8 @@ define([ array[startingIndex++] = value._rotation; array[startingIndex++] = defined(value._extrudedHeight) ? 1.0 : 0.0; array[startingIndex] = defaultValue(value._extrudedHeight, 0.0); + + return array; }; var scratchRectangle = new Rectangle(); diff --git a/app/assets/javascripts/Cesium/Core/SimplePolylineGeometry.js b/app/assets/javascripts/Cesium/Core/SimplePolylineGeometry.js index a596e56..af587d3 100644 --- a/app/assets/javascripts/Cesium/Core/SimplePolylineGeometry.js +++ b/app/assets/javascripts/Cesium/Core/SimplePolylineGeometry.js @@ -143,6 +143,8 @@ define([ * @param {SimplePolylineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ SimplePolylineGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -180,6 +182,8 @@ define([ array[startingIndex++] = value._colorsPerVertex ? 1.0 : 0.0; array[startingIndex++] = value._followSurface ? 1.0 : 0.0; array[startingIndex] = value._granularity; + + return array; }; /** diff --git a/app/assets/javascripts/Cesium/Core/SphereGeometry.js b/app/assets/javascripts/Cesium/Core/SphereGeometry.js index 857af15..4e8ac00 100644 --- a/app/assets/javascripts/Cesium/Core/SphereGeometry.js +++ b/app/assets/javascripts/Cesium/Core/SphereGeometry.js @@ -65,6 +65,8 @@ define([ * @param {SphereGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ SphereGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -73,7 +75,7 @@ define([ } //>>includeEnd('debug'); - EllipsoidGeometry.pack(value._ellipsoidGeometry, array, startingIndex); + return EllipsoidGeometry.pack(value._ellipsoidGeometry, array, startingIndex); }; var scratchEllipsoidGeometry = new EllipsoidGeometry(); diff --git a/app/assets/javascripts/Cesium/Core/SphereOutlineGeometry.js b/app/assets/javascripts/Cesium/Core/SphereOutlineGeometry.js index 6253100..1d1a627 100644 --- a/app/assets/javascripts/Cesium/Core/SphereOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Core/SphereOutlineGeometry.js @@ -63,6 +63,8 @@ define([ * @param {SphereOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ SphereOutlineGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -71,7 +73,7 @@ define([ } //>>includeEnd('debug'); - EllipsoidOutlineGeometry.pack(value._ellipsoidGeometry, array, startingIndex); + return EllipsoidOutlineGeometry.pack(value._ellipsoidGeometry, array, startingIndex); }; var scratchEllipsoidGeometry = new EllipsoidOutlineGeometry(); diff --git a/app/assets/javascripts/Cesium/Core/VertexFormat.js b/app/assets/javascripts/Cesium/Core/VertexFormat.js index a60de70..a1709d6 100644 --- a/app/assets/javascripts/Cesium/Core/VertexFormat.js +++ b/app/assets/javascripts/Cesium/Core/VertexFormat.js @@ -227,6 +227,8 @@ define([ * @param {VertexFormat} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ VertexFormat.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -246,6 +248,8 @@ define([ array[startingIndex++] = value.binormal ? 1.0 : 0.0; array[startingIndex++] = value.tangent ? 1.0 : 0.0; array[startingIndex++] = value.color ? 1.0 : 0.0; + + return array; }; /** diff --git a/app/assets/javascripts/Cesium/Core/WallGeometry.js b/app/assets/javascripts/Cesium/Core/WallGeometry.js index e483ef2..4582406 100644 --- a/app/assets/javascripts/Cesium/Core/WallGeometry.js +++ b/app/assets/javascripts/Cesium/Core/WallGeometry.js @@ -133,6 +133,8 @@ define([ * @param {WallGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ WallGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -183,6 +185,8 @@ define([ startingIndex += VertexFormat.packedLength; array[startingIndex] = value._granularity; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/Core/WallOutlineGeometry.js b/app/assets/javascripts/Cesium/Core/WallOutlineGeometry.js index d9da216..64fdb10 100644 --- a/app/assets/javascripts/Cesium/Core/WallOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Core/WallOutlineGeometry.js @@ -120,6 +120,8 @@ define([ * @param {WallOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ WallOutlineGeometry.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -167,6 +169,8 @@ define([ startingIndex += Ellipsoid.packedLength; array[startingIndex] = value._granularity; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/DataSources/BillboardGraphics.js b/app/assets/javascripts/Cesium/DataSources/BillboardGraphics.js index 2ed64d4..9613c1f 100644 --- a/app/assets/javascripts/Cesium/DataSources/BillboardGraphics.js +++ b/app/assets/javascripts/Cesium/DataSources/BillboardGraphics.js @@ -36,7 +36,7 @@ define([ * @param {Property} [options.eyeOffset=Cartesian3.ZERO] A {@link Cartesian3} Property specifying the eye offset. * @param {Property} [options.pixelOffset=Cartesian2.ZERO] A {@link Cartesian2} Property specifying the pixel offset. * @param {Property} [options.rotation=0] A numeric Property specifying the rotation about the alignedAxis. - * @param {Property} [options.alignedAxis=Cartesian3.ZERO] A {@link Cartesian3} Property specifying the axis of rotation. + * @param {Property} [options.alignedAxis=Cartesian3.ZERO] A {@link Cartesian3} Property specifying the unit vector axis of rotation. * @param {Property} [options.width] A numeric Property specifying the width of the billboard in pixels, overriding the native size. * @param {Property} [options.height] A numeric Property specifying the height of the billboard in pixels, overriding the native size. * @param {Property} [options.color=Color.WHITE] A Property specifying the tint {@link Color} of the image. @@ -146,7 +146,7 @@ define([ rotation : createPropertyDescriptor('rotation'), /** - * Gets or sets the {@link Cartesian3} Property specifying the axis of rotation + * Gets or sets the {@link Cartesian3} Property specifying the unit vector axis of rotation * in the fixed frame. When set to Cartesian3.ZERO the rotation is from the top of the screen. * @memberof BillboardGraphics.prototype * @type {Property} diff --git a/app/assets/javascripts/Cesium/DataSources/CzmlDataSource.js b/app/assets/javascripts/Cesium/DataSources/CzmlDataSource.js index ce4709c..00c9b98 100644 --- a/app/assets/javascripts/Cesium/DataSources/CzmlDataSource.js +++ b/app/assets/javascripts/Cesium/DataSources/CzmlDataSource.js @@ -79,6 +79,7 @@ define([ './StripeOrientation', './TimeIntervalCollectionPositionProperty', './TimeIntervalCollectionProperty', + './VelocityVectorProperty', './WallGraphics' ], function( BoundingRectangle, @@ -160,6 +161,7 @@ define([ StripeOrientation, TimeIntervalCollectionPositionProperty, TimeIntervalCollectionProperty, + VelocityVectorProperty, WallGraphics) { 'use strict'; @@ -1089,6 +1091,18 @@ define([ iso8601 : undefined }; + function processAlignedAxis(billboard, packetData, interval, sourceUri, entityCollection) { + if (!defined(packetData)) { + return; + } + + if (defined(packetData.velocityReference)) { + billboard.alignedAxis = new VelocityVectorProperty(makeReference(entityCollection, packetData.velocityReference), true); + } else { + processPacketData(Cartesian3, billboard, 'alignedAxis', packetData, interval, sourceUri, entityCollection); + } + } + function processBillboard(entity, packet, entityCollection, sourceUri) { var billboardData = packet.billboard; if (!defined(billboardData)) { @@ -1117,7 +1131,7 @@ define([ processPacketData(HeightReference, billboard, 'heightReference', billboardData.heightReference, interval, sourceUri, entityCollection); processPacketData(Color, billboard, 'color', billboardData.color, interval, sourceUri, entityCollection); processPacketData(Rotation, billboard, 'rotation', billboardData.rotation, interval, sourceUri, entityCollection); - processPacketData(Cartesian3, billboard, 'alignedAxis', billboardData.alignedAxis, interval, sourceUri, entityCollection); + processAlignedAxis(billboard, billboardData.alignedAxis, interval, sourceUri, entityCollection); processPacketData(Boolean, billboard, 'sizeInMeters', billboardData.sizeInMeters, interval, sourceUri, entityCollection); processPacketData(Number, billboard, 'width', billboardData.width, interval, sourceUri, entityCollection); processPacketData(Number, billboard, 'height', billboardData.height, interval, sourceUri, entityCollection); @@ -1343,7 +1357,7 @@ define([ if (!defined(label)) { entity.label = label = new LabelGraphics(); } - + processPacketData(Boolean, label, 'show', labelData.show, interval, sourceUri, entityCollection); processPacketData(String, label, 'text', labelData.text, interval, sourceUri, entityCollection); processPacketData(String, label, 'font', labelData.font, interval, sourceUri, entityCollection); @@ -1495,12 +1509,12 @@ define([ processPacketData(Boolean, point, 'show', pointData.show, interval, sourceUri, entityCollection); processPacketData(Number, point, 'pixelSize', pointData.pixelSize, interval, sourceUri, entityCollection); + processPacketData(HeightReference, point, 'heightReference', pointData.heightReference, interval, sourceUri, entityCollection); processPacketData(Color, point, 'color', pointData.color, interval, sourceUri, entityCollection); processPacketData(Color, point, 'outlineColor', pointData.outlineColor, interval, sourceUri, entityCollection); processPacketData(Number, point, 'outlineWidth', pointData.outlineWidth, interval, sourceUri, entityCollection); processPacketData(NearFarScalar, point, 'scaleByDistance', pointData.scaleByDistance, interval, sourceUri, entityCollection); processPacketData(NearFarScalar, point, 'translucencyByDistance', pointData.translucencyByDistance, interval, sourceUri, entityCollection); - processPacketData(HeightReference, point, 'heightReference', pointData.heightReference, interval, sourceUri, entityCollection); } function processPolygon(entity, packet, entityCollection, sourceUri) { diff --git a/app/assets/javascripts/Cesium/DataSources/Rotation.js b/app/assets/javascripts/Cesium/DataSources/Rotation.js index bd06329..467690f 100755 --- a/app/assets/javascripts/Cesium/DataSources/Rotation.js +++ b/app/assets/javascripts/Cesium/DataSources/Rotation.js @@ -34,7 +34,7 @@ define([ * //a SampledProperty(Number) instead. Note, the actual * //return value is in radians, not degrees. * property.getValue(time2); - * + * * @see PackableForInterpolation */ var Rotation = { @@ -50,6 +50,8 @@ define([ * @param {Rotation} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ pack : function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); @@ -64,6 +66,8 @@ define([ startingIndex = defaultValue(startingIndex, 0); array[startingIndex] = value; + + return array; }, /** diff --git a/app/assets/javascripts/Cesium/DataSources/StaticGeometryPerMaterialBatch.js b/app/assets/javascripts/Cesium/DataSources/StaticGeometryPerMaterialBatch.js index 869d18e..817ae04 100644 --- a/app/assets/javascripts/Cesium/DataSources/StaticGeometryPerMaterialBatch.js +++ b/app/assets/javascripts/Cesium/DataSources/StaticGeometryPerMaterialBatch.js @@ -68,10 +68,8 @@ define([ Batch.prototype.remove = function(updater) { var id = updater.entity.id; - var createPrimitive = this.updaters.remove(id); - - if (createPrimitive) { - this.geometry.remove(id); + this.createPrimitive = this.geometry.remove(id) || this.createPrimitive; + if (this.updaters.remove(id)) { this.updatersWithAttributes.remove(id); var unsubscribe = this.subscriptions.get(id); if (defined(unsubscribe)) { @@ -79,8 +77,7 @@ define([ this.subscriptions.remove(id); } } - this.createPrimitive = createPrimitive; - return createPrimitive; + return this.createPrimitive; }; Batch.prototype.update = function(time) { diff --git a/app/assets/javascripts/Cesium/DataSources/VelocityOrientationProperty.js b/app/assets/javascripts/Cesium/DataSources/VelocityOrientationProperty.js index 34555a9..26bd0e0 100644 --- a/app/assets/javascripts/Cesium/DataSources/VelocityOrientationProperty.js +++ b/app/assets/javascripts/Cesium/DataSources/VelocityOrientationProperty.js @@ -49,7 +49,7 @@ define([ * })); */ function VelocityOrientationProperty(position, ellipsoid) { - this._velocityVectorProperty = new VelocityVectorProperty(position); + this._velocityVectorProperty = new VelocityVectorProperty(position, true); this._subscription = undefined; this._ellipsoid = undefined; this._definitionChanged = new Event(); diff --git a/app/assets/javascripts/Cesium/DataSources/VelocityVectorProperty.js b/app/assets/javascripts/Cesium/DataSources/VelocityVectorProperty.js index c10e061..9b88f88 100644 --- a/app/assets/javascripts/Cesium/DataSources/VelocityVectorProperty.js +++ b/app/assets/javascripts/Cesium/DataSources/VelocityVectorProperty.js @@ -27,6 +27,7 @@ define([ * @constructor * * @param {Property} [position] The position property used to compute the velocity. + * @param {Boolean} [normalize=true] Whether to normalize the computed velocity vector. * * @example * //Create an entity with a billboard rotated to match its velocity. @@ -36,14 +37,15 @@ define([ * position : position, * billboard : { * image : 'image.png', - * alignedAxis : new Cesium.VelocityVectorProperty(position) + * alignedAxis : new Cesium.VelocityVectorProperty(position, true) // alignedAxis must be a unit vector * } * })); */ - function VelocityVectorProperty(position) { + function VelocityVectorProperty(position, normalize) { this._position = undefined; this._subscription = undefined; this._definitionChanged = new Event(); + this._normalize = defaultValue(normalize, true); this.position = position; } @@ -74,7 +76,7 @@ define([ } }, /** - * Gets or sets the position property used to compute orientation. + * Gets or sets the position property used to compute the velocity vector. * @memberof VelocityVectorProperty.prototype * * @type {Property} @@ -101,12 +103,31 @@ define([ this._definitionChanged.raiseEvent(this); } } + }, + /** + * Gets or sets whether the vector produced by this property + * will be normalized or not. + * @memberof VelocityVectorProperty.prototype + * + * @type {Boolean} + */ + normalize : { + get : function() { + return this._normalize; + }, + set : function(value) { + if (this._normalize === value) { + return; + } + + this._normalize = value; + this._definitionChanged.raiseEvent(this); + } } }); var position1Scratch = new Cartesian3(); var position2Scratch = new Cartesian3(); - var velocityScratch = new Cartesian3(); var timeScratch = new JulianDate(); var step = 1.0 / 60.0; @@ -137,7 +158,7 @@ define([ var property = this._position; if (Property.isConstant(property)) { - return undefined; + return this._normalize ? undefined : Cartesian3.clone(Cartesian3.ZERO, velocityResult); } var position1 = property.getValue(time, position1Scratch); @@ -159,15 +180,19 @@ define([ } if (Cartesian3.equals(position1, position2)) { - return undefined; + return this._normalize ? undefined : Cartesian3.clone(Cartesian3.ZERO, velocityResult); } if (defined(positionResult)) { position1.clone(positionResult); } - var velocity = Cartesian3.subtract(position2, position1, velocityScratch); - return Cartesian3.normalize(velocity, velocityResult); + var velocity = Cartesian3.subtract(position2, position1, velocityResult); + if (this._normalize) { + return Cartesian3.normalize(velocity, velocityResult); + } else { + return Cartesian3.divideByScalar(velocity, step, velocityResult); + } }; /** diff --git a/app/assets/javascripts/Cesium/Scene/Scene.js b/app/assets/javascripts/Cesium/Scene/Scene.js index d47814e..fcfd53f 100644 --- a/app/assets/javascripts/Cesium/Scene/Scene.js +++ b/app/assets/javascripts/Cesium/Scene/Scene.js @@ -2140,7 +2140,7 @@ define([ var shadowMaps = frameState.shadowMaps; var length = shadowMaps.length; - frameState.shadowHints.shadowsEnabled = (length > 0) && !frameState.passes.pick; + frameState.shadowHints.shadowsEnabled = (length > 0) && !frameState.passes.pick && (scene.mode === SceneMode.SCENE3D); if (!frameState.shadowHints.shadowsEnabled) { return; } diff --git a/app/assets/javascripts/Cesium/Scene/UrlTemplateImageryProvider.js b/app/assets/javascripts/Cesium/Scene/UrlTemplateImageryProvider.js index a85ff30..0e875b2 100644 --- a/app/assets/javascripts/Cesium/Scene/UrlTemplateImageryProvider.js +++ b/app/assets/javascripts/Cesium/Scene/UrlTemplateImageryProvider.js @@ -89,6 +89,19 @@ define([ *
  • {latitudeProjected}: The latitude of the picked position in the projected coordinates of the tiling scheme.
  • *
  • {format}: The format in which to get feature information, as specified in the {@link GetFeatureInfoFormat}.
  • * + * @param {Object} [options.urlSchemeZeroPadding] Gets the URL scheme zero padding for each tile coordinate. The format is '000' where + * each coordinate will be padded on the left with zeros to match the width of the passed string of zeros. e.g. Setting: + * urlSchemeZeroPadding : { '{x}' : '0000'} + * will cause an 'x' value of 12 to return the string '0012' for {x} in the generated URL. + * It the passed object has the following keywords: + * * @param {String|String[]} [options.subdomains='abc'] The subdomains to use for the {s} placeholder in the URL template. * If this parameter is a single string, each character in the string is a subdomain. If it is * an array, each element in the array is a subdomain. @@ -170,6 +183,7 @@ define([ this._errorEvent = new Event(); this._url = undefined; + this._urlSchemeZeroPadding = undefined; this._pickFeaturesUrl = undefined; this._proxy = undefined; this._tileWidth = undefined; @@ -229,6 +243,31 @@ define([ } }, + /** + * Gets the URL scheme zero padding for each tile coordinate. The format is '000' where each coordinate will be padded on + * the left with zeros to match the width of the passed string of zeros. e.g. Setting: + * urlSchemeZeroPadding : { '{x}' : '0000'} + * will cause an 'x' value of 12 to return the string '0012' for {x} in the generated URL. + * It has the following keywords: + * + * @memberof UrlTemplateImageryProvider.prototype + * @type {Object} + * @readonly + */ + urlSchemeZeroPadding : { + get : function() { + return this._urlSchemeZeroPadding; + } + }, + + /** * Gets the URL template to use to use to pick features. If this property is not specified, * {@link UrlTemplateImageryProvider#pickFeatures} will immediately returned undefined, indicating no @@ -502,6 +541,7 @@ define([ //>>includeEnd('debug'); that.enablePickFeatures = defaultValue(properties.enablePickFeatures, that.enablePickFeatures); that._url = properties.url; + that._urlSchemeZeroPadding = defaultValue(properties.urlSchemeZeroPadding, that.urlSchemeZeroPadding); that._pickFeaturesUrl = properties.pickFeaturesUrl; that._proxy = properties.proxy; that._tileDiscardPolicy = properties.tileDiscardPolicy; @@ -717,29 +757,48 @@ define([ return parts; } + function padWithZerosIfNecessary(imageryProvider, key, value) { + if (imageryProvider && + imageryProvider.urlSchemeZeroPadding && + imageryProvider.urlSchemeZeroPadding.hasOwnProperty(key) ) + { + var paddingTemplate = imageryProvider.urlSchemeZeroPadding[key]; + if (typeof paddingTemplate === 'string') { + var paddingTemplateWidth = paddingTemplate.length; + if (paddingTemplateWidth > 1) { + value = (value.length >= paddingTemplateWidth) ? value : new Array(paddingTemplateWidth - value.toString().length + 1).join('0') + value; + } + } + } + return value; + } + function xTag(imageryProvider, x, y, level) { - return x; + return padWithZerosIfNecessary(imageryProvider, '{x}', x); } function reverseXTag(imageryProvider, x, y, level) { - return imageryProvider.tilingScheme.getNumberOfXTilesAtLevel(level) - x - 1; + var reverseX = imageryProvider.tilingScheme.getNumberOfXTilesAtLevel(level) - x - 1; + return padWithZerosIfNecessary(imageryProvider, '{reverseX}', reverseX); } function yTag(imageryProvider, x, y, level) { - return y; + return padWithZerosIfNecessary(imageryProvider, '{y}', y); } function reverseYTag(imageryProvider, x, y, level) { - return imageryProvider.tilingScheme.getNumberOfYTilesAtLevel(level) - y - 1; + var reverseY = imageryProvider.tilingScheme.getNumberOfYTilesAtLevel(level) - y - 1; + return padWithZerosIfNecessary(imageryProvider, '{reverseY}', reverseY); } function reverseZTag(imageryProvider, x, y, level) { var maximumLevel = imageryProvider.maximumLevel; - return defined(maximumLevel) && level < maximumLevel ? maximumLevel - level - 1 : level; + var reverseZ = defined(maximumLevel) && level < maximumLevel ? maximumLevel - level - 1 : level; + return padWithZerosIfNecessary(imageryProvider, '{reverseZ}', reverseZ); } function zTag(imageryProvider, x, y, level) { - return level; + return padWithZerosIfNecessary(imageryProvider, '{z}', level); } function sTag(imageryProvider, x, y, level) { diff --git a/app/assets/javascripts/Cesium/Widgets/BaseLayerPicker/createDefaultImageryProviderViewModels.js b/app/assets/javascripts/Cesium/Widgets/BaseLayerPicker/createDefaultImageryProviderViewModels.js index 0e328f3..433d348 100644 --- a/app/assets/javascripts/Cesium/Widgets/BaseLayerPicker/createDefaultImageryProviderViewModels.js +++ b/app/assets/javascripts/Cesium/Widgets/BaseLayerPicker/createDefaultImageryProviderViewModels.js @@ -180,18 +180,6 @@ area washes and organic edges over a paper texture to add warm pop to any map.\n } })); - providerViewModels.push(new ProviderViewModel({ - name : 'MapQuest Open\u00adStreet\u00adMap', - iconUrl : buildModuleUrl('Widgets/Images/ImageryProviders/mapQuestOpenStreetMap.png'), - tooltip : 'OpenStreetMap (OSM) is a collaborative project to create a free editable \ -map of the world.\nhttp://www.openstreetmap.org', - creationFunction : function() { - return createOpenStreetMapImageryProvider({ - url : 'https://otile1-s.mqcdn.com/tiles/1.0.0/osm/' - }); - } - })); - providerViewModels.push(new ProviderViewModel({ name : 'The Black Marble', iconUrl : buildModuleUrl('Widgets/Images/ImageryProviders/blackMarble.png'), diff --git a/app/assets/javascripts/Cesium/Workers/combineGeometry.js b/app/assets/javascripts/Cesium/Workers/combineGeometry.js index ad7fb88..4ae9f7b 100644 --- a/app/assets/javascripts/Cesium/Workers/combineGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/combineGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -11786,7 +11818,7 @@ define('Core/Color',[ * @example * var cesiumBlue = Cesium.Color.fromCssColorString('#67ADDF'); * var green = Cesium.Color.fromCssColorString('green'); - * + * * @see {@link http://www.w3.org/TR/css3-color|CSS color values} */ Color.fromCssColorString = function(color, result) { @@ -11855,6 +11887,8 @@ define('Core/Color',[ * @param {Color} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Color.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -11869,6 +11903,8 @@ define('Core/Color',[ array[startingIndex++] = value.green; array[startingIndex++] = value.blue; array[startingIndex] = value.alpha; + + return array; }; /** @@ -12059,7 +12095,7 @@ define('Core/Color',[ * * @example * var rgba = Cesium.Color.BLUE.toRgba(); - * + * * @see Color.fromRgba */ Color.prototype.toRgba = function() { @@ -15159,6 +15195,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -15172,6 +15210,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -15810,12 +15850,14 @@ define('Core/Cartesian2',[ define('Core/AttributeCompression',[ './Cartesian2', './Cartesian3', + './defaultValue', './defined', './DeveloperError', './Math' ], function( Cartesian2, Cartesian3, + defaultValue, defined, DeveloperError, CesiumMath) { @@ -15831,21 +15873,22 @@ define('Core/AttributeCompression',[ var AttributeCompression = {}; /** - * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * Encodes a normalized vector into 2 SNORM values in the range of [0-rangeMax] following the 'oct' encoding. * - * Oct encoding is a compact representation of unit length vectors. The encoding and decoding functions are low cost, and represent the normalized vector within 1 degree of error. + * Oct encoding is a compact representation of unit length vectors. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors", * Cigolle et al 2014: {@link http://jcgt.org/published/0003/02/01/} * - * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. - * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. - * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * @param {Cartesian3} vector The normalized vector to be compressed into 2 component 'oct' encoding. + * @param {Cartesian2} result The 2 component oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. + * @returns {Cartesian2} The 2 component oct-encoded unit length vector. * * @exception {DeveloperError} vector must be normalized. * - * @see AttributeCompression.octDecode + * @see AttributeCompression.octDecodeInRange */ - AttributeCompression.octEncode = function(vector, result) { + AttributeCompression.octEncodeInRange = function(vector, rangeMax, result) { if (!defined(vector)) { throw new DeveloperError('vector is required.'); } @@ -15866,34 +15909,51 @@ define('Core/AttributeCompression',[ result.y = (1.0 - Math.abs(x)) * CesiumMath.signNotZero(y); } - result.x = CesiumMath.toSNorm(result.x); - result.y = CesiumMath.toSNorm(result.y); + result.x = CesiumMath.toSNorm(result.x, rangeMax); + result.y = CesiumMath.toSNorm(result.y, rangeMax); return result; }; + /** + * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * + * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. + * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. + * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * + * @exception {DeveloperError} vector must be normalized. + * + * @see AttributeCompression.octEncodeInRange + * @see AttributeCompression.octDecode + */ + AttributeCompression.octEncode = function(vector, result) { + return AttributeCompression.octEncodeInRange(vector, 255, result); + }; + /** * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component vector. * * @param {Number} x The x component of the oct-encoded unit length vector. * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. * @param {Cartesian3} result The decoded and normalized vector * @returns {Cartesian3} The decoded and normalized vector. * - * @exception {DeveloperError} x and y must be a signed normalized integer between 0 and 255. + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and rangeMax. * - * @see AttributeCompression.octEncode + * @see AttributeCompression.octEncodeInRange */ - AttributeCompression.octDecode = function(x, y, result) { + AttributeCompression.octDecodeInRange = function(x, y, rangeMax, result) { if (!defined(result)) { throw new DeveloperError('result is required.'); } - if (x < 0 || x > 255 || y < 0 || y > 255) { - throw new DeveloperError('x and y must be a signed normalized integer between 0 and 255'); + if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) { + throw new DeveloperError('x and y must be a signed normalized integer between 0 and ' + rangeMax); } - result.x = CesiumMath.fromSNorm(x); - result.y = CesiumMath.fromSNorm(y); + result.x = CesiumMath.fromSNorm(x, rangeMax); + result.y = CesiumMath.fromSNorm(y, rangeMax); result.z = 1.0 - (Math.abs(result.x) + Math.abs(result.y)); if (result.z < 0.0) @@ -15906,6 +15966,22 @@ define('Core/AttributeCompression',[ return Cartesian3.normalize(result, result); }; + /** + * Decodes a unit-length vector in 2 byte 'oct' encoding to a normalized 3-component vector. + * + * @param {Number} x The x component of the oct-encoded unit length vector. + * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Cartesian3} result The decoded and normalized vector. + * @returns {Cartesian3} The decoded and normalized vector. + * + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and 255. + * + * @see AttributeCompression.octDecodeInRange + */ + AttributeCompression.octDecode = function(x, y, result) { + return AttributeCompression.octDecodeInRange(x, y, 255, result); + }; + /** * Packs an oct encoded vector into a single floating-point number. * diff --git a/app/assets/javascripts/Cesium/Workers/createBoxGeometry.js b/app/assets/javascripts/Cesium/Workers/createBoxGeometry.js index 0aaa907..4cc659c 100644 --- a/app/assets/javascripts/Cesium/Workers/createBoxGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createBoxGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -13050,6 +13082,8 @@ define('Core/VertexFormat',[ * @param {VertexFormat} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ VertexFormat.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -13067,6 +13101,8 @@ define('Core/VertexFormat',[ array[startingIndex++] = value.binormal ? 1.0 : 0.0; array[startingIndex++] = value.tangent ? 1.0 : 0.0; array[startingIndex++] = value.color ? 1.0 : 0.0; + + return array; }; /** @@ -13209,14 +13245,14 @@ define('Core/BoxGeometry',[ * * @exception {DeveloperError} All dimensions components must be greater than or equal to zero. * - * + * * @example * var box = Cesium.BoxGeometry.fromDimensions({ * vertexFormat : Cesium.VertexFormat.POSITION_ONLY, * dimensions : new Cesium.Cartesian3(500000.0, 500000.0, 500000.0) * }); * var geometry = Cesium.BoxGeometry.createGeometry(box); - * + * * @see BoxGeometry.createGeometry */ BoxGeometry.fromDimensions = function(options) { @@ -13246,7 +13282,7 @@ define('Core/BoxGeometry',[ * @returns {BoxGeometry} * * - * + * * @example * var aabb = Cesium.AxisAlignedBoundingBox.fromPoints(Cesium.Cartesian3.fromDegreesArray([ * -72.0, 40.0, @@ -13256,7 +13292,7 @@ define('Core/BoxGeometry',[ * -68.0, 40.0 * ])); * var box = Cesium.BoxGeometry.fromAxisAlignedBoundingBox(aabb); - * + * * @see BoxGeometry.createGeometry */ BoxGeometry.fromAxisAlignedBoundingBox = function (boundingBox) { @@ -13282,6 +13318,8 @@ define('Core/BoxGeometry',[ * @param {BoxGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoxGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -13296,6 +13334,8 @@ define('Core/BoxGeometry',[ Cartesian3.pack(value._minimum, array, startingIndex); Cartesian3.pack(value._maximum, array, startingIndex + Cartesian3.packedLength); VertexFormat.pack(value._vertexFormat, array, startingIndex + 2 * Cartesian3.packedLength); + + return array; }; var scratchMin = new Cartesian3(); diff --git a/app/assets/javascripts/Cesium/Workers/createBoxOutlineGeometry.js b/app/assets/javascripts/Cesium/Workers/createBoxOutlineGeometry.js index 979d43d..b1e9bd9 100644 --- a/app/assets/javascripts/Cesium/Workers/createBoxOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createBoxOutlineGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -12896,13 +12928,13 @@ define('Core/BoxOutlineGeometry',[ * * @exception {DeveloperError} All dimensions components must be greater than or equal to zero. * - * + * * @example * var box = Cesium.BoxOutlineGeometry.fromDimensions({ * dimensions : new Cesium.Cartesian3(500000.0, 500000.0, 500000.0) * }); * var geometry = Cesium.BoxOutlineGeometry.createGeometry(box); - * + * * @see BoxOutlineGeometry.createGeometry */ BoxOutlineGeometry.fromDimensions = function(options) { @@ -12941,7 +12973,7 @@ define('Core/BoxOutlineGeometry',[ * -68.0, 40.0 * ])); * var box = Cesium.BoxOutlineGeometry.fromAxisAlignedBoundingBox(aabb); - * + * * @see BoxOutlineGeometry.createGeometry */ BoxOutlineGeometry.fromAxisAlignedBoundingBox = function(boundingBox) { @@ -12967,6 +12999,8 @@ define('Core/BoxOutlineGeometry',[ * @param {BoxOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoxOutlineGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -12980,6 +13014,7 @@ define('Core/BoxOutlineGeometry',[ Cartesian3.pack(value._min, array, startingIndex); Cartesian3.pack(value._max, array, startingIndex + Cartesian3.packedLength); + return array; }; var scratchMin = new Cartesian3(); diff --git a/app/assets/javascripts/Cesium/Workers/createCircleGeometry.js b/app/assets/javascripts/Cesium/Workers/createCircleGeometry.js index 986eb2a..3ebdca4 100644 --- a/app/assets/javascripts/Cesium/Workers/createCircleGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createCircleGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -11045,6 +11077,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -11058,6 +11092,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -13259,6 +13295,8 @@ define('Core/Quaternion',[ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -13275,6 +13313,8 @@ define('Core/Quaternion',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -13904,7 +13944,7 @@ define('Core/Quaternion',[ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { @@ -15084,12 +15124,14 @@ define('Core/GeometryInstance',[ define('Core/AttributeCompression',[ './Cartesian2', './Cartesian3', + './defaultValue', './defined', './DeveloperError', './Math' ], function( Cartesian2, Cartesian3, + defaultValue, defined, DeveloperError, CesiumMath) { @@ -15105,21 +15147,22 @@ define('Core/AttributeCompression',[ var AttributeCompression = {}; /** - * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * Encodes a normalized vector into 2 SNORM values in the range of [0-rangeMax] following the 'oct' encoding. * - * Oct encoding is a compact representation of unit length vectors. The encoding and decoding functions are low cost, and represent the normalized vector within 1 degree of error. + * Oct encoding is a compact representation of unit length vectors. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors", * Cigolle et al 2014: {@link http://jcgt.org/published/0003/02/01/} * - * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. - * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. - * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * @param {Cartesian3} vector The normalized vector to be compressed into 2 component 'oct' encoding. + * @param {Cartesian2} result The 2 component oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. + * @returns {Cartesian2} The 2 component oct-encoded unit length vector. * * @exception {DeveloperError} vector must be normalized. * - * @see AttributeCompression.octDecode + * @see AttributeCompression.octDecodeInRange */ - AttributeCompression.octEncode = function(vector, result) { + AttributeCompression.octEncodeInRange = function(vector, rangeMax, result) { if (!defined(vector)) { throw new DeveloperError('vector is required.'); } @@ -15140,34 +15183,51 @@ define('Core/AttributeCompression',[ result.y = (1.0 - Math.abs(x)) * CesiumMath.signNotZero(y); } - result.x = CesiumMath.toSNorm(result.x); - result.y = CesiumMath.toSNorm(result.y); + result.x = CesiumMath.toSNorm(result.x, rangeMax); + result.y = CesiumMath.toSNorm(result.y, rangeMax); return result; }; + /** + * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * + * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. + * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. + * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * + * @exception {DeveloperError} vector must be normalized. + * + * @see AttributeCompression.octEncodeInRange + * @see AttributeCompression.octDecode + */ + AttributeCompression.octEncode = function(vector, result) { + return AttributeCompression.octEncodeInRange(vector, 255, result); + }; + /** * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component vector. * * @param {Number} x The x component of the oct-encoded unit length vector. * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. * @param {Cartesian3} result The decoded and normalized vector * @returns {Cartesian3} The decoded and normalized vector. * - * @exception {DeveloperError} x and y must be a signed normalized integer between 0 and 255. + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and rangeMax. * - * @see AttributeCompression.octEncode + * @see AttributeCompression.octEncodeInRange */ - AttributeCompression.octDecode = function(x, y, result) { + AttributeCompression.octDecodeInRange = function(x, y, rangeMax, result) { if (!defined(result)) { throw new DeveloperError('result is required.'); } - if (x < 0 || x > 255 || y < 0 || y > 255) { - throw new DeveloperError('x and y must be a signed normalized integer between 0 and 255'); + if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) { + throw new DeveloperError('x and y must be a signed normalized integer between 0 and ' + rangeMax); } - result.x = CesiumMath.fromSNorm(x); - result.y = CesiumMath.fromSNorm(y); + result.x = CesiumMath.fromSNorm(x, rangeMax); + result.y = CesiumMath.fromSNorm(y, rangeMax); result.z = 1.0 - (Math.abs(result.x) + Math.abs(result.y)); if (result.z < 0.0) @@ -15180,6 +15240,22 @@ define('Core/AttributeCompression',[ return Cartesian3.normalize(result, result); }; + /** + * Decodes a unit-length vector in 2 byte 'oct' encoding to a normalized 3-component vector. + * + * @param {Number} x The x component of the oct-encoded unit length vector. + * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Cartesian3} result The decoded and normalized vector. + * @returns {Cartesian3} The decoded and normalized vector. + * + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and 255. + * + * @see AttributeCompression.octDecodeInRange + */ + AttributeCompression.octDecode = function(x, y, result) { + return AttributeCompression.octDecodeInRange(x, y, 255, result); + }; + /** * Packs an oct encoded vector into a single floating-point number. * @@ -22581,7 +22657,8 @@ define('Core/JulianDate',[ new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35), // July 1, 2012 00:00:00 UTC - new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36) // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36), // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457754, 43237.0, TimeStandard.TAI), 37) // January 1, 2017 00:00:00 UTC ]; return JulianDate; @@ -25423,6 +25500,8 @@ define('Core/VertexFormat',[ * @param {VertexFormat} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ VertexFormat.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -25440,6 +25519,8 @@ define('Core/VertexFormat',[ array[startingIndex++] = value.binormal ? 1.0 : 0.0; array[startingIndex++] = value.tangent ? 1.0 : 0.0; array[startingIndex++] = value.color ? 1.0 : 0.0; + + return array; }; /** @@ -26238,6 +26319,8 @@ define('Core/EllipseGeometry',[ * @param {EllipseGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ EllipseGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -26269,6 +26352,8 @@ define('Core/EllipseGeometry',[ array[startingIndex++] = value._granularity; array[startingIndex++] = value._extrudedHeight; array[startingIndex] = value._extrude ? 1.0 : 0.0; + + return array; }; var scratchCenter = new Cartesian3(); @@ -26518,12 +26603,14 @@ define('Core/CircleGeometry',[ * @param {CircleGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ CircleGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { throw new DeveloperError('value is required'); } - EllipseGeometry.pack(value._ellipseGeometry, array, startingIndex); + return EllipseGeometry.pack(value._ellipseGeometry, array, startingIndex); }; var scratchEllipseGeometry = new EllipseGeometry({ @@ -26604,7 +26691,7 @@ define('Core/CircleGeometry',[ vertexFormat : VertexFormat.POSITION_ONLY }); }; - + defineProperties(CircleGeometry.prototype, { /** * @private diff --git a/app/assets/javascripts/Cesium/Workers/createCircleOutlineGeometry.js b/app/assets/javascripts/Cesium/Workers/createCircleOutlineGeometry.js index f48d28c..237e2e4 100644 --- a/app/assets/javascripts/Cesium/Workers/createCircleOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createCircleOutlineGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -12497,6 +12529,8 @@ define('Core/Quaternion',[ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -12513,6 +12547,8 @@ define('Core/Quaternion',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -13142,7 +13178,7 @@ define('Core/Quaternion',[ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { @@ -14547,6 +14583,8 @@ define('Core/EllipseOutlineGeometry',[ * @param {EllipseOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ EllipseOutlineGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -14573,6 +14611,8 @@ define('Core/EllipseOutlineGeometry',[ array[startingIndex++] = defaultValue(value._extrudedHeight, 0.0); array[startingIndex++] = value._extrude ? 1.0 : 0.0; array[startingIndex] = value._numberOfVerticalLines; + + return array; }; var scratchCenter = new Cartesian3(); @@ -14767,12 +14807,14 @@ define('Core/CircleOutlineGeometry',[ * @param {CircleOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ CircleOutlineGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { throw new DeveloperError('value is required'); } - EllipseOutlineGeometry.pack(value._ellipseGeometry, array, startingIndex); + return EllipseOutlineGeometry.pack(value._ellipseGeometry, array, startingIndex); }; var scratchEllipseGeometry = new EllipseOutlineGeometry({ diff --git a/app/assets/javascripts/Cesium/Workers/createCorridorGeometry.js b/app/assets/javascripts/Cesium/Workers/createCorridorGeometry.js index df2b1dc..bf98762 100644 --- a/app/assets/javascripts/Cesium/Workers/createCorridorGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createCorridorGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1409,6 +1413,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1424,6 +1430,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -3067,6 +3075,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3079,6 +3089,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3654,6 +3666,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3675,6 +3689,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4516,7 +4532,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5222,6 +5238,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5237,6 +5255,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -6089,6 +6109,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6117,6 +6139,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7721,7 +7745,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7758,7 +7782,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -9010,6 +9034,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -9026,6 +9052,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10517,6 +10545,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10534,6 +10564,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -14740,11 +14772,13 @@ define('Core/PolylinePipeline',[ var length = positions.length; var ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84); var height = defaultValue(options.height, 0); + var hasHeightArray = isArray(height); if (length < 1) { return []; } else if (length === 1) { var p = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst); + height = hasHeightArray ? height[0] : height; if (height !== 0) { var n = ellipsoid.geodeticSurfaceNormal(p, cartesian); Cartesian3.multiplyByScalar(n, height, n); @@ -14770,7 +14804,6 @@ define('Core/PolylinePipeline',[ var arrayLength = (numPoints + 1) * 3; var newPositions = new Array(arrayLength); var offset = 0; - var hasHeightArray = isArray(height); for (i = 0; i < length - 1; i++) { var p0 = positions[i]; @@ -14940,6 +14973,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -14953,6 +14988,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -18254,7 +18291,8 @@ define('Core/JulianDate',[ new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35), // July 1, 2012 00:00:00 UTC - new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36) // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36), // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457754, 43237.0, TimeStandard.TAI), 37) // January 1, 2017 00:00:00 UTC ]; return JulianDate; @@ -20142,6 +20180,8 @@ define('Core/Quaternion',[ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -20158,6 +20198,8 @@ define('Core/Quaternion',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -20787,7 +20829,7 @@ define('Core/Quaternion',[ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { @@ -25199,6 +25241,8 @@ define('Core/VertexFormat',[ * @param {VertexFormat} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ VertexFormat.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -25216,6 +25260,8 @@ define('Core/VertexFormat',[ array[startingIndex++] = value.binormal ? 1.0 : 0.0; array[startingIndex++] = value.tangent ? 1.0 : 0.0; array[startingIndex++] = value.color ? 1.0 : 0.0; + + return array; }; /** @@ -26081,6 +26127,8 @@ define('Core/CorridorGeometry',[ * @param {CorridorGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ CorridorGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -26114,6 +26162,8 @@ define('Core/CorridorGeometry',[ array[startingIndex++] = value._extrudedHeight; array[startingIndex++] = value._cornerType; array[startingIndex] = value._granularity; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/Workers/createCorridorOutlineGeometry.js b/app/assets/javascripts/Cesium/Workers/createCorridorOutlineGeometry.js index 9f73ba2..9763cfa 100644 --- a/app/assets/javascripts/Cesium/Workers/createCorridorOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createCorridorOutlineGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1409,6 +1413,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1424,6 +1430,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -3067,6 +3075,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3079,6 +3089,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3654,6 +3666,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3675,6 +3689,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4516,7 +4532,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5222,6 +5238,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5237,6 +5255,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -6089,6 +6109,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6117,6 +6139,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7721,7 +7745,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7758,7 +7782,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -9010,6 +9034,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -9026,6 +9052,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10517,6 +10545,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10534,6 +10564,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -14740,11 +14772,13 @@ define('Core/PolylinePipeline',[ var length = positions.length; var ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84); var height = defaultValue(options.height, 0); + var hasHeightArray = isArray(height); if (length < 1) { return []; } else if (length === 1) { var p = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst); + height = hasHeightArray ? height[0] : height; if (height !== 0) { var n = ellipsoid.geodeticSurfaceNormal(p, cartesian); Cartesian3.multiplyByScalar(n, height, n); @@ -14770,7 +14804,6 @@ define('Core/PolylinePipeline',[ var arrayLength = (numPoints + 1) * 3; var newPositions = new Array(arrayLength); var offset = 0; - var hasHeightArray = isArray(height); for (i = 0; i < length - 1; i++) { var p0 = positions[i]; @@ -14940,6 +14973,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -14953,6 +14988,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -18254,7 +18291,8 @@ define('Core/JulianDate',[ new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35), // July 1, 2012 00:00:00 UTC - new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36) // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36), // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457754, 43237.0, TimeStandard.TAI), 37) // January 1, 2017 00:00:00 UTC ]; return JulianDate; @@ -20142,6 +20180,8 @@ define('Core/Quaternion',[ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -20158,6 +20198,8 @@ define('Core/Quaternion',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -20787,7 +20829,7 @@ define('Core/Quaternion',[ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { @@ -25331,6 +25373,8 @@ define('Core/CorridorOutlineGeometry',[ * @param {CorridorOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ CorridorOutlineGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -25358,6 +25402,8 @@ define('Core/CorridorOutlineGeometry',[ array[startingIndex++] = value._extrudedHeight; array[startingIndex++] = value._cornerType; array[startingIndex] = value._granularity; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/Workers/createCylinderGeometry.js b/app/assets/javascripts/Cesium/Workers/createCylinderGeometry.js index 0b68494..84bc30c 100644 --- a/app/assets/javascripts/Cesium/Workers/createCylinderGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createCylinderGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -11045,6 +11077,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -11058,6 +11092,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -14018,6 +14054,8 @@ define('Core/VertexFormat',[ * @param {VertexFormat} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ VertexFormat.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -14035,6 +14073,8 @@ define('Core/VertexFormat',[ array[startingIndex++] = value.binormal ? 1.0 : 0.0; array[startingIndex++] = value.tangent ? 1.0 : 0.0; array[startingIndex++] = value.color ? 1.0 : 0.0; + + return array; }; /** @@ -14206,6 +14246,8 @@ define('Core/CylinderGeometry',[ * @param {CylinderGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ CylinderGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -14224,6 +14266,8 @@ define('Core/CylinderGeometry',[ array[startingIndex++] = value._topRadius; array[startingIndex++] = value._bottomRadius; array[startingIndex] = value._slices; + + return array; }; var scratchVertexFormat = new VertexFormat(); diff --git a/app/assets/javascripts/Cesium/Workers/createCylinderOutlineGeometry.js b/app/assets/javascripts/Cesium/Workers/createCylinderOutlineGeometry.js index 109c80a..0f03e5e 100644 --- a/app/assets/javascripts/Cesium/Workers/createCylinderOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createCylinderOutlineGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -11045,6 +11077,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -11058,6 +11092,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -13789,6 +13825,7 @@ define('Core/IndexDatatype',[ return freezeObject(IndexDatatype); }); + /*global define*/ define('Core/CylinderOutlineGeometry',[ './BoundingSphere', @@ -13894,6 +13931,8 @@ define('Core/CylinderOutlineGeometry',[ * @param {CylinderOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ CylinderOutlineGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -13910,6 +13949,8 @@ define('Core/CylinderOutlineGeometry',[ array[startingIndex++] = value._bottomRadius; array[startingIndex++] = value._slices; array[startingIndex] = value._numberOfVerticalLines; + + return array; }; var scratchOptions = { diff --git a/app/assets/javascripts/Cesium/Workers/createEllipseGeometry.js b/app/assets/javascripts/Cesium/Workers/createEllipseGeometry.js index aa24527..3d2e519 100644 --- a/app/assets/javascripts/Cesium/Workers/createEllipseGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createEllipseGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -11045,6 +11077,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -11058,6 +11092,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -13259,6 +13295,8 @@ define('Core/Quaternion',[ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -13275,6 +13313,8 @@ define('Core/Quaternion',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -13904,7 +13944,7 @@ define('Core/Quaternion',[ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { @@ -15084,12 +15124,14 @@ define('Core/GeometryInstance',[ define('Core/AttributeCompression',[ './Cartesian2', './Cartesian3', + './defaultValue', './defined', './DeveloperError', './Math' ], function( Cartesian2, Cartesian3, + defaultValue, defined, DeveloperError, CesiumMath) { @@ -15105,21 +15147,22 @@ define('Core/AttributeCompression',[ var AttributeCompression = {}; /** - * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * Encodes a normalized vector into 2 SNORM values in the range of [0-rangeMax] following the 'oct' encoding. * - * Oct encoding is a compact representation of unit length vectors. The encoding and decoding functions are low cost, and represent the normalized vector within 1 degree of error. + * Oct encoding is a compact representation of unit length vectors. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors", * Cigolle et al 2014: {@link http://jcgt.org/published/0003/02/01/} * - * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. - * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. - * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * @param {Cartesian3} vector The normalized vector to be compressed into 2 component 'oct' encoding. + * @param {Cartesian2} result The 2 component oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. + * @returns {Cartesian2} The 2 component oct-encoded unit length vector. * * @exception {DeveloperError} vector must be normalized. * - * @see AttributeCompression.octDecode + * @see AttributeCompression.octDecodeInRange */ - AttributeCompression.octEncode = function(vector, result) { + AttributeCompression.octEncodeInRange = function(vector, rangeMax, result) { if (!defined(vector)) { throw new DeveloperError('vector is required.'); } @@ -15140,34 +15183,51 @@ define('Core/AttributeCompression',[ result.y = (1.0 - Math.abs(x)) * CesiumMath.signNotZero(y); } - result.x = CesiumMath.toSNorm(result.x); - result.y = CesiumMath.toSNorm(result.y); + result.x = CesiumMath.toSNorm(result.x, rangeMax); + result.y = CesiumMath.toSNorm(result.y, rangeMax); return result; }; + /** + * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * + * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. + * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. + * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * + * @exception {DeveloperError} vector must be normalized. + * + * @see AttributeCompression.octEncodeInRange + * @see AttributeCompression.octDecode + */ + AttributeCompression.octEncode = function(vector, result) { + return AttributeCompression.octEncodeInRange(vector, 255, result); + }; + /** * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component vector. * * @param {Number} x The x component of the oct-encoded unit length vector. * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. * @param {Cartesian3} result The decoded and normalized vector * @returns {Cartesian3} The decoded and normalized vector. * - * @exception {DeveloperError} x and y must be a signed normalized integer between 0 and 255. + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and rangeMax. * - * @see AttributeCompression.octEncode + * @see AttributeCompression.octEncodeInRange */ - AttributeCompression.octDecode = function(x, y, result) { + AttributeCompression.octDecodeInRange = function(x, y, rangeMax, result) { if (!defined(result)) { throw new DeveloperError('result is required.'); } - if (x < 0 || x > 255 || y < 0 || y > 255) { - throw new DeveloperError('x and y must be a signed normalized integer between 0 and 255'); + if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) { + throw new DeveloperError('x and y must be a signed normalized integer between 0 and ' + rangeMax); } - result.x = CesiumMath.fromSNorm(x); - result.y = CesiumMath.fromSNorm(y); + result.x = CesiumMath.fromSNorm(x, rangeMax); + result.y = CesiumMath.fromSNorm(y, rangeMax); result.z = 1.0 - (Math.abs(result.x) + Math.abs(result.y)); if (result.z < 0.0) @@ -15180,6 +15240,22 @@ define('Core/AttributeCompression',[ return Cartesian3.normalize(result, result); }; + /** + * Decodes a unit-length vector in 2 byte 'oct' encoding to a normalized 3-component vector. + * + * @param {Number} x The x component of the oct-encoded unit length vector. + * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Cartesian3} result The decoded and normalized vector. + * @returns {Cartesian3} The decoded and normalized vector. + * + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and 255. + * + * @see AttributeCompression.octDecodeInRange + */ + AttributeCompression.octDecode = function(x, y, result) { + return AttributeCompression.octDecodeInRange(x, y, 255, result); + }; + /** * Packs an oct encoded vector into a single floating-point number. * @@ -22581,7 +22657,8 @@ define('Core/JulianDate',[ new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35), // July 1, 2012 00:00:00 UTC - new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36) // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36), // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457754, 43237.0, TimeStandard.TAI), 37) // January 1, 2017 00:00:00 UTC ]; return JulianDate; @@ -25423,6 +25500,8 @@ define('Core/VertexFormat',[ * @param {VertexFormat} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ VertexFormat.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -25440,6 +25519,8 @@ define('Core/VertexFormat',[ array[startingIndex++] = value.binormal ? 1.0 : 0.0; array[startingIndex++] = value.tangent ? 1.0 : 0.0; array[startingIndex++] = value.color ? 1.0 : 0.0; + + return array; }; /** @@ -26238,6 +26319,8 @@ define('Core/EllipseGeometry',[ * @param {EllipseGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ EllipseGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -26269,6 +26352,8 @@ define('Core/EllipseGeometry',[ array[startingIndex++] = value._granularity; array[startingIndex++] = value._extrudedHeight; array[startingIndex] = value._extrude ? 1.0 : 0.0; + + return array; }; var scratchCenter = new Cartesian3(); diff --git a/app/assets/javascripts/Cesium/Workers/createEllipseOutlineGeometry.js b/app/assets/javascripts/Cesium/Workers/createEllipseOutlineGeometry.js index 704a40d..87a6020 100644 --- a/app/assets/javascripts/Cesium/Workers/createEllipseOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createEllipseOutlineGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -12497,6 +12529,8 @@ define('Core/Quaternion',[ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -12513,6 +12547,8 @@ define('Core/Quaternion',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -13142,7 +13178,7 @@ define('Core/Quaternion',[ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { @@ -14547,6 +14583,8 @@ define('Core/EllipseOutlineGeometry',[ * @param {EllipseOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ EllipseOutlineGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -14573,6 +14611,8 @@ define('Core/EllipseOutlineGeometry',[ array[startingIndex++] = defaultValue(value._extrudedHeight, 0.0); array[startingIndex++] = value._extrude ? 1.0 : 0.0; array[startingIndex] = value._numberOfVerticalLines; + + return array; }; var scratchCenter = new Cartesian3(); diff --git a/app/assets/javascripts/Cesium/Workers/createEllipsoidGeometry.js b/app/assets/javascripts/Cesium/Workers/createEllipsoidGeometry.js index a171334..dd98f01 100644 --- a/app/assets/javascripts/Cesium/Workers/createEllipsoidGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createEllipsoidGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -11045,6 +11077,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -11058,6 +11092,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -13958,6 +13994,8 @@ define('Core/VertexFormat',[ * @param {VertexFormat} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ VertexFormat.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -13975,6 +14013,8 @@ define('Core/VertexFormat',[ array[startingIndex++] = value.binormal ? 1.0 : 0.0; array[startingIndex++] = value.tangent ? 1.0 : 0.0; array[startingIndex++] = value.color ? 1.0 : 0.0; + + return array; }; /** @@ -14135,6 +14175,8 @@ define('Core/EllipsoidGeometry',[ * @param {EllipsoidGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ EllipsoidGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -14154,6 +14196,8 @@ define('Core/EllipsoidGeometry',[ array[startingIndex++] = value._stackPartitions; array[startingIndex] = value._slicePartitions; + + return array; }; var scratchRadii = new Cartesian3(); diff --git a/app/assets/javascripts/Cesium/Workers/createEllipsoidOutlineGeometry.js b/app/assets/javascripts/Cesium/Workers/createEllipsoidOutlineGeometry.js index 33543ab..16d9651 100644 --- a/app/assets/javascripts/Cesium/Workers/createEllipsoidOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createEllipsoidOutlineGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -13063,6 +13095,8 @@ define('Core/EllipsoidOutlineGeometry',[ * @param {EllipsoidOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ EllipsoidOutlineGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -13080,6 +13114,8 @@ define('Core/EllipsoidOutlineGeometry',[ array[startingIndex++] = value._stackPartitions; array[startingIndex++] = value._slicePartitions; array[startingIndex] = value._subdivisions; + + return array; }; var scratchRadii = new Cartesian3(); diff --git a/app/assets/javascripts/Cesium/Workers/createGeometry.js b/app/assets/javascripts/Cesium/Workers/createGeometry.js index 326ac01..9fa2ddf 100644 --- a/app/assets/javascripts/Cesium/Workers/createGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -11786,7 +11818,7 @@ define('Core/Color',[ * @example * var cesiumBlue = Cesium.Color.fromCssColorString('#67ADDF'); * var green = Cesium.Color.fromCssColorString('green'); - * + * * @see {@link http://www.w3.org/TR/css3-color|CSS color values} */ Color.fromCssColorString = function(color, result) { @@ -11855,6 +11887,8 @@ define('Core/Color',[ * @param {Color} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Color.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -11869,6 +11903,8 @@ define('Core/Color',[ array[startingIndex++] = value.green; array[startingIndex++] = value.blue; array[startingIndex] = value.alpha; + + return array; }; /** @@ -12059,7 +12095,7 @@ define('Core/Color',[ * * @example * var rgba = Cesium.Color.BLUE.toRgba(); - * + * * @see Color.fromRgba */ Color.prototype.toRgba = function() { @@ -15159,6 +15195,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -15172,6 +15210,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -15810,12 +15850,14 @@ define('Core/Cartesian2',[ define('Core/AttributeCompression',[ './Cartesian2', './Cartesian3', + './defaultValue', './defined', './DeveloperError', './Math' ], function( Cartesian2, Cartesian3, + defaultValue, defined, DeveloperError, CesiumMath) { @@ -15831,21 +15873,22 @@ define('Core/AttributeCompression',[ var AttributeCompression = {}; /** - * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * Encodes a normalized vector into 2 SNORM values in the range of [0-rangeMax] following the 'oct' encoding. * - * Oct encoding is a compact representation of unit length vectors. The encoding and decoding functions are low cost, and represent the normalized vector within 1 degree of error. + * Oct encoding is a compact representation of unit length vectors. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors", * Cigolle et al 2014: {@link http://jcgt.org/published/0003/02/01/} * - * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. - * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. - * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * @param {Cartesian3} vector The normalized vector to be compressed into 2 component 'oct' encoding. + * @param {Cartesian2} result The 2 component oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. + * @returns {Cartesian2} The 2 component oct-encoded unit length vector. * * @exception {DeveloperError} vector must be normalized. * - * @see AttributeCompression.octDecode + * @see AttributeCompression.octDecodeInRange */ - AttributeCompression.octEncode = function(vector, result) { + AttributeCompression.octEncodeInRange = function(vector, rangeMax, result) { if (!defined(vector)) { throw new DeveloperError('vector is required.'); } @@ -15866,34 +15909,51 @@ define('Core/AttributeCompression',[ result.y = (1.0 - Math.abs(x)) * CesiumMath.signNotZero(y); } - result.x = CesiumMath.toSNorm(result.x); - result.y = CesiumMath.toSNorm(result.y); + result.x = CesiumMath.toSNorm(result.x, rangeMax); + result.y = CesiumMath.toSNorm(result.y, rangeMax); return result; }; + /** + * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * + * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. + * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. + * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * + * @exception {DeveloperError} vector must be normalized. + * + * @see AttributeCompression.octEncodeInRange + * @see AttributeCompression.octDecode + */ + AttributeCompression.octEncode = function(vector, result) { + return AttributeCompression.octEncodeInRange(vector, 255, result); + }; + /** * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component vector. * * @param {Number} x The x component of the oct-encoded unit length vector. * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. * @param {Cartesian3} result The decoded and normalized vector * @returns {Cartesian3} The decoded and normalized vector. * - * @exception {DeveloperError} x and y must be a signed normalized integer between 0 and 255. + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and rangeMax. * - * @see AttributeCompression.octEncode + * @see AttributeCompression.octEncodeInRange */ - AttributeCompression.octDecode = function(x, y, result) { + AttributeCompression.octDecodeInRange = function(x, y, rangeMax, result) { if (!defined(result)) { throw new DeveloperError('result is required.'); } - if (x < 0 || x > 255 || y < 0 || y > 255) { - throw new DeveloperError('x and y must be a signed normalized integer between 0 and 255'); + if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) { + throw new DeveloperError('x and y must be a signed normalized integer between 0 and ' + rangeMax); } - result.x = CesiumMath.fromSNorm(x); - result.y = CesiumMath.fromSNorm(y); + result.x = CesiumMath.fromSNorm(x, rangeMax); + result.y = CesiumMath.fromSNorm(y, rangeMax); result.z = 1.0 - (Math.abs(result.x) + Math.abs(result.y)); if (result.z < 0.0) @@ -15906,6 +15966,22 @@ define('Core/AttributeCompression',[ return Cartesian3.normalize(result, result); }; + /** + * Decodes a unit-length vector in 2 byte 'oct' encoding to a normalized 3-component vector. + * + * @param {Number} x The x component of the oct-encoded unit length vector. + * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Cartesian3} result The decoded and normalized vector. + * @returns {Cartesian3} The decoded and normalized vector. + * + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and 255. + * + * @see AttributeCompression.octDecodeInRange + */ + AttributeCompression.octDecode = function(x, y, result) { + return AttributeCompression.octDecodeInRange(x, y, 255, result); + }; + /** * Packs an oct encoded vector into a single floating-point number. * diff --git a/app/assets/javascripts/Cesium/Workers/createPointGeometry.js b/app/assets/javascripts/Cesium/Workers/createPointGeometry.js index f683aeb..8153aa4 100644 --- a/app/assets/javascripts/Cesium/Workers/createPointGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createPointGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** diff --git a/app/assets/javascripts/Cesium/Workers/createPolygonGeometry.js b/app/assets/javascripts/Cesium/Workers/createPolygonGeometry.js index 638d2a6..3eba39c 100644 --- a/app/assets/javascripts/Cesium/Workers/createPolygonGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createPolygonGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3406,6 +3418,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3419,6 +3433,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -4318,6 +4334,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -4334,6 +4352,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -5094,6 +5114,8 @@ define('Core/BoundingRectangle',[ * @param {BoundingRectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingRectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5109,6 +5131,8 @@ define('Core/BoundingRectangle',[ array[startingIndex++] = value.y; array[startingIndex++] = value.width; array[startingIndex] = value.height; + + return array; }; /** @@ -5497,6 +5521,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5518,6 +5544,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -6359,7 +6387,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -7065,6 +7093,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -7080,6 +7110,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -7932,6 +7964,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -7960,6 +7994,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -9564,7 +9600,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -9601,7 +9637,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -11556,6 +11592,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -11573,6 +11611,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -17734,7 +17774,8 @@ define('Core/JulianDate',[ new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35), // July 1, 2012 00:00:00 UTC - new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36) // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36), // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457754, 43237.0, TimeStandard.TAI), 37) // January 1, 2017 00:00:00 UTC ]; return JulianDate; @@ -19622,6 +19663,8 @@ define('Core/Quaternion',[ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -19638,6 +19681,8 @@ define('Core/Quaternion',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -20267,7 +20312,7 @@ define('Core/Quaternion',[ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { @@ -22456,12 +22501,14 @@ define('Core/GeometryInstance',[ define('Core/AttributeCompression',[ './Cartesian2', './Cartesian3', + './defaultValue', './defined', './DeveloperError', './Math' ], function( Cartesian2, Cartesian3, + defaultValue, defined, DeveloperError, CesiumMath) { @@ -22477,21 +22524,22 @@ define('Core/AttributeCompression',[ var AttributeCompression = {}; /** - * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * Encodes a normalized vector into 2 SNORM values in the range of [0-rangeMax] following the 'oct' encoding. * - * Oct encoding is a compact representation of unit length vectors. The encoding and decoding functions are low cost, and represent the normalized vector within 1 degree of error. + * Oct encoding is a compact representation of unit length vectors. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors", * Cigolle et al 2014: {@link http://jcgt.org/published/0003/02/01/} * - * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. - * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. - * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * @param {Cartesian3} vector The normalized vector to be compressed into 2 component 'oct' encoding. + * @param {Cartesian2} result The 2 component oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. + * @returns {Cartesian2} The 2 component oct-encoded unit length vector. * * @exception {DeveloperError} vector must be normalized. * - * @see AttributeCompression.octDecode + * @see AttributeCompression.octDecodeInRange */ - AttributeCompression.octEncode = function(vector, result) { + AttributeCompression.octEncodeInRange = function(vector, rangeMax, result) { if (!defined(vector)) { throw new DeveloperError('vector is required.'); } @@ -22512,34 +22560,51 @@ define('Core/AttributeCompression',[ result.y = (1.0 - Math.abs(x)) * CesiumMath.signNotZero(y); } - result.x = CesiumMath.toSNorm(result.x); - result.y = CesiumMath.toSNorm(result.y); + result.x = CesiumMath.toSNorm(result.x, rangeMax); + result.y = CesiumMath.toSNorm(result.y, rangeMax); return result; }; + /** + * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * + * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. + * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. + * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * + * @exception {DeveloperError} vector must be normalized. + * + * @see AttributeCompression.octEncodeInRange + * @see AttributeCompression.octDecode + */ + AttributeCompression.octEncode = function(vector, result) { + return AttributeCompression.octEncodeInRange(vector, 255, result); + }; + /** * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component vector. * * @param {Number} x The x component of the oct-encoded unit length vector. * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. * @param {Cartesian3} result The decoded and normalized vector * @returns {Cartesian3} The decoded and normalized vector. * - * @exception {DeveloperError} x and y must be a signed normalized integer between 0 and 255. + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and rangeMax. * - * @see AttributeCompression.octEncode + * @see AttributeCompression.octEncodeInRange */ - AttributeCompression.octDecode = function(x, y, result) { + AttributeCompression.octDecodeInRange = function(x, y, rangeMax, result) { if (!defined(result)) { throw new DeveloperError('result is required.'); } - if (x < 0 || x > 255 || y < 0 || y > 255) { - throw new DeveloperError('x and y must be a signed normalized integer between 0 and 255'); + if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) { + throw new DeveloperError('x and y must be a signed normalized integer between 0 and ' + rangeMax); } - result.x = CesiumMath.fromSNorm(x); - result.y = CesiumMath.fromSNorm(y); + result.x = CesiumMath.fromSNorm(x, rangeMax); + result.y = CesiumMath.fromSNorm(y, rangeMax); result.z = 1.0 - (Math.abs(result.x) + Math.abs(result.y)); if (result.z < 0.0) @@ -22552,6 +22617,22 @@ define('Core/AttributeCompression',[ return Cartesian3.normalize(result, result); }; + /** + * Decodes a unit-length vector in 2 byte 'oct' encoding to a normalized 3-component vector. + * + * @param {Number} x The x component of the oct-encoded unit length vector. + * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Cartesian3} result The decoded and normalized vector. + * @returns {Cartesian3} The decoded and normalized vector. + * + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and 255. + * + * @see AttributeCompression.octDecodeInRange + */ + AttributeCompression.octDecode = function(x, y, result) { + return AttributeCompression.octDecodeInRange(x, y, 255, result); + }; + /** * Packs an oct encoded vector into a single floating-point number. * @@ -27809,6 +27890,8 @@ define('Core/VertexFormat',[ * @param {VertexFormat} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ VertexFormat.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -27826,6 +27909,8 @@ define('Core/VertexFormat',[ array[startingIndex++] = value.binormal ? 1.0 : 0.0; array[startingIndex++] = value.tangent ? 1.0 : 0.0; array[startingIndex++] = value.color ? 1.0 : 0.0; + + return array; }; /** @@ -28542,6 +28627,8 @@ define('Core/PolygonGeometry',[ * @param {PolygonGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ PolygonGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -28573,6 +28660,8 @@ define('Core/PolygonGeometry',[ array[startingIndex++] = value._closeTop ? 1.0 : 0.0; array[startingIndex++] = value._closeBottom ? 1.0 : 0.0; array[startingIndex] = value.packedLength; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/Workers/createPolygonOutlineGeometry.js b/app/assets/javascripts/Cesium/Workers/createPolygonOutlineGeometry.js index 5cd578b..f7b5596 100644 --- a/app/assets/javascripts/Cesium/Workers/createPolygonOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createPolygonOutlineGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3654,6 +3666,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3675,6 +3689,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4516,7 +4532,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5222,6 +5238,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5237,6 +5255,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -6089,6 +6109,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6117,6 +6139,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7721,7 +7745,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7758,7 +7782,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -9010,6 +9034,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -9026,6 +9052,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10517,6 +10545,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10534,6 +10564,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -12723,6 +12755,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -12736,6 +12770,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -17457,7 +17493,8 @@ define('Core/JulianDate',[ new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35), // July 1, 2012 00:00:00 UTC - new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36) // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36), // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457754, 43237.0, TimeStandard.TAI), 37) // January 1, 2017 00:00:00 UTC ]; return JulianDate; @@ -19345,6 +19382,8 @@ define('Core/Quaternion',[ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -19361,6 +19400,8 @@ define('Core/Quaternion',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -19990,7 +20031,7 @@ define('Core/Quaternion',[ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { @@ -22179,12 +22220,14 @@ define('Core/GeometryInstance',[ define('Core/AttributeCompression',[ './Cartesian2', './Cartesian3', + './defaultValue', './defined', './DeveloperError', './Math' ], function( Cartesian2, Cartesian3, + defaultValue, defined, DeveloperError, CesiumMath) { @@ -22200,21 +22243,22 @@ define('Core/AttributeCompression',[ var AttributeCompression = {}; /** - * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * Encodes a normalized vector into 2 SNORM values in the range of [0-rangeMax] following the 'oct' encoding. * - * Oct encoding is a compact representation of unit length vectors. The encoding and decoding functions are low cost, and represent the normalized vector within 1 degree of error. + * Oct encoding is a compact representation of unit length vectors. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors", * Cigolle et al 2014: {@link http://jcgt.org/published/0003/02/01/} * - * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. - * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. - * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * @param {Cartesian3} vector The normalized vector to be compressed into 2 component 'oct' encoding. + * @param {Cartesian2} result The 2 component oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. + * @returns {Cartesian2} The 2 component oct-encoded unit length vector. * * @exception {DeveloperError} vector must be normalized. * - * @see AttributeCompression.octDecode + * @see AttributeCompression.octDecodeInRange */ - AttributeCompression.octEncode = function(vector, result) { + AttributeCompression.octEncodeInRange = function(vector, rangeMax, result) { if (!defined(vector)) { throw new DeveloperError('vector is required.'); } @@ -22235,34 +22279,51 @@ define('Core/AttributeCompression',[ result.y = (1.0 - Math.abs(x)) * CesiumMath.signNotZero(y); } - result.x = CesiumMath.toSNorm(result.x); - result.y = CesiumMath.toSNorm(result.y); + result.x = CesiumMath.toSNorm(result.x, rangeMax); + result.y = CesiumMath.toSNorm(result.y, rangeMax); return result; }; + /** + * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * + * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. + * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. + * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * + * @exception {DeveloperError} vector must be normalized. + * + * @see AttributeCompression.octEncodeInRange + * @see AttributeCompression.octDecode + */ + AttributeCompression.octEncode = function(vector, result) { + return AttributeCompression.octEncodeInRange(vector, 255, result); + }; + /** * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component vector. * * @param {Number} x The x component of the oct-encoded unit length vector. * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. * @param {Cartesian3} result The decoded and normalized vector * @returns {Cartesian3} The decoded and normalized vector. * - * @exception {DeveloperError} x and y must be a signed normalized integer between 0 and 255. + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and rangeMax. * - * @see AttributeCompression.octEncode + * @see AttributeCompression.octEncodeInRange */ - AttributeCompression.octDecode = function(x, y, result) { + AttributeCompression.octDecodeInRange = function(x, y, rangeMax, result) { if (!defined(result)) { throw new DeveloperError('result is required.'); } - if (x < 0 || x > 255 || y < 0 || y > 255) { - throw new DeveloperError('x and y must be a signed normalized integer between 0 and 255'); + if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) { + throw new DeveloperError('x and y must be a signed normalized integer between 0 and ' + rangeMax); } - result.x = CesiumMath.fromSNorm(x); - result.y = CesiumMath.fromSNorm(y); + result.x = CesiumMath.fromSNorm(x, rangeMax); + result.y = CesiumMath.fromSNorm(y, rangeMax); result.z = 1.0 - (Math.abs(result.x) + Math.abs(result.y)); if (result.z < 0.0) @@ -22275,6 +22336,22 @@ define('Core/AttributeCompression',[ return Cartesian3.normalize(result, result); }; + /** + * Decodes a unit-length vector in 2 byte 'oct' encoding to a normalized 3-component vector. + * + * @param {Number} x The x component of the oct-encoded unit length vector. + * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Cartesian3} result The decoded and normalized vector. + * @returns {Cartesian3} The decoded and normalized vector. + * + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and 255. + * + * @see AttributeCompression.octDecodeInRange + */ + AttributeCompression.octDecode = function(x, y, result) { + return AttributeCompression.octDecodeInRange(x, y, 255, result); + }; + /** * Packs an oct encoded vector into a single floating-point number. * @@ -27533,6 +27610,8 @@ define('Core/PolygonOutlineGeometry',[ * @param {PolygonOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ PolygonOutlineGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -27555,6 +27634,8 @@ define('Core/PolygonOutlineGeometry',[ array[startingIndex++] = value._extrude ? 1.0 : 0.0; array[startingIndex++] = value._perPositionHeight ? 1.0 : 0.0; array[startingIndex++] = value.packedLength; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/Workers/createPolylineGeometry.js b/app/assets/javascripts/Cesium/Workers/createPolylineGeometry.js index b74321d..08daedf 100644 --- a/app/assets/javascripts/Cesium/Workers/createPolylineGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createPolylineGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3654,6 +3666,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3675,6 +3689,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4516,7 +4532,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5222,6 +5238,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5237,6 +5255,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -6089,6 +6109,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6117,6 +6139,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7721,7 +7745,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7758,7 +7782,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -9010,6 +9034,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -9026,6 +9052,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10517,6 +10545,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10534,6 +10564,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -11886,7 +11918,7 @@ define('Core/Color',[ * @example * var cesiumBlue = Cesium.Color.fromCssColorString('#67ADDF'); * var green = Cesium.Color.fromCssColorString('green'); - * + * * @see {@link http://www.w3.org/TR/css3-color|CSS color values} */ Color.fromCssColorString = function(color, result) { @@ -11955,6 +11987,8 @@ define('Core/Color',[ * @param {Color} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Color.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -11969,6 +12003,8 @@ define('Core/Color',[ array[startingIndex++] = value.green; array[startingIndex++] = value.blue; array[startingIndex] = value.alpha; + + return array; }; /** @@ -12159,7 +12195,7 @@ define('Core/Color',[ * * @example * var rgba = Cesium.Color.BLUE.toRgba(); - * + * * @see Color.fromRgba */ Color.prototype.toRgba = function() { @@ -17609,11 +17645,13 @@ define('Core/PolylinePipeline',[ var length = positions.length; var ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84); var height = defaultValue(options.height, 0); + var hasHeightArray = isArray(height); if (length < 1) { return []; } else if (length === 1) { var p = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst); + height = hasHeightArray ? height[0] : height; if (height !== 0) { var n = ellipsoid.geodeticSurfaceNormal(p, cartesian); Cartesian3.multiplyByScalar(n, height, n); @@ -17639,7 +17677,6 @@ define('Core/PolylinePipeline',[ var arrayLength = (numPoints + 1) * 3; var newPositions = new Array(arrayLength); var offset = 0; - var hasHeightArray = isArray(height); for (i = 0; i < length - 1; i++) { var p0 = positions[i]; @@ -17923,6 +17960,8 @@ define('Core/VertexFormat',[ * @param {VertexFormat} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ VertexFormat.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -17940,6 +17979,8 @@ define('Core/VertexFormat',[ array[startingIndex++] = value.binormal ? 1.0 : 0.0; array[startingIndex++] = value.tangent ? 1.0 : 0.0; array[startingIndex++] = value.color ? 1.0 : 0.0; + + return array; }; /** @@ -18155,6 +18196,8 @@ define('Core/PolylineGeometry',[ * @param {PolylineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ PolylineGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -18194,6 +18237,8 @@ define('Core/PolylineGeometry',[ array[startingIndex++] = value._colorsPerVertex ? 1.0 : 0.0; array[startingIndex++] = value._followSurface ? 1.0 : 0.0; array[startingIndex] = value._granularity; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/Workers/createPolylineVolumeGeometry.js b/app/assets/javascripts/Cesium/Workers/createPolylineVolumeGeometry.js index e5776dc..b6fa85a 100644 --- a/app/assets/javascripts/Cesium/Workers/createPolylineVolumeGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createPolylineVolumeGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3506,6 +3518,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3519,6 +3533,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -4418,6 +4434,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -4434,6 +4452,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -5194,6 +5214,8 @@ define('Core/BoundingRectangle',[ * @param {BoundingRectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingRectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5209,6 +5231,8 @@ define('Core/BoundingRectangle',[ array[startingIndex++] = value.y; array[startingIndex++] = value.width; array[startingIndex] = value.height; + + return array; }; /** @@ -5597,6 +5621,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5618,6 +5644,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -6459,7 +6487,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -7165,6 +7193,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -7180,6 +7210,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -8032,6 +8064,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8060,6 +8094,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -9664,7 +9700,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -9701,7 +9737,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -11656,6 +11692,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -11673,6 +11711,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -14110,12 +14150,14 @@ define('Core/GeometryAttributes',[ define('Core/AttributeCompression',[ './Cartesian2', './Cartesian3', + './defaultValue', './defined', './DeveloperError', './Math' ], function( Cartesian2, Cartesian3, + defaultValue, defined, DeveloperError, CesiumMath) { @@ -14131,21 +14173,22 @@ define('Core/AttributeCompression',[ var AttributeCompression = {}; /** - * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * Encodes a normalized vector into 2 SNORM values in the range of [0-rangeMax] following the 'oct' encoding. * - * Oct encoding is a compact representation of unit length vectors. The encoding and decoding functions are low cost, and represent the normalized vector within 1 degree of error. + * Oct encoding is a compact representation of unit length vectors. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors", * Cigolle et al 2014: {@link http://jcgt.org/published/0003/02/01/} * - * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. - * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. - * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * @param {Cartesian3} vector The normalized vector to be compressed into 2 component 'oct' encoding. + * @param {Cartesian2} result The 2 component oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. + * @returns {Cartesian2} The 2 component oct-encoded unit length vector. * * @exception {DeveloperError} vector must be normalized. * - * @see AttributeCompression.octDecode + * @see AttributeCompression.octDecodeInRange */ - AttributeCompression.octEncode = function(vector, result) { + AttributeCompression.octEncodeInRange = function(vector, rangeMax, result) { if (!defined(vector)) { throw new DeveloperError('vector is required.'); } @@ -14166,34 +14209,51 @@ define('Core/AttributeCompression',[ result.y = (1.0 - Math.abs(x)) * CesiumMath.signNotZero(y); } - result.x = CesiumMath.toSNorm(result.x); - result.y = CesiumMath.toSNorm(result.y); + result.x = CesiumMath.toSNorm(result.x, rangeMax); + result.y = CesiumMath.toSNorm(result.y, rangeMax); return result; }; + /** + * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * + * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. + * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. + * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * + * @exception {DeveloperError} vector must be normalized. + * + * @see AttributeCompression.octEncodeInRange + * @see AttributeCompression.octDecode + */ + AttributeCompression.octEncode = function(vector, result) { + return AttributeCompression.octEncodeInRange(vector, 255, result); + }; + /** * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component vector. * * @param {Number} x The x component of the oct-encoded unit length vector. * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. * @param {Cartesian3} result The decoded and normalized vector * @returns {Cartesian3} The decoded and normalized vector. * - * @exception {DeveloperError} x and y must be a signed normalized integer between 0 and 255. + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and rangeMax. * - * @see AttributeCompression.octEncode + * @see AttributeCompression.octEncodeInRange */ - AttributeCompression.octDecode = function(x, y, result) { + AttributeCompression.octDecodeInRange = function(x, y, rangeMax, result) { if (!defined(result)) { throw new DeveloperError('result is required.'); } - if (x < 0 || x > 255 || y < 0 || y > 255) { - throw new DeveloperError('x and y must be a signed normalized integer between 0 and 255'); + if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) { + throw new DeveloperError('x and y must be a signed normalized integer between 0 and ' + rangeMax); } - result.x = CesiumMath.fromSNorm(x); - result.y = CesiumMath.fromSNorm(y); + result.x = CesiumMath.fromSNorm(x, rangeMax); + result.y = CesiumMath.fromSNorm(y, rangeMax); result.z = 1.0 - (Math.abs(result.x) + Math.abs(result.y)); if (result.z < 0.0) @@ -14206,6 +14266,22 @@ define('Core/AttributeCompression',[ return Cartesian3.normalize(result, result); }; + /** + * Decodes a unit-length vector in 2 byte 'oct' encoding to a normalized 3-component vector. + * + * @param {Number} x The x component of the oct-encoded unit length vector. + * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Cartesian3} result The decoded and normalized vector. + * @returns {Cartesian3} The decoded and normalized vector. + * + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and 255. + * + * @see AttributeCompression.octDecodeInRange + */ + AttributeCompression.octDecode = function(x, y, result) { + return AttributeCompression.octDecodeInRange(x, y, 255, result); + }; + /** * Packs an oct encoded vector into a single floating-point number. * @@ -22618,7 +22694,8 @@ define('Core/JulianDate',[ new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35), // July 1, 2012 00:00:00 UTC - new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36) // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36), // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457754, 43237.0, TimeStandard.TAI), 37) // January 1, 2017 00:00:00 UTC ]; return JulianDate; @@ -24506,6 +24583,8 @@ define('Core/Quaternion',[ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -24522,6 +24601,8 @@ define('Core/Quaternion',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -25151,7 +25232,7 @@ define('Core/Quaternion',[ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { @@ -27839,11 +27920,13 @@ define('Core/PolylinePipeline',[ var length = positions.length; var ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84); var height = defaultValue(options.height, 0); + var hasHeightArray = isArray(height); if (length < 1) { return []; } else if (length === 1) { var p = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst); + height = hasHeightArray ? height[0] : height; if (height !== 0) { var n = ellipsoid.geodeticSurfaceNormal(p, cartesian); Cartesian3.multiplyByScalar(n, height, n); @@ -27869,7 +27952,6 @@ define('Core/PolylinePipeline',[ var arrayLength = (numPoints + 1) * 3; var newPositions = new Array(arrayLength); var offset = 0; - var hasHeightArray = isArray(height); for (i = 0; i < length - 1; i++) { var p0 = positions[i]; @@ -28565,6 +28647,8 @@ define('Core/VertexFormat',[ * @param {VertexFormat} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ VertexFormat.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -28582,6 +28666,8 @@ define('Core/VertexFormat',[ array[startingIndex++] = value.binormal ? 1.0 : 0.0; array[startingIndex++] = value.tangent ? 1.0 : 0.0; array[startingIndex++] = value.color ? 1.0 : 0.0; + + return array; }; /** @@ -28892,6 +28978,8 @@ define('Core/PolylineVolumeGeometry',[ * @param {PolylineVolumeGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ PolylineVolumeGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -28929,6 +29017,8 @@ define('Core/PolylineVolumeGeometry',[ array[startingIndex++] = value._cornerType; array[startingIndex] = value._granularity; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/Workers/createPolylineVolumeOutlineGeometry.js b/app/assets/javascripts/Cesium/Workers/createPolylineVolumeOutlineGeometry.js index a2f7082..bca5209 100644 --- a/app/assets/javascripts/Cesium/Workers/createPolylineVolumeOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createPolylineVolumeOutlineGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3506,6 +3518,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3519,6 +3533,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -4418,6 +4434,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -4434,6 +4452,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -5194,6 +5214,8 @@ define('Core/BoundingRectangle',[ * @param {BoundingRectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingRectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5209,6 +5231,8 @@ define('Core/BoundingRectangle',[ array[startingIndex++] = value.y; array[startingIndex++] = value.width; array[startingIndex] = value.height; + + return array; }; /** @@ -5597,6 +5621,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5618,6 +5644,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -6459,7 +6487,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -7165,6 +7193,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -7180,6 +7210,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -8032,6 +8064,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8060,6 +8094,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -9664,7 +9700,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -9701,7 +9737,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -11656,6 +11692,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -11673,6 +11711,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -19222,7 +19262,8 @@ define('Core/JulianDate',[ new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35), // July 1, 2012 00:00:00 UTC - new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36) // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36), // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457754, 43237.0, TimeStandard.TAI), 37) // January 1, 2017 00:00:00 UTC ]; return JulianDate; @@ -21110,6 +21151,8 @@ define('Core/Quaternion',[ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -21126,6 +21169,8 @@ define('Core/Quaternion',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -21755,7 +21800,7 @@ define('Core/Quaternion',[ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { @@ -24526,11 +24571,13 @@ define('Core/PolylinePipeline',[ var length = positions.length; var ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84); var height = defaultValue(options.height, 0); + var hasHeightArray = isArray(height); if (length < 1) { return []; } else if (length === 1) { var p = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst); + height = hasHeightArray ? height[0] : height; if (height !== 0) { var n = ellipsoid.geodeticSurfaceNormal(p, cartesian); Cartesian3.multiplyByScalar(n, height, n); @@ -24556,7 +24603,6 @@ define('Core/PolylinePipeline',[ var arrayLength = (numPoints + 1) * 3; var newPositions = new Array(arrayLength); var offset = 0; - var hasHeightArray = isArray(height); for (i = 0; i < length - 1; i++) { var p0 = positions[i]; @@ -25188,6 +25234,8 @@ define('Core/PolylineVolumeOutlineGeometry',[ * @param {PolylineVolumeOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ PolylineVolumeOutlineGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -25222,6 +25270,8 @@ define('Core/PolylineVolumeOutlineGeometry',[ array[startingIndex++] = value._cornerType; array[startingIndex] = value._granularity; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/Workers/createRectangleGeometry.js b/app/assets/javascripts/Cesium/Workers/createRectangleGeometry.js index 35e7541..b835f4c 100644 --- a/app/assets/javascripts/Cesium/Workers/createRectangleGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createRectangleGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3395,6 +3407,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3411,6 +3425,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -4358,6 +4374,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -4379,6 +4397,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -5220,7 +5240,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5926,6 +5946,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5941,6 +5963,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -6793,6 +6817,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6821,6 +6847,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -8425,7 +8453,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -8462,7 +8490,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -11045,6 +11077,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -11058,6 +11092,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -13715,12 +13751,14 @@ define('Core/GeometryInstance',[ define('Core/AttributeCompression',[ './Cartesian2', './Cartesian3', + './defaultValue', './defined', './DeveloperError', './Math' ], function( Cartesian2, Cartesian3, + defaultValue, defined, DeveloperError, CesiumMath) { @@ -13736,21 +13774,22 @@ define('Core/AttributeCompression',[ var AttributeCompression = {}; /** - * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * Encodes a normalized vector into 2 SNORM values in the range of [0-rangeMax] following the 'oct' encoding. * - * Oct encoding is a compact representation of unit length vectors. The encoding and decoding functions are low cost, and represent the normalized vector within 1 degree of error. + * Oct encoding is a compact representation of unit length vectors. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors", * Cigolle et al 2014: {@link http://jcgt.org/published/0003/02/01/} * - * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. - * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. - * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * @param {Cartesian3} vector The normalized vector to be compressed into 2 component 'oct' encoding. + * @param {Cartesian2} result The 2 component oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. + * @returns {Cartesian2} The 2 component oct-encoded unit length vector. * * @exception {DeveloperError} vector must be normalized. * - * @see AttributeCompression.octDecode + * @see AttributeCompression.octDecodeInRange */ - AttributeCompression.octEncode = function(vector, result) { + AttributeCompression.octEncodeInRange = function(vector, rangeMax, result) { if (!defined(vector)) { throw new DeveloperError('vector is required.'); } @@ -13771,34 +13810,51 @@ define('Core/AttributeCompression',[ result.y = (1.0 - Math.abs(x)) * CesiumMath.signNotZero(y); } - result.x = CesiumMath.toSNorm(result.x); - result.y = CesiumMath.toSNorm(result.y); + result.x = CesiumMath.toSNorm(result.x, rangeMax); + result.y = CesiumMath.toSNorm(result.y, rangeMax); return result; }; + /** + * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * + * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. + * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. + * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * + * @exception {DeveloperError} vector must be normalized. + * + * @see AttributeCompression.octEncodeInRange + * @see AttributeCompression.octDecode + */ + AttributeCompression.octEncode = function(vector, result) { + return AttributeCompression.octEncodeInRange(vector, 255, result); + }; + /** * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component vector. * * @param {Number} x The x component of the oct-encoded unit length vector. * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. * @param {Cartesian3} result The decoded and normalized vector * @returns {Cartesian3} The decoded and normalized vector. * - * @exception {DeveloperError} x and y must be a signed normalized integer between 0 and 255. + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and rangeMax. * - * @see AttributeCompression.octEncode + * @see AttributeCompression.octEncodeInRange */ - AttributeCompression.octDecode = function(x, y, result) { + AttributeCompression.octDecodeInRange = function(x, y, rangeMax, result) { if (!defined(result)) { throw new DeveloperError('result is required.'); } - if (x < 0 || x > 255 || y < 0 || y > 255) { - throw new DeveloperError('x and y must be a signed normalized integer between 0 and 255'); + if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) { + throw new DeveloperError('x and y must be a signed normalized integer between 0 and ' + rangeMax); } - result.x = CesiumMath.fromSNorm(x); - result.y = CesiumMath.fromSNorm(y); + result.x = CesiumMath.fromSNorm(x, rangeMax); + result.y = CesiumMath.fromSNorm(y, rangeMax); result.z = 1.0 - (Math.abs(result.x) + Math.abs(result.y)); if (result.z < 0.0) @@ -13811,6 +13867,22 @@ define('Core/AttributeCompression',[ return Cartesian3.normalize(result, result); }; + /** + * Decodes a unit-length vector in 2 byte 'oct' encoding to a normalized 3-component vector. + * + * @param {Number} x The x component of the oct-encoded unit length vector. + * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Cartesian3} result The decoded and normalized vector. + * @returns {Cartesian3} The decoded and normalized vector. + * + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and 255. + * + * @see AttributeCompression.octDecodeInRange + */ + AttributeCompression.octDecode = function(x, y, result) { + return AttributeCompression.octDecodeInRange(x, y, 255, result); + }; + /** * Packs an oct encoded vector into a single floating-point number. * @@ -18832,6 +18904,8 @@ define('Core/Matrix2',[ * @param {Matrix2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -18848,6 +18922,8 @@ define('Core/Matrix2',[ array[startingIndex++] = value[1]; array[startingIndex++] = value[2]; array[startingIndex++] = value[3]; + + return array; }; /** @@ -19426,7 +19502,7 @@ define('Core/Matrix2',[ * @example * // Instead of Cesium.Matrix2.multiply(m, Cesium.Matrix2.fromScale(scale), m); * Cesium.Matrix2.multiplyByScale(m, scale, m); - * + * * @see Matrix2.fromScale * @see Matrix2.multiplyByUniformScale */ @@ -23017,7 +23093,8 @@ define('Core/JulianDate',[ new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35), // July 1, 2012 00:00:00 UTC - new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36) // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36), // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457754, 43237.0, TimeStandard.TAI), 37) // January 1, 2017 00:00:00 UTC ]; return JulianDate; @@ -24905,6 +24982,8 @@ define('Core/Quaternion',[ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -24921,6 +25000,8 @@ define('Core/Quaternion',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -25550,7 +25631,7 @@ define('Core/Quaternion',[ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { @@ -27977,6 +28058,8 @@ define('Core/VertexFormat',[ * @param {VertexFormat} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ VertexFormat.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -27994,6 +28077,8 @@ define('Core/VertexFormat',[ array[startingIndex++] = value.binormal ? 1.0 : 0.0; array[startingIndex++] = value.tangent ? 1.0 : 0.0; array[startingIndex++] = value.color ? 1.0 : 0.0; + + return array; }; /** @@ -28681,6 +28766,8 @@ define('Core/RectangleGeometry',[ * @param {RectangleGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ RectangleGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -28713,6 +28800,8 @@ define('Core/RectangleGeometry',[ array[startingIndex++] = value._extrude ? 1.0 : 0.0; array[startingIndex++] = value._closeTop ? 1.0 : 0.0; array[startingIndex] = value._closeBottom ? 1.0 : 0.0; + + return array; }; var scratchRectangle = new Rectangle(); diff --git a/app/assets/javascripts/Cesium/Workers/createRectangleOutlineGeometry.js b/app/assets/javascripts/Cesium/Workers/createRectangleOutlineGeometry.js index c2613aa..1f7f167 100644 --- a/app/assets/javascripts/Cesium/Workers/createRectangleOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createRectangleOutlineGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3395,6 +3407,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3411,6 +3425,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -4358,6 +4374,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -4379,6 +4397,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -5220,7 +5240,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5926,6 +5946,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5941,6 +5963,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -6793,6 +6817,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6821,6 +6847,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -8425,7 +8453,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -8462,7 +8490,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -13732,6 +13764,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -13745,6 +13779,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -18699,7 +18735,8 @@ define('Core/JulianDate',[ new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35), // July 1, 2012 00:00:00 UTC - new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36) // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36), // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457754, 43237.0, TimeStandard.TAI), 37) // January 1, 2017 00:00:00 UTC ]; return JulianDate; @@ -20587,6 +20624,8 @@ define('Core/Quaternion',[ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -20603,6 +20642,8 @@ define('Core/Quaternion',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -21232,7 +21273,7 @@ define('Core/Quaternion',[ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { @@ -23391,6 +23432,8 @@ define('Core/Matrix2',[ * @param {Matrix2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -23407,6 +23450,8 @@ define('Core/Matrix2',[ array[startingIndex++] = value[1]; array[startingIndex++] = value[2]; array[startingIndex++] = value[3]; + + return array; }; /** @@ -23985,7 +24030,7 @@ define('Core/Matrix2',[ * @example * // Instead of Cesium.Matrix2.multiply(m, Cesium.Matrix2.fromScale(scale), m); * Cesium.Matrix2.multiplyByScale(m, scale, m); - * + * * @see Matrix2.fromScale * @see Matrix2.multiplyByUniformScale */ @@ -24665,6 +24710,8 @@ define('Core/RectangleOutlineGeometry',[ * @param {RectangleOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ RectangleOutlineGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -24688,6 +24735,8 @@ define('Core/RectangleOutlineGeometry',[ array[startingIndex++] = value._rotation; array[startingIndex++] = defined(value._extrudedHeight) ? 1.0 : 0.0; array[startingIndex] = defaultValue(value._extrudedHeight, 0.0); + + return array; }; var scratchRectangle = new Rectangle(); diff --git a/app/assets/javascripts/Cesium/Workers/createSimplePolylineGeometry.js b/app/assets/javascripts/Cesium/Workers/createSimplePolylineGeometry.js index 3428fba..f432e7e 100644 --- a/app/assets/javascripts/Cesium/Workers/createSimplePolylineGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createSimplePolylineGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -11786,7 +11818,7 @@ define('Core/Color',[ * @example * var cesiumBlue = Cesium.Color.fromCssColorString('#67ADDF'); * var green = Cesium.Color.fromCssColorString('green'); - * + * * @see {@link http://www.w3.org/TR/css3-color|CSS color values} */ Color.fromCssColorString = function(color, result) { @@ -11855,6 +11887,8 @@ define('Core/Color',[ * @param {Color} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Color.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -11869,6 +11903,8 @@ define('Core/Color',[ array[startingIndex++] = value.green; array[startingIndex++] = value.blue; array[startingIndex] = value.alpha; + + return array; }; /** @@ -12059,7 +12095,7 @@ define('Core/Color',[ * * @example * var rgba = Cesium.Color.BLUE.toRgba(); - * + * * @see Color.fromRgba */ Color.prototype.toRgba = function() { @@ -17509,11 +17545,13 @@ define('Core/PolylinePipeline',[ var length = positions.length; var ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84); var height = defaultValue(options.height, 0); + var hasHeightArray = isArray(height); if (length < 1) { return []; } else if (length === 1) { var p = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst); + height = hasHeightArray ? height[0] : height; if (height !== 0) { var n = ellipsoid.geodeticSurfaceNormal(p, cartesian); Cartesian3.multiplyByScalar(n, height, n); @@ -17539,7 +17577,6 @@ define('Core/PolylinePipeline',[ var arrayLength = (numPoints + 1) * 3; var newPositions = new Array(arrayLength); var offset = 0; - var hasHeightArray = isArray(height); for (i = 0; i < length - 1; i++) { var p0 = positions[i]; @@ -17737,6 +17774,8 @@ define('Core/SimplePolylineGeometry',[ * @param {SimplePolylineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ SimplePolylineGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -17772,6 +17811,8 @@ define('Core/SimplePolylineGeometry',[ array[startingIndex++] = value._colorsPerVertex ? 1.0 : 0.0; array[startingIndex++] = value._followSurface ? 1.0 : 0.0; array[startingIndex] = value._granularity; + + return array; }; /** diff --git a/app/assets/javascripts/Cesium/Workers/createSphereGeometry.js b/app/assets/javascripts/Cesium/Workers/createSphereGeometry.js index bbebf01..9e346da 100644 --- a/app/assets/javascripts/Cesium/Workers/createSphereGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createSphereGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -11045,6 +11077,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -11058,6 +11092,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -13958,6 +13994,8 @@ define('Core/VertexFormat',[ * @param {VertexFormat} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ VertexFormat.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -13975,6 +14013,8 @@ define('Core/VertexFormat',[ array[startingIndex++] = value.binormal ? 1.0 : 0.0; array[startingIndex++] = value.tangent ? 1.0 : 0.0; array[startingIndex++] = value.color ? 1.0 : 0.0; + + return array; }; /** @@ -14135,6 +14175,8 @@ define('Core/EllipsoidGeometry',[ * @param {EllipsoidGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ EllipsoidGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -14154,6 +14196,8 @@ define('Core/EllipsoidGeometry',[ array[startingIndex++] = value._stackPartitions; array[startingIndex] = value._slicePartitions; + + return array; }; var scratchRadii = new Cartesian3(); @@ -14495,13 +14539,15 @@ define('Core/SphereGeometry',[ * @param {SphereGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ SphereGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { throw new DeveloperError('value is required'); } - EllipsoidGeometry.pack(value._ellipsoidGeometry, array, startingIndex); + return EllipsoidGeometry.pack(value._ellipsoidGeometry, array, startingIndex); }; var scratchEllipsoidGeometry = new EllipsoidGeometry(); diff --git a/app/assets/javascripts/Cesium/Workers/createSphereOutlineGeometry.js b/app/assets/javascripts/Cesium/Workers/createSphereOutlineGeometry.js index 902cd13..e85f497 100644 --- a/app/assets/javascripts/Cesium/Workers/createSphereOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createSphereOutlineGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -13063,6 +13095,8 @@ define('Core/EllipsoidOutlineGeometry',[ * @param {EllipsoidOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ EllipsoidOutlineGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -13080,6 +13114,8 @@ define('Core/EllipsoidOutlineGeometry',[ array[startingIndex++] = value._stackPartitions; array[startingIndex++] = value._slicePartitions; array[startingIndex] = value._subdivisions; + + return array; }; var scratchRadii = new Cartesian3(); @@ -13327,13 +13363,15 @@ define('Core/SphereOutlineGeometry',[ * @param {SphereOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ SphereOutlineGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { throw new DeveloperError('value is required'); } - EllipsoidOutlineGeometry.pack(value._ellipsoidGeometry, array, startingIndex); + return EllipsoidOutlineGeometry.pack(value._ellipsoidGeometry, array, startingIndex); }; var scratchEllipsoidGeometry = new EllipsoidOutlineGeometry(); diff --git a/app/assets/javascripts/Cesium/Workers/createVerticesFromHeightmap.js b/app/assets/javascripts/Cesium/Workers/createVerticesFromHeightmap.js index dfa5c9f..3fa40f8 100644 --- a/app/assets/javascripts/Cesium/Workers/createVerticesFromHeightmap.js +++ b/app/assets/javascripts/Cesium/Workers/createVerticesFromHeightmap.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3787,6 +3799,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3808,6 +3822,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4649,7 +4665,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5355,6 +5371,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5370,6 +5388,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -6222,6 +6242,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6250,6 +6272,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7854,7 +7878,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7891,7 +7915,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -9143,6 +9167,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -9159,6 +9185,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10650,6 +10678,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10667,6 +10697,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -11278,6 +11310,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -11291,6 +11325,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -16318,7 +16354,8 @@ define('Core/JulianDate',[ new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35), // July 1, 2012 00:00:00 UTC - new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36) // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36), // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457754, 43237.0, TimeStandard.TAI), 37) // January 1, 2017 00:00:00 UTC ]; return JulianDate; @@ -18703,6 +18740,8 @@ define('Core/Quaternion',[ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -18719,6 +18758,8 @@ define('Core/Quaternion',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -19348,7 +19389,7 @@ define('Core/Quaternion',[ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { @@ -21593,12 +21634,14 @@ define('Core/OrientedBoundingBox',[ define('Core/AttributeCompression',[ './Cartesian2', './Cartesian3', + './defaultValue', './defined', './DeveloperError', './Math' ], function( Cartesian2, Cartesian3, + defaultValue, defined, DeveloperError, CesiumMath) { @@ -21614,21 +21657,22 @@ define('Core/AttributeCompression',[ var AttributeCompression = {}; /** - * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * Encodes a normalized vector into 2 SNORM values in the range of [0-rangeMax] following the 'oct' encoding. * - * Oct encoding is a compact representation of unit length vectors. The encoding and decoding functions are low cost, and represent the normalized vector within 1 degree of error. + * Oct encoding is a compact representation of unit length vectors. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors", * Cigolle et al 2014: {@link http://jcgt.org/published/0003/02/01/} * - * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. - * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. - * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * @param {Cartesian3} vector The normalized vector to be compressed into 2 component 'oct' encoding. + * @param {Cartesian2} result The 2 component oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. + * @returns {Cartesian2} The 2 component oct-encoded unit length vector. * * @exception {DeveloperError} vector must be normalized. * - * @see AttributeCompression.octDecode + * @see AttributeCompression.octDecodeInRange */ - AttributeCompression.octEncode = function(vector, result) { + AttributeCompression.octEncodeInRange = function(vector, rangeMax, result) { if (!defined(vector)) { throw new DeveloperError('vector is required.'); } @@ -21649,34 +21693,51 @@ define('Core/AttributeCompression',[ result.y = (1.0 - Math.abs(x)) * CesiumMath.signNotZero(y); } - result.x = CesiumMath.toSNorm(result.x); - result.y = CesiumMath.toSNorm(result.y); + result.x = CesiumMath.toSNorm(result.x, rangeMax); + result.y = CesiumMath.toSNorm(result.y, rangeMax); return result; }; + /** + * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * + * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. + * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. + * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * + * @exception {DeveloperError} vector must be normalized. + * + * @see AttributeCompression.octEncodeInRange + * @see AttributeCompression.octDecode + */ + AttributeCompression.octEncode = function(vector, result) { + return AttributeCompression.octEncodeInRange(vector, 255, result); + }; + /** * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component vector. * * @param {Number} x The x component of the oct-encoded unit length vector. * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. * @param {Cartesian3} result The decoded and normalized vector * @returns {Cartesian3} The decoded and normalized vector. * - * @exception {DeveloperError} x and y must be a signed normalized integer between 0 and 255. + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and rangeMax. * - * @see AttributeCompression.octEncode + * @see AttributeCompression.octEncodeInRange */ - AttributeCompression.octDecode = function(x, y, result) { + AttributeCompression.octDecodeInRange = function(x, y, rangeMax, result) { if (!defined(result)) { throw new DeveloperError('result is required.'); } - if (x < 0 || x > 255 || y < 0 || y > 255) { - throw new DeveloperError('x and y must be a signed normalized integer between 0 and 255'); + if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) { + throw new DeveloperError('x and y must be a signed normalized integer between 0 and ' + rangeMax); } - result.x = CesiumMath.fromSNorm(x); - result.y = CesiumMath.fromSNorm(y); + result.x = CesiumMath.fromSNorm(x, rangeMax); + result.y = CesiumMath.fromSNorm(y, rangeMax); result.z = 1.0 - (Math.abs(result.x) + Math.abs(result.y)); if (result.z < 0.0) @@ -21689,6 +21750,22 @@ define('Core/AttributeCompression',[ return Cartesian3.normalize(result, result); }; + /** + * Decodes a unit-length vector in 2 byte 'oct' encoding to a normalized 3-component vector. + * + * @param {Number} x The x component of the oct-encoded unit length vector. + * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Cartesian3} result The decoded and normalized vector. + * @returns {Cartesian3} The decoded and normalized vector. + * + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and 255. + * + * @see AttributeCompression.octDecodeInRange + */ + AttributeCompression.octDecode = function(x, y, result) { + return AttributeCompression.octDecodeInRange(x, y, 255, result); + }; + /** * Packs an oct encoded vector into a single floating-point number. * diff --git a/app/assets/javascripts/Cesium/Workers/createVerticesFromQuantizedTerrainMesh.js b/app/assets/javascripts/Cesium/Workers/createVerticesFromQuantizedTerrainMesh.js index d404b60..4c2639f 100644 --- a/app/assets/javascripts/Cesium/Workers/createVerticesFromQuantizedTerrainMesh.js +++ b/app/assets/javascripts/Cesium/Workers/createVerticesFromQuantizedTerrainMesh.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1283,6 +1287,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1296,6 +1302,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -2071,6 +2079,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2086,6 +2096,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -3026,12 +3038,14 @@ define('Core/Cartesian3',[ define('Core/AttributeCompression',[ './Cartesian2', './Cartesian3', + './defaultValue', './defined', './DeveloperError', './Math' ], function( Cartesian2, Cartesian3, + defaultValue, defined, DeveloperError, CesiumMath) { @@ -3047,21 +3061,22 @@ define('Core/AttributeCompression',[ var AttributeCompression = {}; /** - * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * Encodes a normalized vector into 2 SNORM values in the range of [0-rangeMax] following the 'oct' encoding. * - * Oct encoding is a compact representation of unit length vectors. The encoding and decoding functions are low cost, and represent the normalized vector within 1 degree of error. + * Oct encoding is a compact representation of unit length vectors. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors", * Cigolle et al 2014: {@link http://jcgt.org/published/0003/02/01/} * - * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. - * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. - * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * @param {Cartesian3} vector The normalized vector to be compressed into 2 component 'oct' encoding. + * @param {Cartesian2} result The 2 component oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. + * @returns {Cartesian2} The 2 component oct-encoded unit length vector. * * @exception {DeveloperError} vector must be normalized. * - * @see AttributeCompression.octDecode + * @see AttributeCompression.octDecodeInRange */ - AttributeCompression.octEncode = function(vector, result) { + AttributeCompression.octEncodeInRange = function(vector, rangeMax, result) { if (!defined(vector)) { throw new DeveloperError('vector is required.'); } @@ -3082,34 +3097,51 @@ define('Core/AttributeCompression',[ result.y = (1.0 - Math.abs(x)) * CesiumMath.signNotZero(y); } - result.x = CesiumMath.toSNorm(result.x); - result.y = CesiumMath.toSNorm(result.y); + result.x = CesiumMath.toSNorm(result.x, rangeMax); + result.y = CesiumMath.toSNorm(result.y, rangeMax); return result; }; + /** + * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * + * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. + * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. + * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * + * @exception {DeveloperError} vector must be normalized. + * + * @see AttributeCompression.octEncodeInRange + * @see AttributeCompression.octDecode + */ + AttributeCompression.octEncode = function(vector, result) { + return AttributeCompression.octEncodeInRange(vector, 255, result); + }; + /** * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component vector. * * @param {Number} x The x component of the oct-encoded unit length vector. * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. * @param {Cartesian3} result The decoded and normalized vector * @returns {Cartesian3} The decoded and normalized vector. * - * @exception {DeveloperError} x and y must be a signed normalized integer between 0 and 255. + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and rangeMax. * - * @see AttributeCompression.octEncode + * @see AttributeCompression.octEncodeInRange */ - AttributeCompression.octDecode = function(x, y, result) { + AttributeCompression.octDecodeInRange = function(x, y, rangeMax, result) { if (!defined(result)) { throw new DeveloperError('result is required.'); } - if (x < 0 || x > 255 || y < 0 || y > 255) { - throw new DeveloperError('x and y must be a signed normalized integer between 0 and 255'); + if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) { + throw new DeveloperError('x and y must be a signed normalized integer between 0 and ' + rangeMax); } - result.x = CesiumMath.fromSNorm(x); - result.y = CesiumMath.fromSNorm(y); + result.x = CesiumMath.fromSNorm(x, rangeMax); + result.y = CesiumMath.fromSNorm(y, rangeMax); result.z = 1.0 - (Math.abs(result.x) + Math.abs(result.y)); if (result.z < 0.0) @@ -3122,6 +3154,22 @@ define('Core/AttributeCompression',[ return Cartesian3.normalize(result, result); }; + /** + * Decodes a unit-length vector in 2 byte 'oct' encoding to a normalized 3-component vector. + * + * @param {Number} x The x component of the oct-encoded unit length vector. + * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Cartesian3} result The decoded and normalized vector. + * @returns {Cartesian3} The decoded and normalized vector. + * + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and 255. + * + * @see AttributeCompression.octDecodeInRange + */ + AttributeCompression.octDecode = function(x, y, result) { + return AttributeCompression.octDecodeInRange(x, y, 255, result); + }; + /** * Packs an oct encoded vector into a single floating-point number. * @@ -4266,6 +4314,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -4278,6 +4328,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -4810,6 +4862,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -4831,6 +4885,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -5672,7 +5728,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -6378,6 +6434,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6393,6 +6451,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -7245,6 +7305,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -7273,6 +7335,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -8877,7 +8941,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -8914,7 +8978,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -10166,6 +10230,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10182,6 +10248,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -11673,6 +11741,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -11690,6 +11760,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -17013,7 +17085,8 @@ define('Core/JulianDate',[ new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35), // July 1, 2012 00:00:00 UTC - new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36) // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36), // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457754, 43237.0, TimeStandard.TAI), 37) // January 1, 2017 00:00:00 UTC ]; return JulianDate; @@ -19398,6 +19471,8 @@ define('Core/Quaternion',[ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -19414,6 +19489,8 @@ define('Core/Quaternion',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -20043,7 +20120,7 @@ define('Core/Quaternion',[ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { diff --git a/app/assets/javascripts/Cesium/Workers/createWallGeometry.js b/app/assets/javascripts/Cesium/Workers/createWallGeometry.js index f6c2a8a..39c64ca 100644 --- a/app/assets/javascripts/Cesium/Workers/createWallGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createWallGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -13196,6 +13228,8 @@ define('Core/VertexFormat',[ * @param {VertexFormat} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ VertexFormat.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -13213,6 +13247,8 @@ define('Core/VertexFormat',[ array[startingIndex++] = value.binormal ? 1.0 : 0.0; array[startingIndex++] = value.tangent ? 1.0 : 0.0; array[startingIndex++] = value.color ? 1.0 : 0.0; + + return array; }; /** @@ -13618,6 +13654,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -13631,6 +13669,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -18352,7 +18392,8 @@ define('Core/JulianDate',[ new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35), // July 1, 2012 00:00:00 UTC - new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36) // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36), // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457754, 43237.0, TimeStandard.TAI), 37) // January 1, 2017 00:00:00 UTC ]; return JulianDate; @@ -20240,6 +20281,8 @@ define('Core/Quaternion',[ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -20256,6 +20299,8 @@ define('Core/Quaternion',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -20885,7 +20930,7 @@ define('Core/Quaternion',[ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { @@ -24306,11 +24351,13 @@ define('Core/PolylinePipeline',[ var length = positions.length; var ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84); var height = defaultValue(options.height, 0); + var hasHeightArray = isArray(height); if (length < 1) { return []; } else if (length === 1) { var p = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst); + height = hasHeightArray ? height[0] : height; if (height !== 0) { var n = ellipsoid.geodeticSurfaceNormal(p, cartesian); Cartesian3.multiplyByScalar(n, height, n); @@ -24336,7 +24383,6 @@ define('Core/PolylinePipeline',[ var arrayLength = (numPoints + 1) * 3; var newPositions = new Array(arrayLength); var offset = 0; - var hasHeightArray = isArray(height); for (i = 0; i < length - 1; i++) { var p0 = positions[i]; @@ -24728,6 +24774,8 @@ define('Core/WallGeometry',[ * @param {WallGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ WallGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -24776,6 +24824,8 @@ define('Core/WallGeometry',[ startingIndex += VertexFormat.packedLength; array[startingIndex] = value._granularity; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/Workers/createWallOutlineGeometry.js b/app/assets/javascripts/Cesium/Workers/createWallOutlineGeometry.js index 58b78b0..5d71970 100644 --- a/app/assets/javascripts/Cesium/Workers/createWallOutlineGeometry.js +++ b/app/assets/javascripts/Cesium/Workers/createWallOutlineGeometry.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1309,6 +1313,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1324,6 +1330,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -2967,6 +2975,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2979,6 +2989,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -3554,6 +3566,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -3575,6 +3589,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -4416,7 +4432,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -5122,6 +5138,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -5137,6 +5155,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -5989,6 +6009,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6017,6 +6039,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -7621,7 +7645,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -7658,7 +7682,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -8910,6 +8934,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -8926,6 +8952,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -10417,6 +10445,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -10434,6 +10464,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -13315,6 +13347,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -13328,6 +13362,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -18049,7 +18085,8 @@ define('Core/JulianDate',[ new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35), // July 1, 2012 00:00:00 UTC - new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36) // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36), // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457754, 43237.0, TimeStandard.TAI), 37) // January 1, 2017 00:00:00 UTC ]; return JulianDate; @@ -19937,6 +19974,8 @@ define('Core/Quaternion',[ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -19953,6 +19992,8 @@ define('Core/Quaternion',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -20582,7 +20623,7 @@ define('Core/Quaternion',[ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { @@ -24003,11 +24044,13 @@ define('Core/PolylinePipeline',[ var length = positions.length; var ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84); var height = defaultValue(options.height, 0); + var hasHeightArray = isArray(height); if (length < 1) { return []; } else if (length === 1) { var p = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst); + height = hasHeightArray ? height[0] : height; if (height !== 0) { var n = ellipsoid.geodeticSurfaceNormal(p, cartesian); Cartesian3.multiplyByScalar(n, height, n); @@ -24033,7 +24076,6 @@ define('Core/PolylinePipeline',[ var arrayLength = (numPoints + 1) * 3; var newPositions = new Array(arrayLength); var offset = 0; - var hasHeightArray = isArray(height); for (i = 0; i < length - 1; i++) { var p0 = positions[i]; @@ -24412,6 +24454,8 @@ define('Core/WallOutlineGeometry',[ * @param {WallOutlineGeometry} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ WallOutlineGeometry.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -24457,6 +24501,8 @@ define('Core/WallOutlineGeometry',[ startingIndex += Ellipsoid.packedLength; array[startingIndex] = value._granularity; + + return array; }; var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE); diff --git a/app/assets/javascripts/Cesium/Workers/upsampleQuantizedTerrainMesh.js b/app/assets/javascripts/Cesium/Workers/upsampleQuantizedTerrainMesh.js index 0642e3a..ba2be28 100644 --- a/app/assets/javascripts/Cesium/Workers/upsampleQuantizedTerrainMesh.js +++ b/app/assets/javascripts/Cesium/Workers/upsampleQuantizedTerrainMesh.js @@ -610,25 +610,29 @@ define('Core/Math',[ }; /** - * Converts a scalar value in the range [-1.0, 1.0] to a 8-bit 2's complement number. + * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] - * @returns {Number} The 8-bit 2's complement number, where 0 maps to -1.0 and 255 maps to 1.0. + * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. + * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ - CesiumMath.toSNorm = function(value) { - return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * 255.0); + CesiumMath.toSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** - * Converts a SNORM value in the range [0, 255] to a scalar in the range [-1.0, 1.0]. + * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] + * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ - CesiumMath.fromSNorm = function(value) { - return CesiumMath.clamp(value, 0.0, 255.0) / 255.0 * 2.0 - 1.0; + CesiumMath.fromSNorm = function(value, rangeMax) { + rangeMax = defaultValue(rangeMax, 255); + return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0; }; /** @@ -1283,6 +1287,8 @@ define('Core/Cartesian2',[ * @param {Cartesian2} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian2.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -1296,6 +1302,8 @@ define('Core/Cartesian2',[ array[startingIndex++] = value.x; array[startingIndex] = value.y; + + return array; }; /** @@ -2071,6 +2079,8 @@ define('Core/Cartesian3',[ * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -2086,6 +2096,8 @@ define('Core/Cartesian3',[ array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; + + return array; }; /** @@ -3026,12 +3038,14 @@ define('Core/Cartesian3',[ define('Core/AttributeCompression',[ './Cartesian2', './Cartesian3', + './defaultValue', './defined', './DeveloperError', './Math' ], function( Cartesian2, Cartesian3, + defaultValue, defined, DeveloperError, CesiumMath) { @@ -3047,21 +3061,22 @@ define('Core/AttributeCompression',[ var AttributeCompression = {}; /** - * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * Encodes a normalized vector into 2 SNORM values in the range of [0-rangeMax] following the 'oct' encoding. * - * Oct encoding is a compact representation of unit length vectors. The encoding and decoding functions are low cost, and represent the normalized vector within 1 degree of error. + * Oct encoding is a compact representation of unit length vectors. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors", * Cigolle et al 2014: {@link http://jcgt.org/published/0003/02/01/} * - * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. - * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. - * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * @param {Cartesian3} vector The normalized vector to be compressed into 2 component 'oct' encoding. + * @param {Cartesian2} result The 2 component oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. + * @returns {Cartesian2} The 2 component oct-encoded unit length vector. * * @exception {DeveloperError} vector must be normalized. * - * @see AttributeCompression.octDecode + * @see AttributeCompression.octDecodeInRange */ - AttributeCompression.octEncode = function(vector, result) { + AttributeCompression.octEncodeInRange = function(vector, rangeMax, result) { if (!defined(vector)) { throw new DeveloperError('vector is required.'); } @@ -3082,34 +3097,51 @@ define('Core/AttributeCompression',[ result.y = (1.0 - Math.abs(x)) * CesiumMath.signNotZero(y); } - result.x = CesiumMath.toSNorm(result.x); - result.y = CesiumMath.toSNorm(result.y); + result.x = CesiumMath.toSNorm(result.x, rangeMax); + result.y = CesiumMath.toSNorm(result.y, rangeMax); return result; }; + /** + * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding. + * + * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding. + * @param {Cartesian2} result The 2 byte oct-encoded unit length vector. + * @returns {Cartesian2} The 2 byte oct-encoded unit length vector. + * + * @exception {DeveloperError} vector must be normalized. + * + * @see AttributeCompression.octEncodeInRange + * @see AttributeCompression.octDecode + */ + AttributeCompression.octEncode = function(vector, result) { + return AttributeCompression.octEncodeInRange(vector, 255, result); + }; + /** * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component vector. * * @param {Number} x The x component of the oct-encoded unit length vector. * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. * @param {Cartesian3} result The decoded and normalized vector * @returns {Cartesian3} The decoded and normalized vector. * - * @exception {DeveloperError} x and y must be a signed normalized integer between 0 and 255. + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and rangeMax. * - * @see AttributeCompression.octEncode + * @see AttributeCompression.octEncodeInRange */ - AttributeCompression.octDecode = function(x, y, result) { + AttributeCompression.octDecodeInRange = function(x, y, rangeMax, result) { if (!defined(result)) { throw new DeveloperError('result is required.'); } - if (x < 0 || x > 255 || y < 0 || y > 255) { - throw new DeveloperError('x and y must be a signed normalized integer between 0 and 255'); + if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) { + throw new DeveloperError('x and y must be a signed normalized integer between 0 and ' + rangeMax); } - result.x = CesiumMath.fromSNorm(x); - result.y = CesiumMath.fromSNorm(y); + result.x = CesiumMath.fromSNorm(x, rangeMax); + result.y = CesiumMath.fromSNorm(y, rangeMax); result.z = 1.0 - (Math.abs(result.x) + Math.abs(result.y)); if (result.z < 0.0) @@ -3122,6 +3154,22 @@ define('Core/AttributeCompression',[ return Cartesian3.normalize(result, result); }; + /** + * Decodes a unit-length vector in 2 byte 'oct' encoding to a normalized 3-component vector. + * + * @param {Number} x The x component of the oct-encoded unit length vector. + * @param {Number} y The y component of the oct-encoded unit length vector. + * @param {Cartesian3} result The decoded and normalized vector. + * @returns {Cartesian3} The decoded and normalized vector. + * + * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and 255. + * + * @see AttributeCompression.octDecodeInRange + */ + AttributeCompression.octDecode = function(x, y, result) { + return AttributeCompression.octDecodeInRange(x, y, 255, result); + }; + /** * Packs an oct encoded vector into a single floating-point number. * @@ -3990,6 +4038,8 @@ define('Core/Ellipsoid',[ * @param {Ellipsoid} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Ellipsoid.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -4002,6 +4052,8 @@ define('Core/Ellipsoid',[ startingIndex = defaultValue(startingIndex, 0); Cartesian3.pack(value._radii, array, startingIndex); + + return array; }; /** @@ -4577,6 +4629,8 @@ define('Core/Matrix3',[ * @param {Matrix3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix3.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -4598,6 +4652,8 @@ define('Core/Matrix3',[ array[startingIndex++] = value[6]; array[startingIndex++] = value[7]; array[startingIndex++] = value[8]; + + return array; }; /** @@ -5439,7 +5495,7 @@ define('Core/Matrix3',[ * @example * // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m); * Cesium.Matrix3.multiplyByScale(m, scale, m); - * + * * @see Matrix3.fromScale * @see Matrix3.multiplyByUniformScale */ @@ -6145,6 +6201,8 @@ define('Core/Cartesian4',[ * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Cartesian4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -6160,6 +6218,8 @@ define('Core/Cartesian4',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -7012,6 +7072,8 @@ define('Core/Matrix4',[ * @param {Matrix4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Matrix4.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -7040,6 +7102,8 @@ define('Core/Matrix4',[ array[startingIndex++] = value[13]; array[startingIndex++] = value[14]; array[startingIndex] = value[15]; + + return array; }; /** @@ -8644,7 +8708,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m); * Cesium.Matrix4.multiplyByUniformScale(m, scale, m); - * + * * @see Matrix4.fromUniformScale * @see Matrix4.multiplyByScale */ @@ -8681,7 +8745,7 @@ define('Core/Matrix4',[ * @example * // Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m); * Cesium.Matrix4.multiplyByScale(m, scale, m); - * + * * @see Matrix4.fromScale * @see Matrix4.multiplyByUniformScale */ @@ -9933,6 +9997,8 @@ define('Core/Rectangle',[ * @param {Rectangle} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Rectangle.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -9949,6 +10015,8 @@ define('Core/Rectangle',[ array[startingIndex++] = value.south; array[startingIndex++] = value.east; array[startingIndex] = value.north; + + return array; }; /** @@ -11440,6 +11508,8 @@ define('Core/BoundingSphere',[ * @param {BoundingSphere} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ BoundingSphere.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -11457,6 +11527,8 @@ define('Core/BoundingSphere',[ array[startingIndex++] = center.y; array[startingIndex++] = center.z; array[startingIndex] = value.radius; + + return array; }; /** @@ -17600,7 +17672,8 @@ define('Core/JulianDate',[ new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35), // July 1, 2012 00:00:00 UTC - new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36) // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36), // July 1, 2015 00:00:00 UTC + new LeapSecond(new JulianDate(2457754, 43237.0, TimeStandard.TAI), 37) // January 1, 2017 00:00:00 UTC ]; return JulianDate; @@ -19985,6 +20058,8 @@ define('Core/Quaternion',[ * @param {Quaternion} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. + * + * @returns {Number[]} The array that was packed into */ Quaternion.pack = function(value, array, startingIndex) { if (!defined(value)) { @@ -20001,6 +20076,8 @@ define('Core/Quaternion',[ array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; + + return array; }; /** @@ -20630,7 +20707,7 @@ define('Core/Quaternion',[ * // 2. compute the squad interpolation as above but where the first quaternion is a end point. * var s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion()); * var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion()); - * + * * @see Quaternion#computeInnerQuadrangle */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { diff --git a/lib/cesium/version.rb b/lib/cesium/version.rb index 4eff113..a29a654 100644 --- a/lib/cesium/version.rb +++ b/lib/cesium/version.rb @@ -1,3 +1,3 @@ module Cesium - VERSION = '1.23.0' + VERSION = '1.24.0' end