Skip to content

Commit

Permalink
Merge remote-tracking branch 'agi/master' into issue1434
Browse files Browse the repository at this point in the history
Conflicts:
	Source/Core/GeometryAttribute.js
	Source/Core/GeometryInstanceAttribute.js
	Source/Core/PolylineGeometry.js
	Source/Core/SimplePolylineGeometry.js
	Source/Renderer/Context.js
	Source/Renderer/createShaderSource.js
	Source/Scene/Polygon.js
	Source/Scene/TextureAtlas.js
  • Loading branch information
abwood committed May 21, 2014
2 parents f5df71b + dd596ac commit b92de10
Show file tree
Hide file tree
Showing 41 changed files with 178 additions and 83 deletions.
6 changes: 3 additions & 3 deletions Source/Core/Credit.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ define([
/**
* A credit contains data pertaining to how to display attributions/credits for certain content on the screen.
*
* @param {String} [text=undefined] The text to be displayed on the screen if no imageUrl is specified.
* @param {String} [imageUrl=undefined] The source location for an image
* @param {String} [link=undefined] A URL location for which the credit will be hyperlinked
* @param {String} [text] The text to be displayed on the screen if no imageUrl is specified.
* @param {String} [imageUrl] The source location for an image
* @param {String} [link] A URL location for which the credit will be hyperlinked
*
* @alias Credit
* @constructor
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DeveloperError.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ define([
*
* @alias DeveloperError
*
* @param {String} [message=undefined] The error message for this exception.
* @param {String} [message] The error message for this exception.
*
* @see RuntimeError
* @constructor
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/EllipsoidGeodesic.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ define([
* @constructor
* @immutable
*
* @param {Cartographic} [start=undefined] The initial planetodetic point on the path.
* @param {Cartographic} [end=undefined] The final planetodetic point on the path.
* @param {Cartographic} [start] The initial planetodetic point on the path.
* @param {Cartographic} [end] The final planetodetic point on the path.
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the geodesic lies.
*/
var EllipsoidGeodesic = function(start, end, ellipsoid) {
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/Enumeration.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ define([
* Constructs an enumeration that contains both a numeric value and a name.
* This is used so the name of the enumeration is available in the debugger.
*
* @param {Number} [value=undefined] The numeric value of the enumeration.
* @param {String} [name=undefined] The name of the enumeration for debugging purposes.
* @param {Object} [properties=undefined] An object containing extra properties to be added to the enumeration.
* @param {Number} [value] The numeric value of the enumeration.
* @param {String} [name] The name of the enumeration for debugging purposes.
* @param {Object} [properties] An object containing extra properties to be added to the enumeration.
*
* @alias Enumeration
* @constructor
Expand Down
10 changes: 9 additions & 1 deletion Source/Core/GeographicProjection.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ define([
'./defaultValue',
'./defined',
'./defineProperties',
'./DeveloperError',
'./Ellipsoid'
], function(
Cartesian3,
Cartographic,
defaultValue,
defined,
defineProperties,
DeveloperError,
Ellipsoid) {
"use strict";

Expand Down Expand Up @@ -86,14 +88,20 @@ define([
*
* @memberof GeographicProjection
*
* @param {Cartesian3} cartesian The coordinate to unproject.
* @param {Cartesian3} cartesian The Cartesian position to unproject with height (z) in meters.
* @param {Cartographic} [result] An instance into which to copy the result. If this parameter is
* undefined, a new instance is created and returned.
* @returns {Cartographic} The unprojected coordinates. If the result parameter is not undefined, the
* coordinates are copied there and that instance is returned. Otherwise, a new instance is
* created and returned.
*/
GeographicProjection.prototype.unproject = function(cartesian, result) {
//>>includeStart('debug', pragmas.debug);
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
//>>includeEnd('debug');

var oneOverEarthSemimajorAxis = this._oneOverSemimajorAxis;
var longitude = cartesian.x * oneOverEarthSemimajorAxis;
var latitude = cartesian.y * oneOverEarthSemimajorAxis;
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/GeometryAttribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ define([
* @alias GeometryAttribute
* @constructor
*
* @param {ComponentDatatype} [options.componentDatatype=undefined] The datatype of each component in the attribute, e.g., individual elements in values.
* @param {Number} [options.componentsPerAttribute=undefined] A number between 1 and 4 that defines the number of components in an attributes.
* @param {ComponentDatatype} [options.componentDatatype] The datatype of each component in the attribute, e.g., individual elements in values.
* @param {Number} [options.componentsPerAttribute] A number between 1 and 4 that defines the number of components in an attributes.
* @param {Boolean} [options.normalize=false] When <code>true</code> and <code>componentDatatype</code> is an integer format, indicate that the components should be mapped to the range [0, 1] (unsigned) or [-1, 1] (signed) when they are accessed as floating-point for rendering.
* @param {Number[]} [options.values=undefined] The values for the attributes stored in a typed array.
* @param {Number[]} [options.values] The values for the attributes stored in a typed array.
*
* @exception {DeveloperError} options.componentsPerAttribute must be between 1 and 4.
*
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/GeometryInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ define([
*
* @param {Geometry} options.geometry The geometry to instance.
* @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] The model matrix that transforms to transform the geometry from model to world coordinates.
* @param {Object} [options.id=undefined] A user-defined object to return when the instance is picked with {@link Scene#pick} or get/set per-instance attributes with {@link Primitive#getGeometryInstanceAttributes}.
* @param {Object} [options.id] A user-defined object to return when the instance is picked with {@link Scene#pick} or get/set per-instance attributes with {@link Primitive#getGeometryInstanceAttributes}.
* @param {Object} [options.attributes] Per-instance attributes like a show or color attribute shown in the example below.
*
* @example
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/GeometryInstanceAttribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ define([
* @alias GeometryInstanceAttribute
* @constructor
*
* @param {ComponentDatatype} [options.componentDatatype=undefined] The datatype of each component in the attribute, e.g., individual elements in values.
* @param {Number} [options.componentsPerAttribute=undefined] A number between 1 and 4 that defines the number of components in an attributes.
* @param {ComponentDatatype} [options.componentDatatype] The datatype of each component in the attribute, e.g., individual elements in values.
* @param {Number} [options.componentsPerAttribute] A number between 1 and 4 that defines the number of components in an attributes.
* @param {Boolean} [options.normalize=false] When <code>true</code> and <code>componentDatatype</code> is an integer format, indicate that the components should be mapped to the range [0, 1] (unsigned) or [-1, 1] (signed) when they are accessed as floating-point for rendering.
* @param {Number[]} [options.value=undefined] The value for the attribute.
* @param {Number[]} [options.value] The value for the attribute.
*
* @exception {DeveloperError} options.componentsPerAttribute must be between 1 and 4.
*
Expand Down
50 changes: 49 additions & 1 deletion Source/Core/Math.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,11 @@ define([
* @returns {Number} The corresponding angle in radians.
*/
CesiumMath.toRadians = function(degrees) {
//>>includeStart('debug', pragmas.debug);
if (!defined(degrees)) {
throw new DeveloperError('degrees is required.');
}
//>>includeEnd('debug');
return degrees * CesiumMath.RADIANS_PER_DEGREE;
};

Expand All @@ -403,6 +408,11 @@ define([
* @returns {Number} The corresponding angle in degrees.
*/
CesiumMath.toDegrees = function(radians) {
//>>includeStart('debug', pragmas.debug);
if (!defined(radians)) {
throw new DeveloperError('radians is required.');
}
//>>includeEnd('debug');
return radians * CesiumMath.DEGREES_PER_RADIAN;
};

Expand All @@ -418,6 +428,11 @@ define([
* var longitude = Cesium.Math.convertLongitudeRange(Cesium.Math.toRadians(270.0));
*/
CesiumMath.convertLongitudeRange = function(angle) {
//>>includeStart('debug', pragmas.debug);
if (!defined(angle)) {
throw new DeveloperError('angle is required.');
}
//>>includeEnd('debug');
var twoPi = CesiumMath.TWO_PI;

var simplified = angle - Math.floor(angle / twoPi) * twoPi;
Expand All @@ -438,6 +453,11 @@ define([
* @returns {Number} The angle in the range ()<code>-CesiumMath.PI</code>, <code>CesiumMath.PI</code>).
*/
CesiumMath.negativePiToPi = function(x) {
//>>includeStart('debug', pragmas.debug);
if (!defined(x)) {
throw new DeveloperError('x is required.');
}
//>>includeEnd('debug');
var epsilon10 = CesiumMath.EPSILON10;
var pi = CesiumMath.PI;
var two_pi = CesiumMath.TWO_PI;
Expand All @@ -459,6 +479,11 @@ define([
* @returns {Number} The angle in the range (0 , <code>CesiumMath.TWO_PI</code>).
*/
CesiumMath.zeroToTwoPi = function(x) {
//>>includeStart('debug', pragmas.debug);
if (!defined(x)) {
throw new DeveloperError('x is required.');
}
//>>includeEnd('debug');
var value = x % CesiumMath.TWO_PI;
// We do a second modules here if we add 2Pi to ensure that we don't have any numerical issues with very
// small negative values.
Expand All @@ -479,6 +504,15 @@ define([
* var b = Cesium.Math.equalsEpsilon(0.0, 0.1, Cesium.Math.EPSILON2); // false
*/
CesiumMath.equalsEpsilon = function(left, right, epsilon) {
//>>includeStart('debug', pragmas.debug);
if (!defined(left)) {
throw new DeveloperError('left is required.');
}

if (!defined(right)) {
throw new DeveloperError('right is required.');
}
//>>includeEnd('debug');
epsilon = defaultValue(epsilon, 0.0);
return Math.abs(left - right) <= epsilon;
};
Expand Down Expand Up @@ -540,8 +574,11 @@ define([
minimumValue = defaultValue(minimumValue, 0.0);

//>>includeStart('debug', pragmas.debug);
if (!defined(n)) {
throw new DeveloperError('n is required.');
}
if (maximumValue <= minimumValue) {
throw new DeveloperError('Maximum value must be greater than minimum value.');
throw new DeveloperError('maximumValue must be greater than minimumValue.');
}
//>>includeEnd('debug');

Expand Down Expand Up @@ -622,6 +659,17 @@ define([
* @returns The value clamped so that min <= value <= max.
*/
CesiumMath.clamp = function(value, min, max) {
//>>includeStart('debug', pragmas.debug);
if (!defined(value)) {
throw new DeveloperError('value is required');
}
if (!defined(min)) {
throw new DeveloperError('min is required.');
}
if (!defined(max)) {
throw new DeveloperError('max is required.');
}
//>>includeEnd('debug');
return value < min ? min : value > max ? max : value;
};

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/PolylineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ define([
*
* @param {Cartesian3[]} options.positions An array of {@link Cartesian3} defining the positions in the polyline as a line strip.
* @param {Number} [options.width=1.0] The width in pixels.
* @param {Color[]} [options.colors=undefined] An Array of {@link Color} defining the per vertex or per segment colors.
* @param {Color[]} [options.colors] An Array of {@link Color} defining the per vertex or per segment colors.
* @param {Boolean} [options.colorsPerVertex=false] A boolean that determines whether the colors will be flat across each segment of the line or interpolated across the vertices.
*
* @exception {DeveloperError} At least two positions are required.
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/RuntimeError.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ define([
*
* @alias RuntimeError
*
* @param {String} [message=undefined] The error message for this exception.
* @param {String} [message] The error message for this exception.
*
* @see DeveloperError
* @constructor
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/SimplePolylineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ define([
* @constructor
*
* @param {Cartesian3[]} options.positions An array of {@link Cartesian3} defining the positions in the polyline as a line strip.
* @param {Color[]} [options.colors=undefined] An Array of {@link Color} defining the per vertex or per segment colors.
* @param {Color[]} [options.colors] An Array of {@link Color} defining the per vertex or per segment colors.
* @param {Boolean} [options.colorsPerVertex=false] A boolean that determines whether the colors will be flat across each segment of the line or interpolated across the vertices.
*
* @exception {DeveloperError} At least two positions are required.
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VertexFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ define([
* to a {@link Geometry} to request that certain properties be computed, e.g., just position,
* position and normal, etc.
*
* @param {Object} [options=undefined] An object with boolean properties corresponding to VertexFormat properties as shown in the code example.
* @param {Object} [options] An object with boolean properties corresponding to VertexFormat properties as shown in the code example.
*
* @alias VertexFormat
* @constructor
Expand Down
10 changes: 9 additions & 1 deletion Source/Core/WebMercatorProjection.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ define([
'./defaultValue',
'./defined',
'./defineProperties',
'./DeveloperError',
'./Ellipsoid',
'./Math'
], function(
Expand All @@ -13,6 +14,7 @@ define([
defaultValue,
defined,
defineProperties,
DeveloperError,
Ellipsoid,
CesiumMath) {
"use strict";
Expand Down Expand Up @@ -135,12 +137,18 @@ define([
*
* @memberof WebMercatorProjection
*
* @param {Cartesian2} cartesian The web mercator coordinates in meters.
* @param {Cartesian3} cartesian The web mercator Cartesian position to unrproject with height (z) in meters.
* @param {Cartographic} [result] The instance to which to copy the result, or undefined if a
* new instance should be created.
* @returns {Cartographic} The equivalent cartographic coordinates.
*/
WebMercatorProjection.prototype.unproject = function(cartesian, result) {
//>>includeStart('debug', pragmas.debug);
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
//>>includeEnd('debug');

var oneOverEarthSemimajorAxis = this._oneOverSemimajorAxis;
var longitude = cartesian.x * oneOverEarthSemimajorAxis;
var latitude = WebMercatorProjection.mercatorAngleToGeodeticLatitude(cartesian.y * oneOverEarthSemimajorAxis);
Expand Down
8 changes: 4 additions & 4 deletions Source/Renderer/Context.js
Original file line number Diff line number Diff line change
Expand Up @@ -1074,8 +1074,8 @@ define([
*
* @memberof Context
*
* @param {Object[]} [attributes=undefined] An optional array of attributes.
* @param {IndexBuffer} [indexBuffer=undefined] An optional index buffer.
* @param {Object[]} [attributes] An optional array of attributes.
* @param {IndexBuffer} [indexBuffer] An optional index buffer.
*
* @returns {VertexArray} The vertex array, ready for use with drawing.
*
Expand Down Expand Up @@ -1575,7 +1575,7 @@ define([
*
* @memberof Context
*
* @param {Object} [renderState=undefined] The states defining the render state as shown in the example below.
* @param {Object} [renderState] The states defining the render state as shown in the example below.
*
* @exception {RuntimeError} renderState.lineWidth is out of range.
* @exception {DeveloperError} Invalid renderState.frontFace.
Expand Down Expand Up @@ -2142,7 +2142,7 @@ define([
*
* @memberof Context
*
* @param {Object} [options=undefined] An object defining the geometry, attribute indices, buffer usage, and vertex layout used to create the vertex array.
* @param {Object} [options] An object defining the geometry, attribute indices, buffer usage, and vertex layout used to create the vertex array.
*
* @exception {RuntimeError} Each attribute list must have the same number of vertices.
* @exception {DeveloperError} The geometry must have zero or one index lists.
Expand Down
6 changes: 3 additions & 3 deletions Source/Renderer/createShaderSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ define([
*
* @exports createShaderSource
*
* @param {String[]} [options.defines=undefined] An array of strings to combine containing GLSL identifiers to <code>#define</code>.
* @param {String[]} [options.sources=undefined] An array of strings to combine containing GLSL code for the shader.
* @param {String} [options.pickColorQualifier=undefined] The GLSL qualifier, <code>uniform</code> or <code>varying</code>, for the input <code>czm_pickColor</code>. When defined, a pick fragment shader is generated.
* @param {String[]} [options.defines] An array of strings to combine containing GLSL identifiers to <code>#define</code>.
* @param {String[]} [options.sources] An array of strings to combine containing GLSL code for the shader.
* @param {String} [options.pickColorQualifier] The GLSL qualifier, <code>uniform</code> or <code>varying</code>, for the input <code>czm_pickColor</code>. When defined, a pick fragment shader is generated.
*
* @returns {String} The generated GLSL shader source.
*
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/BillboardCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ define([
*
* @memberof BillboardCollection
*
* @param {Object}[billboard=undefined] A template describing the billboard's properties as shown in Example 1.
* @param {Object}[billboard] A template describing the billboard's properties as shown in Example 1.
*
* @returns {Billboard} The billboard that was added to the collection.
*
Expand Down
6 changes: 3 additions & 3 deletions Source/Scene/DebugAppearance.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ define([
*
* @param {String} options.attributeName The name of the attribute to visualize.
* @param {String} [options.glslDatatype='vec3'] The GLSL datatype of the attribute. Supported datatypes are <code>float</code>, <code>vec2</code>, <code>vec3</code>, and <code>vec4</code>.
* @param {String} [options.vertexShaderSource=undefined] Optional GLSL vertex shader source to override the default vertex shader.
* @param {String} [options.fragmentShaderSource=undefined] Optional GLSL fragment shader source to override the default fragment shader.
* @param {RenderState} [options.renderState=undefined] Optional render state to override the default render state.
* @param {String} [options.vertexShaderSource] Optional GLSL vertex shader source to override the default vertex shader.
* @param {String} [options.fragmentShaderSource] Optional GLSL fragment shader source to override the default fragment shader.
* @param {RenderState} [options.renderState] Optional render state to override the default render state.
*
* @exception {DeveloperError} options.glslDatatype must be float, vec2, vec3, or vec4.
*
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/DebugModelMatrixPrimitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ define([
* @param {Number} [options.width=2.0] The width of the axes in pixels.
* @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] The 4x4 matrix that defines the reference frame, i.e., origin plus axes, to visualize.
* @param {Boolean} [options.show=true] Determines if this primitive will be shown.
* @param {Object} [options.id=undefined] A user-defined object to return when the instance is picked with {@link Scene#pick}
* @param {Object} [options.id] A user-defined object to return when the instance is picked with {@link Scene#pick}
*
* @example
* primitives.add(new Cesium.DebugModelMatrixPrimitive({
Expand Down
Loading

0 comments on commit b92de10

Please sign in to comment.