Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return packed array #4156

Merged
merged 5 commits into from
Aug 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ Change Log
* Fixed an exception that would occur when switching to 2D view when shadows are enabled. [#4051](https://github.com/AnalyticalGraphicsInc/cesium/issues/4051)
* Fixed an issue causing entities to disappear when updating multiple entities simultaneously. [#4096](https://github.com/AnalyticalGraphicsInc/cesium/issues/4096)
* Normalizing the velocity vector produced by `VelocityVectorProperty` is now optional.
* Pack funcions now return the result array [#4156](https://github.com/AnalyticalGraphicsInc/cesium/pull/4156)
* Added optional `rangeMax` parameter to `Math.toSNorm` and `Math.fromSNorm`. [#4121](https://github.com/AnalyticalGraphicsInc/cesium/pull/4121)

### 1.23 - 2016-07-01
4 changes: 4 additions & 0 deletions Source/Core/BoundingRectangle.js
Original file line number Diff line number Diff line change
@@ -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;
};

/**
4 changes: 4 additions & 0 deletions Source/Core/BoundingSphere.js
Original file line number Diff line number Diff line change
@@ -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;
};

/**
12 changes: 8 additions & 4 deletions Source/Core/BoxGeometry.js
Original file line number Diff line number Diff line change
@@ -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();
9 changes: 6 additions & 3 deletions Source/Core/BoxOutlineGeometry.js
Original file line number Diff line number Diff line change
@@ -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();
4 changes: 4 additions & 0 deletions Source/Core/Cartesian2.js
Original file line number Diff line number Diff line change
@@ -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;
};

/**
4 changes: 4 additions & 0 deletions Source/Core/Cartesian3.js
Original file line number Diff line number Diff line change
@@ -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;
};

/**
4 changes: 4 additions & 0 deletions Source/Core/Cartesian4.js
Original file line number Diff line number Diff line change
@@ -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;
};

/**
6 changes: 4 additions & 2 deletions Source/Core/CircleGeometry.js
Original file line number Diff line number Diff line change
@@ -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({
@@ -176,7 +178,7 @@ define([
vertexFormat : VertexFormat.POSITION_ONLY
});
};

defineProperties(CircleGeometry.prototype, {
/**
* @private
4 changes: 3 additions & 1 deletion Source/Core/CircleOutlineGeometry.js
Original file line number Diff line number Diff line change
@@ -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({
8 changes: 6 additions & 2 deletions Source/Core/Color.js
Original file line number Diff line number Diff line change
@@ -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() {
4 changes: 4 additions & 0 deletions Source/Core/CorridorGeometry.js
Original file line number Diff line number Diff line change
@@ -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);
4 changes: 4 additions & 0 deletions Source/Core/CorridorOutlineGeometry.js
Original file line number Diff line number Diff line change
@@ -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);
4 changes: 4 additions & 0 deletions Source/Core/CylinderGeometry.js
Original file line number Diff line number Diff line change
@@ -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();
5 changes: 5 additions & 0 deletions Source/Core/CylinderOutlineGeometry.js
Original file line number Diff line number Diff line change
@@ -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 = {
4 changes: 4 additions & 0 deletions Source/Core/EllipseGeometry.js
Original file line number Diff line number Diff line change
@@ -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();
4 changes: 4 additions & 0 deletions Source/Core/EllipseOutlineGeometry.js
Original file line number Diff line number Diff line change
@@ -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();
Loading