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
Show file tree
Hide file tree
Changes from 4 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
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions Source/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 Source/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 Source/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 Source/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 Source/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 Source/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 Source/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 Source/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 Source/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
8 changes: 6 additions & 2 deletions Source/Core/Color.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand All @@ -456,6 +458,8 @@ define([
array[startingIndex++] = value.green;
array[startingIndex++] = value.blue;
array[startingIndex] = value.alpha;

return array;
};

/**
Expand Down Expand Up @@ -648,7 +652,7 @@ define([
*
* @example
* var rgba = Cesium.Color.BLUE.toRgba();
*
*
* @see Color.fromRgba
*/
Color.prototype.toRgba = function() {
Expand Down
4 changes: 4 additions & 0 deletions Source/Core/CorridorGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions Source/Core/CorridorOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions Source/Core/CylinderGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -134,6 +136,8 @@ define([
array[startingIndex++] = value._topRadius;
array[startingIndex++] = value._bottomRadius;
array[startingIndex] = value._slices;

return array;
};

var scratchVertexFormat = new VertexFormat();
Expand Down
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',
Expand Down Expand Up @@ -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);
Expand All @@ -123,6 +126,8 @@ define([
array[startingIndex++] = value._bottomRadius;
array[startingIndex++] = value._slices;
array[startingIndex] = value._numberOfVerticalLines;

return array;
};

var scratchOptions = {
Expand Down
4 changes: 4 additions & 0 deletions Source/Core/EllipseGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions Source/Core/EllipseOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
Loading