Skip to content

Commit

Permalink
Merge branch 'release/v1.24.0'
Browse files Browse the repository at this point in the history
# Conflicts:
#	Gemfile.lock
  • Loading branch information
bogwro committed Aug 13, 2016
2 parents a70ab6c + 87fb7c3 commit c969159
Show file tree
Hide file tree
Showing 84 changed files with 2,617 additions and 625 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ GIT
PATH
remote: .
specs:
cesium (1.23.0)
cesium (1.24.0)
jquery-rails
railties (>= 3.1.1)
requirejs-rails
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/Cesium/Cesium.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 52 additions & 16 deletions app/assets/javascripts/Cesium/Core/AttributeCompression.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
define([
'./Cartesian2',
'./Cartesian3',
'./defaultValue',
'./defined',
'./DeveloperError',
'./Math'
], function(
Cartesian2,
Cartesian3,
defaultValue,
defined,
DeveloperError,
CesiumMath) {
Expand All @@ -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.');
Expand All @@ -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)
Expand All @@ -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.
*
Expand Down
4 changes: 4 additions & 0 deletions app/assets/javascripts/Cesium/Core/BoundingRectangle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -91,6 +93,8 @@ define([
array[startingIndex++] = value.y;
array[startingIndex++] = value.width;
array[startingIndex] = value.height;

return array;
};

/**
Expand Down
4 changes: 4 additions & 0 deletions app/assets/javascripts/Cesium/Core/BoundingSphere.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -830,6 +832,8 @@ define([
array[startingIndex++] = center.y;
array[startingIndex++] = center.z;
array[startingIndex] = value.radius;

return array;
};

/**
Expand Down
12 changes: 8 additions & 4 deletions app/assets/javascripts/Cesium/Core/BoxGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -124,7 +124,7 @@ define([
* @returns {BoxGeometry}
*
*
*
*
* @example
* var aabb = Cesium.AxisAlignedBoundingBox.fromPoints(Cesium.Cartesian3.fromDegreesArray([
* -72.0, 40.0,
Expand All @@ -134,7 +134,7 @@ define([
* -68.0, 40.0
* ]));
* var box = Cesium.BoxGeometry.fromAxisAlignedBoundingBox(aabb);
*
*
* @see BoxGeometry.createGeometry
*/
BoxGeometry.fromAxisAlignedBoundingBox = function (boundingBox) {
Expand All @@ -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);
Expand All @@ -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();
Expand Down
9 changes: 6 additions & 3 deletions app/assets/javascripts/Cesium/Core/BoxOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -122,7 +122,7 @@ define([
* -68.0, 40.0
* ]));
* var box = Cesium.BoxOutlineGeometry.fromAxisAlignedBoundingBox(aabb);
*
*
* @see BoxOutlineGeometry.createGeometry
*/
BoxOutlineGeometry.fromAxisAlignedBoundingBox = function(boundingBox) {
Expand All @@ -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);
Expand All @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions app/assets/javascripts/Cesium/Core/Cartesian2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -128,6 +130,8 @@ define([

array[startingIndex++] = value.x;
array[startingIndex] = value.y;

return array;
};

/**
Expand Down
4 changes: 4 additions & 0 deletions app/assets/javascripts/Cesium/Core/Cartesian3.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -158,6 +160,8 @@ define([
array[startingIndex++] = value.x;
array[startingIndex++] = value.y;
array[startingIndex] = value.z;

return array;
};

/**
Expand Down
4 changes: 4 additions & 0 deletions app/assets/javascripts/Cesium/Core/Cartesian4.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -157,6 +159,8 @@ define([
array[startingIndex++] = value.y;
array[startingIndex++] = value.z;
array[startingIndex] = value.w;

return array;
};

/**
Expand Down
6 changes: 4 additions & 2 deletions app/assets/javascripts/Cesium/Core/CircleGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,16 @@ 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);
if (!defined(value)) {
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({
Expand Down Expand Up @@ -176,7 +178,7 @@ define([
vertexFormat : VertexFormat.POSITION_ONLY
});
};

defineProperties(CircleGeometry.prototype, {
/**
* @private
Expand Down
4 changes: 3 additions & 1 deletion app/assets/javascripts/Cesium/Core/CircleOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,16 @@ 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);
if (!defined(value)) {
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({
Expand Down
Loading

0 comments on commit c969159

Please sign in to comment.