Skip to content

Commit

Permalink
Merge branch 'master' into shadows-entity
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Aug 1, 2016
2 parents f7fb698 + 9b20bee commit 4578bd6
Show file tree
Hide file tree
Showing 62 changed files with 4,699 additions and 4,052 deletions.
28 changes: 20 additions & 8 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
Change Log
==========

### 1.25 - 2016-09-01

* Deprecated
* Deprecated `castShadows` and `receiveShadows` properties from `Model`, `Primitive`, and `Globe`. They will be removed in 1.26. Use `shadows` instead with the `ShadowMode` enum, e.g. `model.shadows = ShadowMode.ENABLED`.
* `Viewer.terrainShadows` now uses the `ShadowMode` enum instead of a Boolean, e.g. `viewer.terrainShadows = ShadowMode.RECEIVE_ONLY`. Boolean support will be dropped in 1.26.
* Entity `model.shadows` now uses the `ShadowMode` enum instead of a Boolean, e.g. `entity.model.shadows = ShadowMode.ENABLED`. Boolean support will be dropped in 1.26.
* Added `shadows` property to the entity API for `Box`, `Corridor`, `Cylinder`, `Ellipse`, `Ellipsoid`, `Polygon`, `Polyline`, `PoylineVolume`, `Rectangle`, and `Wall`. [#4005](https://github.com/AnalyticalGraphicsInc/cesium/pull/4005)

### 1.24 - 2016-08-01

* Fixed a crash that would occur when switching to 2D view when shadows are enabled. [#4051](https://github.com/AnalyticalGraphicsInc/cesium/issues/4051)
* Added support in CZML for expressing `BillboardGraphics.alignedAxis` as the velocity vector of an entity, using `velocityReference` syntax.
* Added `urlSchemeZeroPadding` property to `UrlTemplateImageryProvider` to allow the numeric parts of a URL, such as `{x}`, to be padded with zeros to make them a fixed width.
* Added leap second just prior to January 2017. [#4092](https://github.com/AnalyticalGraphicsInc/cesium/issues/4092)
* 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 functions 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)
* Removed `MapQuest OpenStreetMap` from the list of demo base layers since direct tile access has been discontinued. See the [MapQuest Developer Blog](http://devblog.mapquest.com/2016/06/15/modernization-of-mapquest-results-in-changes-to-open-tile-access/) for details.
* Fixed PolylinePipeline.generateArc to accept an array of heights when there's only one position [#4155](https://github.com/AnalyticalGraphicsInc/cesium/pull/4155)

### 1.23 - 2016-07-01

* Breaking changes
* Removed `castShadows` and `receiveShadows` properties from `Model`, `Primitive`, and `Globe`. Use `shadows` instead with the `ShadowMode` enum, e.g. `model.shadows = ShadowMode.ENABLED`.
* `Viewer.terrainShadows` now uses the `ShadowMode` enum instead of a Boolean, e.g. `viewer.terrainShadows = ShadowMode.RECEIVE_ONLY`.
* Entity `model.shadows` now uses the `ShadowMode` enum instead of a Boolean, e.g. `entity.model.shadows = ShadowMode.ENABLED`.
* `GroundPrimitive.initializeTerrainHeights()` must be called and have the returned promise resolve before a `GroundPrimitive` can be added syncronously.
* `GroundPrimitive.initializeTerrainHeights()` must be called and have the returned promise resolve before a `GroundPrimitive` can be added synchronously.
* Added terrain clamping to entities, KML, and GeoJSON
* Added `heightReference` property to point, billboard and model entities.
* Changed corridor, ellipse, polygon and rectangle entities to conform to terrain by using a `GroundPrimitive` if its material is a `ColorMaterialProperty` instance and it doesn't have a `height` or `extrudedHeight`. Entities with any other type of material are not clamped to terrain.
Expand All @@ -22,12 +36,10 @@ Change Log
* Points with a height will be drawn at that height; otherwise, they will be clamped to the ground.
* Added `clampToGround` property. When `true`, clamps `Polygon` and `LineString` features to the ground. For this case, lines use a corridor instead of a polyline.
* Added [Ground Clamping Sandcastle example](https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Ground%20Clamping.html&label=Showcases).
* Added `shadows` property to the entity API for `Box`, `Corridor`, `Cylinder`, `Ellipse`, `Ellipsoid`, `Polygon`, `Polyline`, `PoylineVolume`, `Rectangle`, and `Wall`. [#4005](https://github.com/AnalyticalGraphicsInc/cesium/pull/4005)
* Improved performance and accuracy of polygon triangulation by using the [earcut](https://github.com/mapbox/earcut) library. Loading a GeoJSON with polygons for each country was 2x faster.
* Fix some large polygon triangulations. [#2788](https://github.com/AnalyticalGraphicsInc/cesium/issues/2788)
* Added support for the glTF extension [WEB3D_quantized_attributes](https://github.com/KhronosGroup/glTF/blob/master/extensions/Vendor/WEB3D_quantized_attributes/README.md). [#3241](https://github.com/AnalyticalGraphicsInc/cesium/issues/3241)
* Updated the online [model converter](http://cesiumjs.org/convertmodel.html) to convert OBJ model to glTF with [obj2gltf](https://github.com/AnalyticalGraphicsInc/OBJ2GLTF), as well as optimize existing glTF models with the [gltf-pipeline](https://github.com/AnalyticalGraphicsInc/gltf-pipeline).
* Added CZML support for `Box`, `Corridor` and `Cylinder`. Added new CZML properties:
* Added CZML support for `Box`, `Corridor` and `Cylinder`. Added new CZML properties:
* `Billboard`: `width`, `height`, `heightReference`, `scaleByDistance`, `translucencyByDistance`, `pixelOffsetScaleByDistance`, `imageSubRegion`
* `Label`: `heightReference`, `translucencyByDistance`, `pixelOffsetScaleByDistance`
* `Model`: `heightReference`, `maximumScale`
Expand Down
68 changes: 52 additions & 16 deletions Source/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 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
Loading

0 comments on commit 4578bd6

Please sign in to comment.