From 31cd744bcc83623d19550d7b4f65642e0b03e89b Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Wed, 13 Nov 2013 14:59:07 -0500 Subject: [PATCH 01/33] Comment out all developer errors in Context. --- Source/Renderer/Context.js | 70 +++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/Source/Renderer/Context.js b/Source/Renderer/Context.js index 44cc1140be5c..aee6d8f4d37c 100644 --- a/Source/Renderer/Context.js +++ b/Source/Renderer/Context.js @@ -182,9 +182,11 @@ define([ throw new RuntimeError('The browser does not support WebGL. Visit http://get.webgl.org.'); } + /* if (!defined(canvas)) { throw new DeveloperError('canvas is required.'); } + */ this._canvas = canvas; @@ -1070,9 +1072,12 @@ define([ } else if (typeof typedArrayOrSizeInBytes === 'object' && typeof typedArrayOrSizeInBytes.byteLength === 'number') { sizeInBytes = typedArrayOrSizeInBytes.byteLength; } else { + /* throw new DeveloperError('typedArrayOrSizeInBytes must be either a typed array or a number.'); + */ } + /* if (sizeInBytes <= 0) { throw new DeveloperError('typedArrayOrSizeInBytes must be greater than zero.'); } @@ -1080,6 +1085,7 @@ define([ if (!BufferUsage.validate(usage)) { throw new DeveloperError('usage is invalid.'); } + */ var buffer = gl.createBuffer(); gl.bindBuffer(bufferTarget, buffer); @@ -1168,9 +1174,11 @@ define([ * BufferUsage.STATIC_DRAW, IndexDatatype.UNSIGNED_SHORT) */ Context.prototype.createIndexBuffer = function(typedArrayOrSizeInBytes, usage, indexDatatype) { + /* if (!IndexDatatype.validate(indexDatatype)) { throw new DeveloperError('Invalid indexDatatype.'); } + */ if ((indexDatatype.value === IndexDatatype.UNSIGNED_INT.value) && !this.getElementIndexUint()) { throw new RuntimeError('IndexDatatype.UNSIGNED_INT requires OES_element_index_uint, which is not supported on this system.'); @@ -1298,7 +1306,6 @@ define([ * * @exception {RuntimeError} When description.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, this WebGL implementation must support WEBGL_depth_texture. * @exception {RuntimeError} When description.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension. - * @exception {DeveloperError} description is required. * @exception {DeveloperError} description requires a source field to create an initialized texture or width and height fields to create a blank texture. * @exception {DeveloperError} Width must be greater than zero. * @exception {DeveloperError} Width must be less than or equal to the maximum texture size. @@ -1315,14 +1322,15 @@ define([ * @see Context#createSampler */ Context.prototype.createTexture2D = function(description) { - if (!description) { - throw new DeveloperError('description is required.'); - } + description = defaultValue(description, defaultValue.EMPTY_OBJECT); var source = description.source; var width = defined(source) ? source.width : description.width; var height = defined(source) ? source.height : description.height; + var pixelFormat = defaultValue(description.pixelFormat, PixelFormat.RGBA); + var pixelDatatype = defaultValue(description.pixelDatatype, PixelDatatype.UNSIGNED_BYTE); + /* if (!defined(width) || !defined(height)) { throw new DeveloperError('description requires a source field to create an initialized texture or width and height fields to create a blank texture.'); } @@ -1343,20 +1351,14 @@ define([ throw new DeveloperError('Height must be less than or equal to the maximum texture size (' + this._maximumTextureSize + '). Check getMaximumTextureSize().'); } - var pixelFormat = defaultValue(description.pixelFormat, PixelFormat.RGBA); if (!PixelFormat.validate(pixelFormat)) { throw new DeveloperError('Invalid description.pixelFormat.'); } - var pixelDatatype = defaultValue(description.pixelDatatype, PixelDatatype.UNSIGNED_BYTE); if (!PixelDatatype.validate(pixelDatatype)) { throw new DeveloperError('Invalid description.pixelDatatype.'); } - if ((pixelDatatype === PixelDatatype.FLOAT) && !this.getFloatingPointTexture()) { - throw new RuntimeError('When description.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.'); - } - if ((pixelFormat === PixelFormat.DEPTH_COMPONENT) && ((pixelDatatype !== PixelDatatype.UNSIGNED_SHORT) && (pixelDatatype !== PixelDatatype.UNSIGNED_INT))) { throw new DeveloperError('When description.pixelFormat is DEPTH_COMPONENT, description.pixelDatatype must be UNSIGNED_SHORT or UNSIGNED_INT.'); @@ -1365,11 +1367,18 @@ define([ if ((pixelFormat === PixelFormat.DEPTH_STENCIL) && (pixelDatatype !== PixelDatatype.UNSIGNED_INT_24_8_WEBGL)) { throw new DeveloperError('When description.pixelFormat is DEPTH_STENCIL, description.pixelDatatype must be UNSIGNED_INT_24_8_WEBGL.'); } + */ + + if ((pixelDatatype === PixelDatatype.FLOAT) && !this.getFloatingPointTexture()) { + throw new RuntimeError('When description.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.'); + } if (PixelFormat.isDepthFormat(pixelFormat)) { - if (source) { + /* + if (defined(source)) { throw new DeveloperError('When description.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, source cannot be provided.'); } + */ if (!this.getDepthTexture()) { throw new RuntimeError('When description.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, this WebGL implementation must support WEBGL_depth_texture. Check getDepthTexture().'); @@ -1446,6 +1455,7 @@ define([ width = defaultValue(width, gl.drawingBufferWidth); height = defaultValue(height, gl.drawingBufferHeight); + /* if (!PixelFormat.validate(pixelFormat)) { throw new DeveloperError('Invalid pixelFormat.'); } @@ -1469,6 +1479,7 @@ define([ if (framebufferYOffset + height > gl.drawingBufferHeight) { throw new DeveloperError('framebufferYOffset + height must be less than or equal to drawingBufferHeight.'); } + */ var textureTarget = gl.TEXTURE_2D; var texture = gl.createTexture(); @@ -1512,7 +1523,6 @@ define([ * @returns {CubeMap} DOC_TBA. * * @exception {RuntimeError} When description.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension. - * @exception {DeveloperError} description is required. * @exception {DeveloperError} description.source requires positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ faces. * @exception {DeveloperError} Each face in description.sources must have the same width and height. * @exception {DeveloperError} description requires a source field to create an initialized cube map or width and height fields to create a blank cube map. @@ -1528,34 +1538,41 @@ define([ * @see Context#createSampler */ Context.prototype.createCubeMap = function(description) { - if (!description) { - throw new DeveloperError('description is required.'); - } + description = defaultValue(description, defaultValue.EMPTY_OBJECT); var source = description.source; var width; var height; - if (source) { + if (defined(source)) { var faces = [source.positiveX, source.negativeX, source.positiveY, source.negativeY, source.positiveZ, source.negativeZ]; + /* if (!faces[0] || !faces[1] || !faces[2] || !faces[3] || !faces[4] || !faces[5]) { throw new DeveloperError('description.source requires positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ faces.'); } + */ width = faces[0].width; height = faces[0].height; + /* for ( var i = 1; i < 6; ++i) { if ((Number(faces[i].width) !== width) || (Number(faces[i].height) !== height)) { throw new DeveloperError('Each face in description.source must have the same width and height.'); } } + */ } else { width = description.width; height = description.height; } + var size = width; + var pixelFormat = defaultValue(description.pixelFormat, PixelFormat.RGBA); + var pixelDatatype = defaultValue(description.pixelDatatype, PixelDatatype.UNSIGNED_BYTE); + + /* if (!defined(width) || !defined(height)) { throw new DeveloperError('description requires a source field to create an initialized cube map or width and height fields to create a blank cube map.'); } @@ -1564,8 +1581,6 @@ define([ throw new DeveloperError('Width must equal height.'); } - var size = width; - if (size <= 0) { throw new DeveloperError('Width and height must be greater than zero.'); } @@ -1574,7 +1589,6 @@ define([ throw new DeveloperError('Width and height must be less than or equal to the maximum cube map size (' + this._maximumCubeMapSize + '). Check getMaximumCubeMapSize().'); } - var pixelFormat = defaultValue(description.pixelFormat, PixelFormat.RGBA); if (!PixelFormat.validate(pixelFormat)) { throw new DeveloperError('Invalid description.pixelFormat.'); } @@ -1583,10 +1597,10 @@ define([ throw new DeveloperError('description.pixelFormat cannot be DEPTH_COMPONENT or DEPTH_STENCIL.'); } - var pixelDatatype = defaultValue(description.pixelDatatype, PixelDatatype.UNSIGNED_BYTE); if (!PixelDatatype.validate(pixelDatatype)) { throw new DeveloperError('Invalid description.pixelDatatype.'); } + */ if ((pixelDatatype === PixelDatatype.FLOAT) && !this.getFloatingPointTexture()) { throw new RuntimeError('When description.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.'); @@ -1718,6 +1732,7 @@ define([ var width = defined(description.width) ? description.width : gl.drawingBufferWidth; var height = defined(description.height) ? description.height : gl.drawingBufferHeight; + /* if (!RenderbufferFormat.validate(format)) { throw new DeveloperError('Invalid format.'); } @@ -1737,6 +1752,7 @@ define([ if (height > this.getMaximumRenderbufferSize()) { throw new DeveloperError('Height must be less than or equal to the maximum renderbuffer size (' + this.getMaximumRenderbufferSize() + '). Check getMaximumRenderbufferSize().'); } + */ return new Renderbuffer(gl, format, width, height); }; @@ -1913,6 +1929,7 @@ define([ maximumAnisotropy : (defined(sampler.maximumAnisotropy)) ? sampler.maximumAnisotropy : 1.0 }; + /* if (!TextureWrap.validate(s.wrapS)) { throw new DeveloperError('Invalid sampler.wrapS.'); } @@ -1932,6 +1949,7 @@ define([ if (s.maximumAnisotropy < 1.0) { throw new DeveloperError('sampler.maximumAnisotropy must be greater than or equal to one.'); } + */ return s; }; @@ -2043,11 +2061,13 @@ define([ function beginDraw(context, framebuffer, drawCommand, passState) { var rs = defined(drawCommand.renderState) ? drawCommand.renderState : context._defaultRenderState; + /* if (defined(framebuffer) && rs.depthTest) { if (rs.depthTest.enabled && !framebuffer.hasDepthAttachment()) { throw new DeveloperError('The depth test can not be enabled (drawCommand.renderState.depthTest.enabled) because the framebuffer (drawCommand.framebuffer) does not have a depth or depth-stencil renderbuffer.'); } } + */ /////////////////////////////////////////////////////////////////////// @@ -2069,6 +2089,7 @@ define([ var offset = drawCommand.offset; var count = drawCommand.count; + /* if (!PrimitiveType.validate(primitiveType)) { throw new DeveloperError('drawCommand.primitiveType is required and must be valid.'); } @@ -2084,6 +2105,7 @@ define([ if (count < 0) { throw new DeveloperError('drawCommand.count must be omitted or greater than or equal to zero.'); } + */ context._us.setModel(defaultValue(drawCommand.modelMatrix, Matrix4.IDENTITY)); drawCommand.shaderProgram._setUniforms(drawCommand.uniformMap, context._us, context._validateSP); @@ -2158,6 +2180,7 @@ define([ * @see Context#createRenderState */ Context.prototype.draw = function(drawCommand, passState) { + /* if (!defined(drawCommand)) { throw new DeveloperError('drawCommand is required.'); } @@ -2165,6 +2188,7 @@ define([ if (!defined(drawCommand.shaderProgram)) { throw new DeveloperError('drawCommand.shaderProgram is required.'); } + */ passState = defaultValue(passState, this._defaultPassState); // The command's framebuffer takes presidence over the pass' framebuffer, e.g., for off-screen rendering. @@ -2210,6 +2234,7 @@ define([ var height = readState.height || gl.drawingBufferHeight; var framebuffer = readState.framebuffer || null; + /* if (width <= 0) { throw new DeveloperError('readState.width must be greater than zero.'); } @@ -2217,6 +2242,7 @@ define([ if (height <= 0) { throw new DeveloperError('readState.height must be greater than zero.'); } + */ var pixels = new Uint8Array(4 * width * height); @@ -2538,9 +2564,11 @@ define([ * @see Context#createPickId */ Context.prototype.getObjectByPickColor = function(pickColor) { + /* if (!defined(pickColor)) { throw new DeveloperError('pickColor is required.'); } + */ return this._pickObjects[pickColor.toRgba()]; }; @@ -2579,9 +2607,11 @@ define([ * }); */ Context.prototype.createPickId = function(object) { + /* if (!defined(object)) { throw new DeveloperError('object is required.'); } + */ // the increment and assignment have to be separate statements to // actually detect overflow in the Uint32 value From f355a0612f9f00e7d9a092cb84ee14866372dbdb Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Wed, 13 Nov 2013 17:51:20 -0500 Subject: [PATCH 02/33] Add preprocessing build target and script for file search/replace. --- Source/Renderer/Context.js | 72 +++++++++++++++---------------- Tools/buildTasks/searchReplace.js | 23 ++++++++++ build.xml | 25 +++++++++++ 3 files changed, 84 insertions(+), 36 deletions(-) create mode 100644 Tools/buildTasks/searchReplace.js diff --git a/Source/Renderer/Context.js b/Source/Renderer/Context.js index aee6d8f4d37c..018951a63192 100644 --- a/Source/Renderer/Context.js +++ b/Source/Renderer/Context.js @@ -182,11 +182,11 @@ define([ throw new RuntimeError('The browser does not support WebGL. Visit http://get.webgl.org.'); } - /* + // #ifdef CESIUM_DEBUG if (!defined(canvas)) { throw new DeveloperError('canvas is required.'); } - */ + // #endif CESIUM_DEBUG this._canvas = canvas; @@ -1072,12 +1072,12 @@ define([ } else if (typeof typedArrayOrSizeInBytes === 'object' && typeof typedArrayOrSizeInBytes.byteLength === 'number') { sizeInBytes = typedArrayOrSizeInBytes.byteLength; } else { - /* + // #ifdef CESIUM_DEBUG throw new DeveloperError('typedArrayOrSizeInBytes must be either a typed array or a number.'); - */ + // #endif CESIUM_DEBUG } - /* + // #ifdef CESIUM_DEBUG if (sizeInBytes <= 0) { throw new DeveloperError('typedArrayOrSizeInBytes must be greater than zero.'); } @@ -1085,7 +1085,7 @@ define([ if (!BufferUsage.validate(usage)) { throw new DeveloperError('usage is invalid.'); } - */ + // #endif CESIUM_DEBUG var buffer = gl.createBuffer(); gl.bindBuffer(bufferTarget, buffer); @@ -1174,11 +1174,11 @@ define([ * BufferUsage.STATIC_DRAW, IndexDatatype.UNSIGNED_SHORT) */ Context.prototype.createIndexBuffer = function(typedArrayOrSizeInBytes, usage, indexDatatype) { - /* + // #ifdef CESIUM_DEBUG if (!IndexDatatype.validate(indexDatatype)) { throw new DeveloperError('Invalid indexDatatype.'); } - */ + // #endif CESIUM_DEBUG if ((indexDatatype.value === IndexDatatype.UNSIGNED_INT.value) && !this.getElementIndexUint()) { throw new RuntimeError('IndexDatatype.UNSIGNED_INT requires OES_element_index_uint, which is not supported on this system.'); @@ -1330,7 +1330,7 @@ define([ var pixelFormat = defaultValue(description.pixelFormat, PixelFormat.RGBA); var pixelDatatype = defaultValue(description.pixelDatatype, PixelDatatype.UNSIGNED_BYTE); - /* + // #ifdef CESIUM_DEBUG if (!defined(width) || !defined(height)) { throw new DeveloperError('description requires a source field to create an initialized texture or width and height fields to create a blank texture.'); } @@ -1367,18 +1367,18 @@ define([ if ((pixelFormat === PixelFormat.DEPTH_STENCIL) && (pixelDatatype !== PixelDatatype.UNSIGNED_INT_24_8_WEBGL)) { throw new DeveloperError('When description.pixelFormat is DEPTH_STENCIL, description.pixelDatatype must be UNSIGNED_INT_24_8_WEBGL.'); } - */ + // #endif CESIUM_DEBUG if ((pixelDatatype === PixelDatatype.FLOAT) && !this.getFloatingPointTexture()) { throw new RuntimeError('When description.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.'); } if (PixelFormat.isDepthFormat(pixelFormat)) { - /* + // #ifdef CESIUM_DEBUG if (defined(source)) { throw new DeveloperError('When description.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, source cannot be provided.'); } - */ + // #endif CESIUM_DEBUG if (!this.getDepthTexture()) { throw new RuntimeError('When description.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, this WebGL implementation must support WEBGL_depth_texture. Check getDepthTexture().'); @@ -1455,7 +1455,7 @@ define([ width = defaultValue(width, gl.drawingBufferWidth); height = defaultValue(height, gl.drawingBufferHeight); - /* + // #ifdef CESIUM_DEBUG if (!PixelFormat.validate(pixelFormat)) { throw new DeveloperError('Invalid pixelFormat.'); } @@ -1479,7 +1479,7 @@ define([ if (framebufferYOffset + height > gl.drawingBufferHeight) { throw new DeveloperError('framebufferYOffset + height must be less than or equal to drawingBufferHeight.'); } - */ + // #endif CESIUM_DEBUG var textureTarget = gl.TEXTURE_2D; var texture = gl.createTexture(); @@ -1547,22 +1547,22 @@ define([ if (defined(source)) { var faces = [source.positiveX, source.negativeX, source.positiveY, source.negativeY, source.positiveZ, source.negativeZ]; - /* + // #ifdef CESIUM_DEBUG if (!faces[0] || !faces[1] || !faces[2] || !faces[3] || !faces[4] || !faces[5]) { throw new DeveloperError('description.source requires positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ faces.'); } - */ + // #endif CESIUM_DEBUG width = faces[0].width; height = faces[0].height; - /* + // #ifdef CESIUM_DEBUG for ( var i = 1; i < 6; ++i) { if ((Number(faces[i].width) !== width) || (Number(faces[i].height) !== height)) { throw new DeveloperError('Each face in description.source must have the same width and height.'); } } - */ + // #endif CESIUM_DEBUG } else { width = description.width; height = description.height; @@ -1572,7 +1572,7 @@ define([ var pixelFormat = defaultValue(description.pixelFormat, PixelFormat.RGBA); var pixelDatatype = defaultValue(description.pixelDatatype, PixelDatatype.UNSIGNED_BYTE); - /* + // #ifdef CESIUM_DEBUG if (!defined(width) || !defined(height)) { throw new DeveloperError('description requires a source field to create an initialized cube map or width and height fields to create a blank cube map.'); } @@ -1600,7 +1600,7 @@ define([ if (!PixelDatatype.validate(pixelDatatype)) { throw new DeveloperError('Invalid description.pixelDatatype.'); } - */ + // #endif CESIUM_DEBUG if ((pixelDatatype === PixelDatatype.FLOAT) && !this.getFloatingPointTexture()) { throw new RuntimeError('When description.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.'); @@ -1732,7 +1732,7 @@ define([ var width = defined(description.width) ? description.width : gl.drawingBufferWidth; var height = defined(description.height) ? description.height : gl.drawingBufferHeight; - /* + // #ifdef CESIUM_DEBUG if (!RenderbufferFormat.validate(format)) { throw new DeveloperError('Invalid format.'); } @@ -1752,7 +1752,7 @@ define([ if (height > this.getMaximumRenderbufferSize()) { throw new DeveloperError('Height must be less than or equal to the maximum renderbuffer size (' + this.getMaximumRenderbufferSize() + '). Check getMaximumRenderbufferSize().'); } - */ + // #endif CESIUM_DEBUG return new Renderbuffer(gl, format, width, height); }; @@ -1929,7 +1929,7 @@ define([ maximumAnisotropy : (defined(sampler.maximumAnisotropy)) ? sampler.maximumAnisotropy : 1.0 }; - /* + // #ifdef CESIUM_DEBUG if (!TextureWrap.validate(s.wrapS)) { throw new DeveloperError('Invalid sampler.wrapS.'); } @@ -1949,7 +1949,7 @@ define([ if (s.maximumAnisotropy < 1.0) { throw new DeveloperError('sampler.maximumAnisotropy must be greater than or equal to one.'); } - */ + // #endif CESIUM_DEBUG return s; }; @@ -2061,13 +2061,13 @@ define([ function beginDraw(context, framebuffer, drawCommand, passState) { var rs = defined(drawCommand.renderState) ? drawCommand.renderState : context._defaultRenderState; - /* + // #ifdef CESIUM_DEBUG if (defined(framebuffer) && rs.depthTest) { if (rs.depthTest.enabled && !framebuffer.hasDepthAttachment()) { throw new DeveloperError('The depth test can not be enabled (drawCommand.renderState.depthTest.enabled) because the framebuffer (drawCommand.framebuffer) does not have a depth or depth-stencil renderbuffer.'); } } - */ + // #endif CESIUM_DEBUG /////////////////////////////////////////////////////////////////////// @@ -2089,7 +2089,7 @@ define([ var offset = drawCommand.offset; var count = drawCommand.count; - /* + // #ifdef CESIUM_DEBUG if (!PrimitiveType.validate(primitiveType)) { throw new DeveloperError('drawCommand.primitiveType is required and must be valid.'); } @@ -2105,7 +2105,7 @@ define([ if (count < 0) { throw new DeveloperError('drawCommand.count must be omitted or greater than or equal to zero.'); } - */ + // #endif CESIUM_DEBUG context._us.setModel(defaultValue(drawCommand.modelMatrix, Matrix4.IDENTITY)); drawCommand.shaderProgram._setUniforms(drawCommand.uniformMap, context._us, context._validateSP); @@ -2180,7 +2180,7 @@ define([ * @see Context#createRenderState */ Context.prototype.draw = function(drawCommand, passState) { - /* + // #ifdef CESIUM_DEBUG if (!defined(drawCommand)) { throw new DeveloperError('drawCommand is required.'); } @@ -2188,7 +2188,7 @@ define([ if (!defined(drawCommand.shaderProgram)) { throw new DeveloperError('drawCommand.shaderProgram is required.'); } - */ + // #endif CESIUM_DEBUG passState = defaultValue(passState, this._defaultPassState); // The command's framebuffer takes presidence over the pass' framebuffer, e.g., for off-screen rendering. @@ -2234,7 +2234,7 @@ define([ var height = readState.height || gl.drawingBufferHeight; var framebuffer = readState.framebuffer || null; - /* + // #ifdef CESIUM_DEBUG if (width <= 0) { throw new DeveloperError('readState.width must be greater than zero.'); } @@ -2242,7 +2242,7 @@ define([ if (height <= 0) { throw new DeveloperError('readState.height must be greater than zero.'); } - */ + // #endif CESIUM_DEBUG var pixels = new Uint8Array(4 * width * height); @@ -2564,11 +2564,11 @@ define([ * @see Context#createPickId */ Context.prototype.getObjectByPickColor = function(pickColor) { - /* + // #ifdef CESIUM_DEBUG if (!defined(pickColor)) { throw new DeveloperError('pickColor is required.'); } - */ + // #endif CESIUM_DEBUG return this._pickObjects[pickColor.toRgba()]; }; @@ -2607,11 +2607,11 @@ define([ * }); */ Context.prototype.createPickId = function(object) { - /* + // #ifdef CESIUM_DEBUG if (!defined(object)) { throw new DeveloperError('object is required.'); } - */ + // #endif CESIUM_DEBUG // the increment and assignment have to be separate statements to // actually detect overflow in the Uint32 value diff --git a/Tools/buildTasks/searchReplace.js b/Tools/buildTasks/searchReplace.js new file mode 100644 index 000000000000..31bf5b46191d --- /dev/null +++ b/Tools/buildTasks/searchReplace.js @@ -0,0 +1,23 @@ +/*global importClass,project,attributes,elements,java,Packages*/ +importClass(Packages.org.mozilla.javascript.tools.shell.Main); /*global Main*/ +Main.exec(['-e', '{}']); +var load = Main.global.load; + +load(project.getProperty('tasksDirectory') + '/shared.js'); /*global forEachFile,readFileContents,writeFileContents,File,FileReader,FileWriter,FileUtils*/ + +var search = attributes.get('search'); +var modifiers = attributes.get('modifiers'); +var replace = attributes.get('replace'); + +var regex = new RegExp(search, modifiers); + +forEachFile('sourcefiles', function(relativePath, file) { + "use strict"; + + var contents = readFileContents(file); + var newContents = contents.replace(regex, replace); + + if (contents !== newContents) { + writeFileContents(file.getAbsolutePath(), newContents, true); + } +}); \ No newline at end of file diff --git a/build.xml b/build.xml index 2cbbe7aa4b5e..979bd7fc82a0 100644 --- a/build.xml +++ b/build.xml @@ -21,6 +21,24 @@ + + + + + + + + + + + + + + + + + + @@ -163,6 +181,13 @@ + + + + + + + From ec4607c32fbeb4293621efeab318c36758ed9669 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Wed, 13 Nov 2013 20:11:50 -0500 Subject: [PATCH 03/33] Revert previous changes in favor of using requirejs pragmas. --- Source/Renderer/Context.js | 72 +++++++++++++++---------------- Tools/build.js | 5 ++- Tools/buildTasks/searchReplace.js | 23 ---------- build.xml | 25 ----------- 4 files changed, 40 insertions(+), 85 deletions(-) delete mode 100644 Tools/buildTasks/searchReplace.js diff --git a/Source/Renderer/Context.js b/Source/Renderer/Context.js index 018951a63192..e884164bf735 100644 --- a/Source/Renderer/Context.js +++ b/Source/Renderer/Context.js @@ -182,11 +182,11 @@ define([ throw new RuntimeError('The browser does not support WebGL. Visit http://get.webgl.org.'); } - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); if (!defined(canvas)) { throw new DeveloperError('canvas is required.'); } - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); this._canvas = canvas; @@ -1072,12 +1072,12 @@ define([ } else if (typeof typedArrayOrSizeInBytes === 'object' && typeof typedArrayOrSizeInBytes.byteLength === 'number') { sizeInBytes = typedArrayOrSizeInBytes.byteLength; } else { - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); throw new DeveloperError('typedArrayOrSizeInBytes must be either a typed array or a number.'); - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); } - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); if (sizeInBytes <= 0) { throw new DeveloperError('typedArrayOrSizeInBytes must be greater than zero.'); } @@ -1085,7 +1085,7 @@ define([ if (!BufferUsage.validate(usage)) { throw new DeveloperError('usage is invalid.'); } - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); var buffer = gl.createBuffer(); gl.bindBuffer(bufferTarget, buffer); @@ -1174,11 +1174,11 @@ define([ * BufferUsage.STATIC_DRAW, IndexDatatype.UNSIGNED_SHORT) */ Context.prototype.createIndexBuffer = function(typedArrayOrSizeInBytes, usage, indexDatatype) { - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); if (!IndexDatatype.validate(indexDatatype)) { throw new DeveloperError('Invalid indexDatatype.'); } - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); if ((indexDatatype.value === IndexDatatype.UNSIGNED_INT.value) && !this.getElementIndexUint()) { throw new RuntimeError('IndexDatatype.UNSIGNED_INT requires OES_element_index_uint, which is not supported on this system.'); @@ -1330,7 +1330,7 @@ define([ var pixelFormat = defaultValue(description.pixelFormat, PixelFormat.RGBA); var pixelDatatype = defaultValue(description.pixelDatatype, PixelDatatype.UNSIGNED_BYTE); - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); if (!defined(width) || !defined(height)) { throw new DeveloperError('description requires a source field to create an initialized texture or width and height fields to create a blank texture.'); } @@ -1367,18 +1367,18 @@ define([ if ((pixelFormat === PixelFormat.DEPTH_STENCIL) && (pixelDatatype !== PixelDatatype.UNSIGNED_INT_24_8_WEBGL)) { throw new DeveloperError('When description.pixelFormat is DEPTH_STENCIL, description.pixelDatatype must be UNSIGNED_INT_24_8_WEBGL.'); } - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); if ((pixelDatatype === PixelDatatype.FLOAT) && !this.getFloatingPointTexture()) { throw new RuntimeError('When description.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.'); } if (PixelFormat.isDepthFormat(pixelFormat)) { - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); if (defined(source)) { throw new DeveloperError('When description.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, source cannot be provided.'); } - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); if (!this.getDepthTexture()) { throw new RuntimeError('When description.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, this WebGL implementation must support WEBGL_depth_texture. Check getDepthTexture().'); @@ -1455,7 +1455,7 @@ define([ width = defaultValue(width, gl.drawingBufferWidth); height = defaultValue(height, gl.drawingBufferHeight); - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); if (!PixelFormat.validate(pixelFormat)) { throw new DeveloperError('Invalid pixelFormat.'); } @@ -1479,7 +1479,7 @@ define([ if (framebufferYOffset + height > gl.drawingBufferHeight) { throw new DeveloperError('framebufferYOffset + height must be less than or equal to drawingBufferHeight.'); } - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); var textureTarget = gl.TEXTURE_2D; var texture = gl.createTexture(); @@ -1547,22 +1547,22 @@ define([ if (defined(source)) { var faces = [source.positiveX, source.negativeX, source.positiveY, source.negativeY, source.positiveZ, source.negativeZ]; - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); if (!faces[0] || !faces[1] || !faces[2] || !faces[3] || !faces[4] || !faces[5]) { throw new DeveloperError('description.source requires positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ faces.'); } - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); width = faces[0].width; height = faces[0].height; - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); for ( var i = 1; i < 6; ++i) { if ((Number(faces[i].width) !== width) || (Number(faces[i].height) !== height)) { throw new DeveloperError('Each face in description.source must have the same width and height.'); } } - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); } else { width = description.width; height = description.height; @@ -1572,7 +1572,7 @@ define([ var pixelFormat = defaultValue(description.pixelFormat, PixelFormat.RGBA); var pixelDatatype = defaultValue(description.pixelDatatype, PixelDatatype.UNSIGNED_BYTE); - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); if (!defined(width) || !defined(height)) { throw new DeveloperError('description requires a source field to create an initialized cube map or width and height fields to create a blank cube map.'); } @@ -1600,7 +1600,7 @@ define([ if (!PixelDatatype.validate(pixelDatatype)) { throw new DeveloperError('Invalid description.pixelDatatype.'); } - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); if ((pixelDatatype === PixelDatatype.FLOAT) && !this.getFloatingPointTexture()) { throw new RuntimeError('When description.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.'); @@ -1732,7 +1732,7 @@ define([ var width = defined(description.width) ? description.width : gl.drawingBufferWidth; var height = defined(description.height) ? description.height : gl.drawingBufferHeight; - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); if (!RenderbufferFormat.validate(format)) { throw new DeveloperError('Invalid format.'); } @@ -1752,7 +1752,7 @@ define([ if (height > this.getMaximumRenderbufferSize()) { throw new DeveloperError('Height must be less than or equal to the maximum renderbuffer size (' + this.getMaximumRenderbufferSize() + '). Check getMaximumRenderbufferSize().'); } - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); return new Renderbuffer(gl, format, width, height); }; @@ -1929,7 +1929,7 @@ define([ maximumAnisotropy : (defined(sampler.maximumAnisotropy)) ? sampler.maximumAnisotropy : 1.0 }; - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); if (!TextureWrap.validate(s.wrapS)) { throw new DeveloperError('Invalid sampler.wrapS.'); } @@ -1949,7 +1949,7 @@ define([ if (s.maximumAnisotropy < 1.0) { throw new DeveloperError('sampler.maximumAnisotropy must be greater than or equal to one.'); } - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); return s; }; @@ -2061,13 +2061,13 @@ define([ function beginDraw(context, framebuffer, drawCommand, passState) { var rs = defined(drawCommand.renderState) ? drawCommand.renderState : context._defaultRenderState; - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); if (defined(framebuffer) && rs.depthTest) { if (rs.depthTest.enabled && !framebuffer.hasDepthAttachment()) { throw new DeveloperError('The depth test can not be enabled (drawCommand.renderState.depthTest.enabled) because the framebuffer (drawCommand.framebuffer) does not have a depth or depth-stencil renderbuffer.'); } } - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); /////////////////////////////////////////////////////////////////////// @@ -2089,7 +2089,7 @@ define([ var offset = drawCommand.offset; var count = drawCommand.count; - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); if (!PrimitiveType.validate(primitiveType)) { throw new DeveloperError('drawCommand.primitiveType is required and must be valid.'); } @@ -2105,7 +2105,7 @@ define([ if (count < 0) { throw new DeveloperError('drawCommand.count must be omitted or greater than or equal to zero.'); } - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); context._us.setModel(defaultValue(drawCommand.modelMatrix, Matrix4.IDENTITY)); drawCommand.shaderProgram._setUniforms(drawCommand.uniformMap, context._us, context._validateSP); @@ -2180,7 +2180,7 @@ define([ * @see Context#createRenderState */ Context.prototype.draw = function(drawCommand, passState) { - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); if (!defined(drawCommand)) { throw new DeveloperError('drawCommand is required.'); } @@ -2188,7 +2188,7 @@ define([ if (!defined(drawCommand.shaderProgram)) { throw new DeveloperError('drawCommand.shaderProgram is required.'); } - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); passState = defaultValue(passState, this._defaultPassState); // The command's framebuffer takes presidence over the pass' framebuffer, e.g., for off-screen rendering. @@ -2234,7 +2234,7 @@ define([ var height = readState.height || gl.drawingBufferHeight; var framebuffer = readState.framebuffer || null; - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); if (width <= 0) { throw new DeveloperError('readState.width must be greater than zero.'); } @@ -2242,7 +2242,7 @@ define([ if (height <= 0) { throw new DeveloperError('readState.height must be greater than zero.'); } - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); var pixels = new Uint8Array(4 * width * height); @@ -2564,11 +2564,11 @@ define([ * @see Context#createPickId */ Context.prototype.getObjectByPickColor = function(pickColor) { - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); if (!defined(pickColor)) { throw new DeveloperError('pickColor is required.'); } - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); return this._pickObjects[pickColor.toRgba()]; }; @@ -2607,11 +2607,11 @@ define([ * }); */ Context.prototype.createPickId = function(object) { - // #ifdef CESIUM_DEBUG + //>>excludeStart('debug', pragmas.debug); if (!defined(object)) { throw new DeveloperError('object is required.'); } - // #endif CESIUM_DEBUG + //>>excludeEnd('debug'); // the increment and assignment have to be separate statements to // actually detect overflow in the Uint32 value diff --git a/Tools/build.js b/Tools/build.js index 3de84b2c1b1e..81ddd043af6e 100644 --- a/Tools/build.js +++ b/Tools/build.js @@ -1,5 +1,8 @@ ({ wrap : true, useStrict : true, - optimizeCss : 'standard' + optimizeCss : 'standard', + pragmas : { + debug : true + } }) \ No newline at end of file diff --git a/Tools/buildTasks/searchReplace.js b/Tools/buildTasks/searchReplace.js deleted file mode 100644 index 31bf5b46191d..000000000000 --- a/Tools/buildTasks/searchReplace.js +++ /dev/null @@ -1,23 +0,0 @@ -/*global importClass,project,attributes,elements,java,Packages*/ -importClass(Packages.org.mozilla.javascript.tools.shell.Main); /*global Main*/ -Main.exec(['-e', '{}']); -var load = Main.global.load; - -load(project.getProperty('tasksDirectory') + '/shared.js'); /*global forEachFile,readFileContents,writeFileContents,File,FileReader,FileWriter,FileUtils*/ - -var search = attributes.get('search'); -var modifiers = attributes.get('modifiers'); -var replace = attributes.get('replace'); - -var regex = new RegExp(search, modifiers); - -forEachFile('sourcefiles', function(relativePath, file) { - "use strict"; - - var contents = readFileContents(file); - var newContents = contents.replace(regex, replace); - - if (contents !== newContents) { - writeFileContents(file.getAbsolutePath(), newContents, true); - } -}); \ No newline at end of file diff --git a/build.xml b/build.xml index 979bd7fc82a0..1facd11ed972 100644 --- a/build.xml +++ b/build.xml @@ -20,24 +20,6 @@ - - - - - - - - - - - - - - - - - - @@ -181,13 +163,6 @@ - - - - - - - From 0d17867a3951e1e52928fb7aed050d455034dacf Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Wed, 13 Nov 2013 20:20:03 -0500 Subject: [PATCH 04/33] Add debug pragmas to Cartesian2. --- Source/Core/Cartesian2.js | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/Source/Core/Cartesian2.js b/Source/Core/Cartesian2.js index a0776e8cbfbe..b07a3a131e39 100644 --- a/Source/Core/Cartesian2.js +++ b/Source/Core/Cartesian2.js @@ -125,6 +125,7 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian2.pack = function(value, array, startingIndex) { + //>>excludeStart('debug', pragmas.debug); if (!defined(value)) { throw new DeveloperError('value is required'); } @@ -132,6 +133,7 @@ define([ if (!defined(array)) { throw new DeveloperError('array is required'); } + //>>excludeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); @@ -150,9 +152,11 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian2.unpack = function(array, startingIndex, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(array)) { throw new DeveloperError('array is required'); } + //>>excludeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); @@ -197,9 +201,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.getMaximumComponent = function(cartesian) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + return Math.max(cartesian.x, cartesian.y); }; @@ -213,9 +220,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.getMinimumComponent = function(cartesian) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + return Math.min(cartesian.x, cartesian.y); }; @@ -229,9 +239,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.magnitudeSquared = function(cartesian) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + return cartesian.x * cartesian.x + cartesian.y * cartesian.y; }; @@ -266,9 +279,11 @@ define([ * var d = Cartesian2.distance(new Cartesian2(1.0, 0.0), new Cartesian2(2.0, 0.0)); */ Cartesian2.distance = function(left, right) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left) || !defined(right)) { throw new DeveloperError('left and right are required.'); } + //>>excludeEnd('debug'); Cartesian2.subtract(left, right, distanceScratch); return Cartesian2.magnitude(distanceScratch); @@ -285,9 +300,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.normalize = function(cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + var magnitude = Cartesian2.magnitude(cartesian); if (!defined(result)) { return new Cartesian2(cartesian.x / magnitude, cartesian.y / magnitude); @@ -309,12 +327,15 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian2.dot = function(left, right) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + return left.x * right.x + left.y * right.y; }; @@ -331,12 +352,15 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian2.multiplyComponents = function(left, right, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian2(left.x * right.x, left.y * right.y); } @@ -358,12 +382,15 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian2.add = function(left, right, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian2(left.x + right.x, left.y + right.y); } @@ -385,12 +412,15 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian2.subtract = function(left, right, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian2(left.x - right.x, left.y - right.y); } @@ -412,12 +442,15 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian2.multiplyByScalar = function(cartesian, scalar, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian2(cartesian.x * scalar, cartesian.y * scalar); } @@ -439,12 +472,15 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian2.divideByScalar = function(cartesian, scalar, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian2(cartesian.x / scalar, cartesian.y / scalar); } @@ -464,9 +500,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.negate = function(cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian2(-cartesian.x, -cartesian.y); } @@ -486,9 +525,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.abs = function(cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian2(Math.abs(cartesian.x), Math.abs(cartesian.y)); } @@ -513,6 +555,7 @@ define([ * @exception {DeveloperError} t is required and must be a number. */ Cartesian2.lerp = function(start, end, t, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(start)) { throw new DeveloperError('start is required.'); } @@ -522,6 +565,8 @@ define([ if (typeof t !== 'number') { throw new DeveloperError('t is required and must be a number.'); } + //>>excludeEnd('debug'); + Cartesian2.multiplyByScalar(end, t, lerpScratch); result = Cartesian2.multiplyByScalar(start, 1.0 - t, result); return Cartesian2.add(lerpScratch, result, result); @@ -541,12 +586,15 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian2.angleBetween = function(left, right) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + Cartesian2.normalize(left, angleBetweenScratch); Cartesian2.normalize(right, angleBetweenScratch2); return Math.acos(Cartesian2.dot(angleBetweenScratch, angleBetweenScratch2)); @@ -564,9 +612,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.mostOrthogonalAxis = function(cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required.'); } + //>>excludeEnd('debug'); var f = Cartesian2.normalize(cartesian, mostOrthogonalAxisScratch); Cartesian2.abs(f, f); @@ -611,9 +661,12 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Cartesian2.equalsEpsilon = function(left, right, epsilon) { + //>>excludeStart('debug', pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number.'); } + //>>excludeEnd('debug'); + return (left === right) || ((defined(left)) && (defined(right)) && From 3b5541cee1e7d51b44bd1819582e17f762cb1b82 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Wed, 13 Nov 2013 20:26:32 -0500 Subject: [PATCH 05/33] Add debug pragmas to Cartesian3. --- Source/Core/Cartesian3.js | 58 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/Source/Core/Cartesian3.js b/Source/Core/Cartesian3.js index ca201442d95e..a76a07dc2d23 100644 --- a/Source/Core/Cartesian3.js +++ b/Source/Core/Cartesian3.js @@ -58,9 +58,12 @@ define([ * @exception {DeveloperError} spherical is required. */ Cartesian3.fromSpherical = function(spherical, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(spherical)) { throw new DeveloperError('spherical is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { result = new Cartesian3(); } @@ -149,6 +152,7 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian3.pack = function(value, array, startingIndex) { + //>>excludeStart('debug', pragmas.debug); if (!defined(value)) { throw new DeveloperError('value is required'); } @@ -156,6 +160,7 @@ define([ if (!defined(array)) { throw new DeveloperError('array is required'); } + //>>excludeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); @@ -175,9 +180,11 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian3.unpack = function(array, startingIndex, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(array)) { throw new DeveloperError('array is required'); } + //>>excludeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); @@ -223,9 +230,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.getMaximumComponent = function(cartesian) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + return Math.max(cartesian.x, cartesian.y, cartesian.z); }; @@ -239,9 +249,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.getMinimumComponent = function(cartesian) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + return Math.min(cartesian.x, cartesian.y, cartesian.z); }; @@ -255,9 +268,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.magnitudeSquared = function(cartesian) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + return cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z; }; @@ -292,9 +308,11 @@ define([ * var d = Cartesian3.distance(new Cartesian3(1.0, 0.0, 0.0), new Cartesian3(2.0, 0.0, 0.0)); */ Cartesian3.distance = function(left, right) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left) || !defined(right)) { throw new DeveloperError('left and right are required.'); } + //>>excludeEnd('debug'); Cartesian3.subtract(left, right, distanceScratch); return Cartesian3.magnitude(distanceScratch); @@ -311,9 +329,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.normalize = function(cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + var magnitude = Cartesian3.magnitude(cartesian); if (!defined(result)) { return new Cartesian3(cartesian.x / magnitude, cartesian.y / magnitude, cartesian.z / magnitude); @@ -336,12 +357,15 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.dot = function(left, right) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + return left.x * right.x + left.y * right.y + left.z * right.z; }; @@ -358,12 +382,15 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.multiplyComponents = function(left, right, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian3(left.x * right.x, left.y * right.y, left.z * right.z); } @@ -386,12 +413,15 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.add = function(left, right, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian3(left.x + right.x, left.y + right.y, left.z + right.z); } @@ -414,12 +444,15 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.subtract = function(left, right, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian3(left.x - right.x, left.y - right.y, left.z - right.z); } @@ -442,12 +475,15 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian3.multiplyByScalar = function(cartesian, scalar, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian3(cartesian.x * scalar, cartesian.y * scalar, cartesian.z * scalar); } @@ -470,12 +506,15 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian3.divideByScalar = function(cartesian, scalar, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian3(cartesian.x / scalar, cartesian.y / scalar, cartesian.z / scalar); } @@ -496,9 +535,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.negate = function(cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian3(-cartesian.x, -cartesian.y, -cartesian.z); } @@ -519,9 +561,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.abs = function(cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian3(Math.abs(cartesian.x), Math.abs(cartesian.y), Math.abs(cartesian.z)); } @@ -547,6 +592,7 @@ define([ * @exception {DeveloperError} t is required and must be a number. */ Cartesian3.lerp = function(start, end, t, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(start)) { throw new DeveloperError('start is required.'); } @@ -556,6 +602,8 @@ define([ if (typeof t !== 'number') { throw new DeveloperError('t is required and must be a number.'); } + //>>excludeEnd('debug'); + Cartesian3.multiplyByScalar(end, t, lerpScratch); result = Cartesian3.multiplyByScalar(start, 1.0 - t, result); return Cartesian3.add(lerpScratch, result, result); @@ -575,12 +623,15 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.angleBetween = function(left, right) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + Cartesian3.normalize(left, angleBetweenScratch); Cartesian3.normalize(right, angleBetweenScratch2); var cosine = Cartesian3.dot(angleBetweenScratch, angleBetweenScratch2); @@ -600,9 +651,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.mostOrthogonalAxis = function(cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required.'); } + //>>excludeEnd('debug'); var f = Cartesian3.normalize(cartesian, mostOrthogonalAxisScratch); Cartesian3.abs(f, f); @@ -656,9 +709,12 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Cartesian3.equalsEpsilon = function(left, right, epsilon) { + //>>excludeStart('debug', pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number.'); } + //>>excludeEnd('debug'); + return (left === right) || ((defined(left)) && (defined(right)) && @@ -680,12 +736,14 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.cross = function(left, right, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); var leftX = left.x; var leftY = left.y; From 4ddfa65bc38f0629dab4943c151b144f7e41d4af Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 14 Nov 2013 15:09:19 -0500 Subject: [PATCH 06/33] Add debug pragmas to the remaining cartesian types, the matrix types and Quaternion. --- Source/Core/Cartesian4.js | 50 ++++++++++++++++++++++++++ Source/Core/Matrix2.js | 41 +++++++++++++++++++++ Source/Core/Matrix3.js | 50 ++++++++++++++++++++++++++ Source/Core/Matrix4.js | 75 +++++++++++++++++++++++++++++++++++++++ Source/Core/Quaternion.js | 58 ++++++++++++++++++++++++++++-- 5 files changed, 271 insertions(+), 3 deletions(-) diff --git a/Source/Core/Cartesian4.js b/Source/Core/Cartesian4.js index f951baa05089..7ed8057f50a6 100644 --- a/Source/Core/Cartesian4.js +++ b/Source/Core/Cartesian4.js @@ -121,6 +121,7 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian4.pack = function(value, array, startingIndex) { + //>>excludeStart('debug', pragmas.debug); if (!defined(value)) { throw new DeveloperError('value is required'); } @@ -128,6 +129,7 @@ define([ if (!defined(array)) { throw new DeveloperError('array is required'); } + //>>excludeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); @@ -148,9 +150,11 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian4.unpack = function(array, startingIndex, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(array)) { throw new DeveloperError('array is required'); } + //>>excludeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); @@ -199,9 +203,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.getMaximumComponent = function(cartesian) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + return Math.max(cartesian.x, cartesian.y, cartesian.z, cartesian.w); }; @@ -215,9 +222,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.getMinimumComponent = function(cartesian) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + return Math.min(cartesian.x, cartesian.y, cartesian.z, cartesian.w); }; @@ -231,9 +241,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.magnitudeSquared = function(cartesian) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + return cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z + cartesian.w * cartesian.w; }; @@ -268,9 +281,11 @@ define([ * var d = Cartesian4.distance(new Cartesian4(1.0, 0.0, 0.0, 0.0), new Cartesian4(2.0, 0.0, 0.0, 0.0)); */ Cartesian4.distance = function(left, right) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left) || !defined(right)) { throw new DeveloperError('left and right are required.'); } + //>>excludeEnd('debug'); Cartesian4.subtract(left, right, distanceScratch); return Cartesian4.magnitude(distanceScratch); @@ -287,9 +302,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.normalize = function(cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + var magnitude = Cartesian4.magnitude(cartesian); if (!defined(result)) { return new Cartesian4(cartesian.x / magnitude, cartesian.y / magnitude, cartesian.z / magnitude, cartesian.w / magnitude); @@ -313,12 +331,15 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian4.dot = function(left, right) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w; }; @@ -335,12 +356,15 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian4.multiplyComponents = function(left, right, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian4(left.x * right.x, left.y * right.y, left.z * right.z, left.w * right.w); } @@ -364,12 +388,15 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian4.add = function(left, right, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian4(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w); } @@ -393,12 +420,15 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian4.subtract = function(left, right, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian4(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w); } @@ -422,12 +452,15 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian4.multiplyByScalar = function(cartesian, scalar, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian4(cartesian.x * scalar, cartesian.y * scalar, cartesian.z * scalar, cartesian.w * scalar); } @@ -451,12 +484,15 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian4.divideByScalar = function(cartesian, scalar, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian4(cartesian.x / scalar, cartesian.y / scalar, cartesian.z / scalar, cartesian.w / scalar); } @@ -478,9 +514,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.negate = function(cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian4(-cartesian.x, -cartesian.y, -cartesian.z, -cartesian.w); } @@ -502,9 +541,12 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.abs = function(cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian4(Math.abs(cartesian.x), Math.abs(cartesian.y), Math.abs(cartesian.z), Math.abs(cartesian.w)); } @@ -531,6 +573,7 @@ define([ * @exception {DeveloperError} t is required and must be a number. */ Cartesian4.lerp = function(start, end, t, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(start)) { throw new DeveloperError('start is required.'); } @@ -540,6 +583,8 @@ define([ if (typeof t !== 'number') { throw new DeveloperError('t is required and must be a number.'); } + //>>excludeEnd('debug'); + Cartesian4.multiplyByScalar(end, t, lerpScratch); result = Cartesian4.multiplyByScalar(start, 1.0 - t, result); return Cartesian4.add(lerpScratch, result, result); @@ -557,9 +602,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.mostOrthogonalAxis = function(cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required.'); } + //>>excludeEnd('debug'); var f = Cartesian4.normalize(cartesian, mostOrthogonalAxisScratch); Cartesian4.abs(f, f); @@ -624,9 +671,12 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Cartesian4.equalsEpsilon = function(left, right, epsilon) { + //>>excludeStart('debug', pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number.'); } + //>>excludeEnd('debug'); + return (left === right) || ((defined(left)) && (defined(right)) && diff --git a/Source/Core/Matrix2.js b/Source/Core/Matrix2.js index 4f088e574c31..c442a10d8d11 100644 --- a/Source/Core/Matrix2.js +++ b/Source/Core/Matrix2.js @@ -73,9 +73,12 @@ define([ * @exception {DeveloperError} values is required. */ Matrix2.fromColumnMajorArray = function(values, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(values)) { throw new DeveloperError('values parameter is required'); } + //>>excludeEnd('debug'); + return Matrix2.clone(values, result); }; @@ -91,9 +94,12 @@ define([ * @exception {DeveloperError} values is required. */ Matrix2.fromRowMajorArray = function(values, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(values)) { throw new DeveloperError('values is required.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Matrix2(values[0], values[1], values[2], values[3]); @@ -122,9 +128,12 @@ define([ * var m = Matrix2.fromScale(new Cartesian2(7.0, 8.0)); */ Matrix2.fromScale = function(scale, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(scale)) { throw new DeveloperError('scale is required.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Matrix2( scale.x, 0.0, @@ -155,9 +164,12 @@ define([ * var m = Matrix2.fromUniformScale(2.0); */ Matrix2.fromUniformScale = function(scale, result) { + //>>excludeStart('debug', pragmas.debug); if (typeof scale !== 'number') { throw new DeveloperError('scale is required.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Matrix2( scale, 0.0, @@ -188,9 +200,11 @@ define([ * var rotated = Matrix2.multiplyByVector(m, p); */ Matrix2.fromRotation = function(angle, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(angle)) { throw new DeveloperError('angle is required.'); } + //>>excludeEnd('debug'); var cosAngle = Math.cos(angle); var sinAngle = Math.sin(angle); @@ -219,9 +233,12 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix2.toArray = function(matrix, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return [matrix[0], matrix[1], matrix[2], matrix[3]]; } @@ -250,12 +267,15 @@ define([ * myMatrix[column1Row0Index] = 10.0; */ Matrix2.getElementIndex = function(column, row) { + //>>excludeStart('debug', pragmas.debug); if (typeof row !== 'number' || row < 0 || row > 1) { throw new DeveloperError('row is required and must be 0 or 1.'); } if (typeof column !== 'number' || column < 0 || column > 1) { throw new DeveloperError('column is required and must be 0 or 1.'); } + //>>excludeEnd('debug'); + return column * 2 + row; }; @@ -274,6 +294,7 @@ define([ * @see Cartesian2 */ Matrix2.getColumn = function(matrix, index, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -281,6 +302,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 1) { throw new DeveloperError('index is required and must be 0 or 1.'); } + //>>excludeEnd('debug'); var startIndex = index * 2; var x = matrix[startIndex]; @@ -311,6 +333,7 @@ define([ * @see Cartesian2 */ Matrix2.setColumn = function(matrix, index, cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -320,6 +343,8 @@ define([ if (typeof index !== 'number' || index < 0 || index > 1) { throw new DeveloperError('index is required and must be 0 or 1.'); } + //>>excludeEnd('debug'); + result = Matrix2.clone(matrix, result); var startIndex = index * 2; result[startIndex] = cartesian.x; @@ -342,6 +367,7 @@ define([ * @see Cartesian2 */ Matrix2.getRow = function(matrix, index, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -349,6 +375,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 1) { throw new DeveloperError('index is required and must be 0 or 1.'); } + //>>excludeEnd('debug'); var x = matrix[index]; var y = matrix[index + 2]; @@ -378,6 +405,7 @@ define([ * @see Cartesian2 */ Matrix2.setRow = function(matrix, index, cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -387,6 +415,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 1) { throw new DeveloperError('index is required and must be 0 or 1.'); } + //>>excludeEnd('debug'); result = Matrix2.clone(matrix, result); result[index] = cartesian.x; @@ -407,12 +436,14 @@ define([ * @exception {DeveloperError} right is required. */ Matrix2.multiply = function(left, right, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); var column0Row0 = left[0] * right[0] + left[2] * right[1]; var column1Row0 = left[0] * right[2] + left[2] * right[3]; @@ -443,12 +474,14 @@ define([ * @exception {DeveloperError} cartesian is required. */ Matrix2.multiplyByVector = function(matrix, cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); var x = matrix[0] * cartesian.x + matrix[2] * cartesian.y; var y = matrix[1] * cartesian.x + matrix[3] * cartesian.y; @@ -474,12 +507,14 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Matrix2.multiplyByScalar = function(matrix, scalar, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number'); } + //>>excludeEnd('debug'); if (!defined(result)) { return new Matrix2(matrix[0] * scalar, matrix[2] * scalar, @@ -503,9 +538,11 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix2.negate = function(matrix, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } + //>>excludeEnd('debug'); if (!defined(result)) { return new Matrix2(-matrix[0], -matrix[2], @@ -529,9 +566,11 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix2.transpose = function(matrix, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } + //excludeEnd('debug'); var column0Row0 = matrix[0]; var column0Row1 = matrix[2]; @@ -582,9 +621,11 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Matrix2.equalsEpsilon = function(left, right, epsilon) { + //>>excludeStart('debug', pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number'); } + //>>excludeEnd('debug'); return (left === right) || (defined(left) && diff --git a/Source/Core/Matrix3.js b/Source/Core/Matrix3.js index f750708cef72..a33108282e78 100644 --- a/Source/Core/Matrix3.js +++ b/Source/Core/Matrix3.js @@ -94,9 +94,12 @@ define([ * @exception {DeveloperError} values is required. */ Matrix3.fromColumnMajorArray = function(values, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(values)) { throw new DeveloperError('values parameter is required'); } + //>>excludeEnd('debug'); + return Matrix3.clone(values, result); }; @@ -112,9 +115,12 @@ define([ * @exception {DeveloperError} values is required. */ Matrix3.fromRowMajorArray = function(values, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(values)) { throw new DeveloperError('values is required.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Matrix3(values[0], values[1], values[2], values[3], values[4], values[5], @@ -141,9 +147,12 @@ define([ * @returns {Matrix3} The 3x3 rotation matrix from this quaternion. */ Matrix3.fromQuaternion = function(quaternion, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } + //>>excludeEnd('debug'); + var x2 = quaternion.x * quaternion.x; var xy = quaternion.x * quaternion.y; var xz = quaternion.x * quaternion.z; @@ -202,9 +211,12 @@ define([ * var m = Matrix3.fromScale(new Cartesian3(7.0, 8.0, 9.0)); */ Matrix3.fromScale = function(scale, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(scale)) { throw new DeveloperError('scale is required.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Matrix3( scale.x, 0.0, 0.0, @@ -242,9 +254,12 @@ define([ * var m = Matrix3.fromUniformScale(2.0); */ Matrix3.fromUniformScale = function(scale, result) { + //>>excludeStart('debug', pragmas.debug); if (typeof scale !== 'number') { throw new DeveloperError('scale is required.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Matrix3( scale, 0.0, 0.0, @@ -281,9 +296,11 @@ define([ * var rotated = Matrix3.multiplyByVector(m, p); */ Matrix3.fromRotationX = function(angle, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(angle)) { throw new DeveloperError('angle is required.'); } + //>>excludeEnd('debug'); var cosAngle = Math.cos(angle); var sinAngle = Math.sin(angle); @@ -325,9 +342,11 @@ define([ * var rotated = Matrix3.multiplyByVector(m, p); */ Matrix3.fromRotationY = function(angle, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(angle)) { throw new DeveloperError('angle is required.'); } + //>>excludeEnd('debug'); var cosAngle = Math.cos(angle); var sinAngle = Math.sin(angle); @@ -369,9 +388,11 @@ define([ * var rotated = Matrix3.multiplyByVector(m, p); */ Matrix3.fromRotationZ = function(angle, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(angle)) { throw new DeveloperError('angle is required.'); } + //>>excludeEnd('debug'); var cosAngle = Math.cos(angle); var sinAngle = Math.sin(angle); @@ -408,9 +429,12 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix3.toArray = function(matrix, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return [matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], matrix[6], matrix[7], matrix[8]]; } @@ -444,12 +468,15 @@ define([ * myMatrix[column1Row0Index] = 10.0; */ Matrix3.getElementIndex = function(column, row) { + //>>excludeStart('debug', pragmas.debug); if (typeof row !== 'number' || row < 0 || row > 2) { throw new DeveloperError('row is required and must be 0, 1, or 2.'); } if (typeof column !== 'number' || column < 0 || column > 2) { throw new DeveloperError('column is required and must be 0, 1, or 2.'); } + //>>excludeEnd('debug'); + return column * 3 + row; }; @@ -468,6 +495,7 @@ define([ * @see Cartesian3 */ Matrix3.getColumn = function(matrix, index, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -475,6 +503,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 2) { throw new DeveloperError('index is required and must be 0, 1, or 2.'); } + //>>excludeEnd('debug'); var startIndex = index * 3; var x = matrix[startIndex]; @@ -507,6 +536,7 @@ define([ * @see Cartesian3 */ Matrix3.setColumn = function(matrix, index, cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -516,6 +546,8 @@ define([ if (typeof index !== 'number' || index < 0 || index > 2) { throw new DeveloperError('index is required and must be 0, 1, or 2.'); } + //>>excludeEnd('debug'); + result = Matrix3.clone(matrix, result); var startIndex = index * 3; result[startIndex] = cartesian.x; @@ -539,6 +571,7 @@ define([ * @see Cartesian3 */ Matrix3.getRow = function(matrix, index, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -546,6 +579,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 2) { throw new DeveloperError('index is required and must be 0, 1, or 2.'); } + //>>excludeEnd('debug'); var x = matrix[index]; var y = matrix[index + 3]; @@ -577,6 +611,7 @@ define([ * @see Cartesian3 */ Matrix3.setRow = function(matrix, index, cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -586,6 +621,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 2) { throw new DeveloperError('index is required and must be 0, 1, or 2.'); } + //>>excludeEnd('debug'); result = Matrix3.clone(matrix, result); result[index] = cartesian.x; @@ -607,12 +643,14 @@ define([ * @exception {DeveloperError} right is required. */ Matrix3.multiply = function(left, right, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); var column0Row0 = left[0] * right[0] + left[3] * right[1] + left[6] * right[2]; var column0Row1 = left[1] * right[0] + left[4] * right[1] + left[7] * right[2]; @@ -656,12 +694,14 @@ define([ * @exception {DeveloperError} cartesian is required. */ Matrix3.multiplyByVector = function(matrix, cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); var vX = cartesian.x; var vY = cartesian.y; @@ -693,12 +733,14 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Matrix3.multiplyByScalar = function(matrix, scalar, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number'); } + //>>excludeEnd('debug'); if (!defined(result)) { return new Matrix3(matrix[0] * scalar, matrix[3] * scalar, matrix[6] * scalar, @@ -728,9 +770,11 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix3.negate = function(matrix, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } + //>>excludeEnd('debug'); if (!defined(result)) { return new Matrix3(-matrix[0], -matrix[3], -matrix[6], @@ -760,9 +804,11 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix3.transpose = function(matrix, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } + //>>excludeEnd('debug'); var column0Row0 = matrix[0]; var column0Row1 = matrix[3]; @@ -908,9 +954,11 @@ define([ * var c = Cartesian3.multiplyByScalar(v, lambda); // equal to Matrix3.multiplyByVector(a, v) */ Matrix3.getEigenDecomposition = function(matrix, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } + //>>excludeEnd('debug'); // This routine was created based upon Matrix Computations, 3rd ed., by Golub and Van Loan, // section 8.4.3 The Classical Jacobi Algorithm @@ -1050,9 +1098,11 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Matrix3.equalsEpsilon = function(left, right, epsilon) { + //>>excludeStart('debug', pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number'); } + //>>excludeEnd('debug'); return (left === right) || (defined(left) && diff --git a/Source/Core/Matrix4.js b/Source/Core/Matrix4.js index 8a0e14747cff..e22a7a56b95c 100644 --- a/Source/Core/Matrix4.js +++ b/Source/Core/Matrix4.js @@ -131,9 +131,12 @@ define([ * @exception {DeveloperError} values is required. */ Matrix4.fromColumnMajorArray = function(values, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(values)) { throw new DeveloperError('values parameter is required'); } + //>>excludeEnd('debug'); + return Matrix4.clone(values, result); }; @@ -149,9 +152,12 @@ define([ * @exception {DeveloperError} values is required. */ Matrix4.fromRowMajorArray = function(values, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(values)) { throw new DeveloperError('values is required.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Matrix4(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], @@ -191,12 +197,15 @@ define([ * @exception {DeveloperError} translation is required. */ Matrix4.fromRotationTranslation = function(rotation, translation, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(rotation)) { throw new DeveloperError('rotation is required.'); } if (!defined(translation)) { throw new DeveloperError('translation is required.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Matrix4(rotation[0], rotation[3], rotation[6], translation.x, rotation[1], rotation[4], rotation[7], translation.y, @@ -249,6 +258,7 @@ define([ * result); */ Matrix4.fromTranslationQuaternionRotationScale = function(translation, rotation, scale, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(translation)) { throw new DeveloperError('translation is required.'); } @@ -258,6 +268,7 @@ define([ if (!defined(scale)) { throw new DeveloperError('scale is required.'); } + //>>excludeEnd('debug'); if (!defined(result)) { result = new Matrix4(); @@ -345,9 +356,12 @@ define([ * var m = Matrix4.fromScale(new Cartesian3(7.0, 8.0, 9.0)); */ Matrix4.fromScale = function(scale, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(scale)) { throw new DeveloperError('scale is required.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Matrix4( scale.x, 0.0, 0.0, 0.0, @@ -394,9 +408,12 @@ define([ * var m = Matrix4.fromScale(2.0); */ Matrix4.fromUniformScale = function(scale, result) { + //>>excludeStart('debug', pragmas.debug); if (typeof scale !== 'number') { throw new DeveloperError('scale is required.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Matrix4(scale, 0.0, 0.0, 0.0, 0.0, scale, 0.0, 0.0, @@ -441,14 +458,17 @@ define([ * @exception {DeveloperError} camera.up is required. */ Matrix4.fromCamera = function(camera, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(camera)) { throw new DeveloperError('camera is required.'); } + //>>excludeEnd('debug'); var eye = camera.eye; var target = camera.target; var up = camera.up; + //>>excludeStart('debug', pragmas.debug); if (!defined(eye)) { throw new DeveloperError('camera.eye is required.'); } @@ -458,6 +478,7 @@ define([ if (!defined(up)) { throw new DeveloperError('camera.up is required.'); } + //>>excludeEnd('debug'); Cartesian3.normalize(Cartesian3.subtract(target, eye, fromCameraF), fromCameraF); Cartesian3.normalize(Cartesian3.cross(fromCameraF, up, fromCameraS), fromCameraS); @@ -538,6 +559,7 @@ define([ * @exception {DeveloperError} far must be greater than zero. */ Matrix4.computePerspectiveFieldOfView = function(fovY, aspectRatio, near, far, result) { + //>>excludeStart('debug', pragmas.debug); if (fovY <= 0.0 || fovY > Math.PI) { throw new DeveloperError('fovY must be in [0, PI).'); } @@ -553,6 +575,7 @@ define([ if (far <= 0.0) { throw new DeveloperError('far must be greater than zero.'); } + //>>excludeEnd('debug'); var bottom = Math.tan(fovY * 0.5); @@ -608,6 +631,7 @@ define([ * @exception {DeveloperError} far is required. */ Matrix4.computeOrthographicOffCenter = function(left, right, bottom, top, near, far, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required.'); } @@ -626,6 +650,7 @@ define([ if (!defined(far)) { throw new DeveloperError('far is required.'); } + //>>excludeEnd('debug'); var a = 1.0 / (right - left); var b = 1.0 / (top - bottom); @@ -685,6 +710,7 @@ define([ * @exception {DeveloperError} far is required. */ Matrix4.computePerspectiveOffCenter = function(left, right, bottom, top, near, far, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required.'); } @@ -703,6 +729,7 @@ define([ if (!defined(far)) { throw new DeveloperError('far is required.'); } + //>>excludeEnd('debug'); var column0Row0 = 2.0 * near / (right - left); var column1Row1 = 2.0 * near / (top - bottom); @@ -758,6 +785,7 @@ define([ * @exception {DeveloperError} near is required. */ Matrix4.computeInfinitePerspectiveOffCenter = function(left, right, bottom, top, near, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required.'); } @@ -773,6 +801,7 @@ define([ if (!defined(near)) { throw new DeveloperError('near is required.'); } + //>>excludeEnd('debug'); var column0Row0 = 2.0 * near / (right - left); var column1Row1 = 2.0 * near / (top - bottom); @@ -903,9 +932,12 @@ define([ * */ Matrix4.toArray = function(matrix, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return [matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], matrix[6], matrix[7], @@ -949,12 +981,15 @@ define([ * myMatrix[column1Row0Index] = 10.0; */ Matrix4.getElementIndex = function(column, row) { + //>>excludeStart('debug', pragmas.debug); if (typeof row !== 'number' || row < 0 || row > 3) { throw new DeveloperError('row is required and must be 0, 1, 2, or 3.'); } if (typeof column !== 'number' || column < 0 || column > 3) { throw new DeveloperError('column is required and must be 0, 1, 2, or 3.'); } + //>>excludeEnd('debug'); + return column * 4 + row; }; @@ -990,6 +1025,7 @@ define([ * */ Matrix4.getColumn = function(matrix, index, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -997,6 +1033,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 3) { throw new DeveloperError('index is required and must be 0, 1, 2, or 3.'); } + //>>excludeEnd('debug'); var startIndex = index * 4; var x = matrix[startIndex]; @@ -1047,6 +1084,7 @@ define([ * */ Matrix4.setColumn = function(matrix, index, cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -1056,6 +1094,8 @@ define([ if (typeof index !== 'number' || index < 0 || index > 3) { throw new DeveloperError('index is required and must be 0, 1, 2, or 3.'); } + //>>excludeEnd('debug'); + result = Matrix4.clone(matrix, result); var startIndex = index * 4; result[startIndex] = cartesian.x; @@ -1096,6 +1136,7 @@ define([ * // a.x = 18.0; a.y = 19.0; a.z = 20.0; a.w = 21.0; */ Matrix4.getRow = function(matrix, index, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -1103,6 +1144,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 3) { throw new DeveloperError('index is required and must be 0, 1, 2, or 3.'); } + //>>excludeEnd('debug'); var x = matrix[index]; var y = matrix[index + 4]; @@ -1152,6 +1194,7 @@ define([ * */ Matrix4.setRow = function(matrix, index, cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -1161,6 +1204,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 3) { throw new DeveloperError('index is required and must be 0, 1, 2, or 3.'); } + //>>excludeEnd('debug'); result = Matrix4.clone(matrix, result); result[index] = cartesian.x; @@ -1183,12 +1227,14 @@ define([ * @exception {DeveloperError} right is required. */ Matrix4.multiply = function(left, right, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); var left0 = left[0]; var left1 = left[1]; @@ -1292,12 +1338,14 @@ define([ * Matrix4.multiplyByTranslation(m, position, m); */ Matrix4.multiplyByTranslation = function(matrix, translation, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } if (!defined(translation)) { throw new DeveloperError('translation is required'); } + //>>excludeEnd('debug'); var x = translation.x; var y = translation.y; @@ -1359,9 +1407,11 @@ define([ * Matrix4.multiplyByUniformScale(m, scale, m); */ Matrix4.multiplyByUniformScale = function(matrix, scale, result) { + //>>excludeStart('debug', pragmas.debug); if (typeof scale !== 'number') { throw new DeveloperError('scale is required'); } + //>>excludeEnd('debug'); uniformScaleScratch.x = scale; uniformScaleScratch.y = scale; @@ -1393,12 +1443,14 @@ define([ * Matrix4.multiplyByUniformScale(m, scale, m); */ Matrix4.multiplyByScale = function(matrix, scale, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } if (!defined(scale)) { throw new DeveloperError('scale is required'); } + //>>excludeEnd('debug'); var scaleX = scale.x; var scaleY = scale.y; @@ -1449,12 +1501,14 @@ define([ * @exception {DeveloperError} cartesian is required. */ Matrix4.multiplyByVector = function(matrix, cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); var vX = cartesian.x; var vY = cartesian.y; @@ -1499,9 +1553,11 @@ define([ * // Matrix4.multiplyByVector(matrix, new Cartesian4(p.x, p.y, p.z, 1.0), result); */ Matrix4.multiplyByPoint = function(matrix, cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } + //>>excludeEnd('debug'); scratchPoint.x = cartesian.x; scratchPoint.y = cartesian.y; @@ -1540,12 +1596,14 @@ define([ * */ Matrix4.multiplyByScalar = function(matrix, scalar, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number'); } + //>>excludeEnd('debug'); if (!defined(result)) { return new Matrix4(matrix[0] * scalar, matrix[4] * scalar, matrix[8] * scalar, matrix[12] * scalar, @@ -1599,9 +1657,11 @@ define([ * */ Matrix4.negate = function(matrix, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } + //>>excludeEnd('debug'); if (!defined(result)) { return new Matrix4(-matrix[0], -matrix[4], -matrix[8], -matrix[12], @@ -1655,9 +1715,12 @@ define([ * */ Matrix4.transpose = function(matrix, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Matrix4(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], matrix[6], matrix[7], @@ -1780,9 +1843,11 @@ define([ * */ Matrix4.equalsEpsilon = function(left, right, epsilon) { + //>>excludeStart('debug', pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number'); } + //excludeEnd('debug'); return (left === right) || (defined(left) && @@ -1818,9 +1883,12 @@ define([ * @see Cartesian3 */ Matrix4.getTranslation = function(matrix, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Cartesian3(matrix[12], matrix[13], matrix[14]); } @@ -1859,9 +1927,12 @@ define([ * */ Matrix4.getRotation = function(matrix, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Matrix3(matrix[0], matrix[4], matrix[8], matrix[1], matrix[5], matrix[9], @@ -1894,9 +1965,11 @@ define([ * @exception {RuntimeError} matrix is not invertible because its determinate is zero. */ Matrix4.inverse = function(matrix, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } + //>>excludeEnd('debug'); // // Ported from: @@ -2019,9 +2092,11 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix4.inverseTransformation = function(matrix, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } + //>>excludeEnd('debug'); //This function is an optimized version of the below 4 lines. //var rT = Matrix3.transpose(Matrix4.getRotation(matrix)); diff --git a/Source/Core/Quaternion.js b/Source/Core/Quaternion.js index 46a995bfd2f7..df7147c684ac 100644 --- a/Source/Core/Quaternion.js +++ b/Source/Core/Quaternion.js @@ -74,12 +74,14 @@ define([ * @exception {DeveloperError} angle is required and must be a number. */ Quaternion.fromAxisAngle = function(axis, angle, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(axis)) { throw new DeveloperError('axis is required.'); } if (typeof angle !== 'number') { throw new DeveloperError('angle is required and must be a number.'); } + //>>excludeEnd('debug'); var halfAngle = angle / 2.0; var s = Math.sin(halfAngle); @@ -114,9 +116,11 @@ define([ * @see Matrix3.fromQuaternion */ Quaternion.fromRotationMatrix = function(matrix, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } + //>>excludeEnd('debug'); var root; var x; @@ -200,6 +204,7 @@ define([ * @exception {DeveloperError} array is required. */ Quaternion.pack = function(value, array, startingIndex) { + //>>excludeStart('debug', pragmas.debug); if (!defined(value)) { throw new DeveloperError('value is required'); } @@ -207,6 +212,7 @@ define([ if (!defined(array)) { throw new DeveloperError('array is required'); } + //>>excludeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); @@ -227,9 +233,11 @@ define([ * @exception {DeveloperError} array is required. */ Quaternion.unpack = function(array, startingIndex, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(array)) { throw new DeveloperError('array is required'); } + //>>excludeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); @@ -349,9 +357,12 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.conjugate = function(quaternion, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Quaternion(-quaternion.x, -quaternion.y, -quaternion.z, quaternion.w); } @@ -372,9 +383,12 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.magnitudeSquared = function(quaternion) { + //>>excludeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } + //>>excludeEnd('debug'); + return quaternion.x * quaternion.x + quaternion.y * quaternion.y + quaternion.z * quaternion.z + quaternion.w * quaternion.w; }; @@ -388,9 +402,6 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.magnitude = function(quaternion) { - if (!defined(quaternion)) { - throw new DeveloperError('quaternion is required'); - } return Math.sqrt(Quaternion.magnitudeSquared(quaternion)); }; @@ -450,12 +461,15 @@ define([ * @exception {DeveloperError} right is required. */ Quaternion.add = function(left, right, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Quaternion(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w); } @@ -479,12 +493,15 @@ define([ * @exception {DeveloperError} right is required. */ Quaternion.subtract = function(left, right, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Quaternion(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w); } @@ -506,9 +523,12 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.negate = function(quaternion, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Quaternion(-quaternion.x, -quaternion.y, -quaternion.z, -quaternion.w); } @@ -531,12 +551,15 @@ define([ * @exception {DeveloperError} right is required. */ Quaternion.dot = function(left, right) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w; }; @@ -554,12 +577,15 @@ define([ * @exception {DeveloperError} right is required. */ Quaternion.multiply = function(left, right, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } + //>>excludeEnd('debug'); + var leftX = left.x; var leftY = left.y; var leftZ = left.z; @@ -598,12 +624,15 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Quaternion.multiplyByScalar = function(quaternion, scalar, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Quaternion(quaternion.x * scalar, quaternion.y * scalar, quaternion.z * scalar, quaternion.w * scalar); } @@ -627,12 +656,15 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Quaternion.divideByScalar = function(quaternion, scalar, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } + //>>excludeEnd('debug'); + if (!defined(result)) { return new Quaternion(quaternion.x / scalar, quaternion.y / scalar, quaternion.z / scalar, quaternion.w / scalar); } @@ -654,9 +686,11 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.getAxis = function(quaternion, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } + //>>excludeEnd('debug'); var w = quaternion.w; if (Math.abs(w - 1.0) < CesiumMath.EPSILON6) { @@ -687,9 +721,11 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.getAngle = function(quaternion) { + //>>excludeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } + //>>excludeEnd('debug'); if (Math.abs(quaternion.w - 1.0) < CesiumMath.EPSILON6) { return 0.0; @@ -713,6 +749,7 @@ define([ * @exception {DeveloperError} t is required and must be a number. */ Quaternion.lerp = function(start, end, t, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(start)) { throw new DeveloperError('start is required.'); } @@ -722,6 +759,8 @@ define([ if (typeof t !== 'number') { throw new DeveloperError('t is required and must be a number.'); } + //>>excludeEnd('debug'); + lerpScratch = Quaternion.multiplyByScalar(end, t, lerpScratch); result = Quaternion.multiplyByScalar(start, 1.0 - t, result); return Quaternion.add(lerpScratch, result, result); @@ -745,6 +784,7 @@ define([ * @exception {DeveloperError} t is required and must be a number. */ Quaternion.slerp = function(start, end, t, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(start)) { throw new DeveloperError('start is required.'); } @@ -754,6 +794,7 @@ define([ if (typeof t !== 'number') { throw new DeveloperError('t is required and must be a number.'); } + //>>excludeEnd('debug'); var dot = Quaternion.dot(start, end); @@ -789,9 +830,11 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.log = function(quaternion, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required.'); } + //>>excludeEnd('debug'); var theta = Math.acos(CesiumMath.clamp(quaternion.w, -1.0, 1.0)); var thetaOverSinTheta = 0.0; @@ -820,9 +863,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Quaternion.exp = function(cartesian, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required.'); } + //>>excludeEnd('debug'); var theta = Cartesian3.magnitude(cartesian); var sinThetaOverTheta = 0.0; @@ -864,9 +909,11 @@ define([ * @see Quaternion#squad */ Quaternion.innerQuadrangle = function(q0, q1, q2, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(q0) || !defined(q1) || !defined(q2)) { throw new DeveloperError('q0, q1, and q2 are required.'); } + //>>excludeEnd('debug'); var qInv = Quaternion.conjugate(q1, squadScratchQuaternion0); Quaternion.multiply(qInv, q2, squadScratchQuaternion1); @@ -911,6 +958,7 @@ define([ * var q = Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t); */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { + //>>excludeStart('debug', pragmas.debug); if (!defined(q0) || !defined(q1) || !defined(s0) || !defined(s1)) { throw new DeveloperError('q0, q1, s0, and s1 are required.'); } @@ -918,6 +966,7 @@ define([ if (typeof t !== 'number') { throw new DeveloperError('t is required and must be a number.'); } + //>>excludeEnd('debug'); var slerp0 = Quaternion.slerp(q0, q1, t, squadScratchQuaternion0); var slerp1 = Quaternion.slerp(s0, s1, t, squadScratchQuaternion1); @@ -957,9 +1006,12 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Quaternion.equalsEpsilon = function(left, right, epsilon) { + //>>excludeStart('debug', pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number.'); } + //>>excludeEnd('debug'); + return (left === right) || ((defined(left)) && (defined(right)) && From 8dc579504d6b832c76aa2a449f34ffe980a2812f Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 14 Nov 2013 17:00:33 -0500 Subject: [PATCH 07/33] Exclude developer errors when debug build flag is false (not true. --- Source/Core/Cartesian2.js | 38 +++++++++++----------- Source/Core/Cartesian3.js | 42 ++++++++++++------------- Source/Core/Cartesian4.js | 36 ++++++++++----------- Source/Core/Matrix2.js | 34 ++++++++++---------- Source/Core/Matrix3.js | 42 ++++++++++++------------- Source/Core/Matrix4.js | 64 +++++++++++++++++++------------------- Source/Core/Quaternion.js | 44 +++++++++++++------------- Source/Renderer/Context.js | 36 ++++++++++----------- 8 files changed, 168 insertions(+), 168 deletions(-) diff --git a/Source/Core/Cartesian2.js b/Source/Core/Cartesian2.js index b07a3a131e39..d6eb837dedc6 100644 --- a/Source/Core/Cartesian2.js +++ b/Source/Core/Cartesian2.js @@ -125,7 +125,7 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian2.pack = function(value, array, startingIndex) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(value)) { throw new DeveloperError('value is required'); } @@ -152,7 +152,7 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian2.unpack = function(array, startingIndex, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(array)) { throw new DeveloperError('array is required'); } @@ -201,7 +201,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.getMaximumComponent = function(cartesian) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -220,7 +220,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.getMinimumComponent = function(cartesian) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -239,7 +239,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.magnitudeSquared = function(cartesian) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -279,7 +279,7 @@ define([ * var d = Cartesian2.distance(new Cartesian2(1.0, 0.0), new Cartesian2(2.0, 0.0)); */ Cartesian2.distance = function(left, right) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left) || !defined(right)) { throw new DeveloperError('left and right are required.'); } @@ -300,7 +300,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.normalize = function(cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -327,7 +327,7 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian2.dot = function(left, right) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -352,7 +352,7 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian2.multiplyComponents = function(left, right, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -382,7 +382,7 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian2.add = function(left, right, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -412,7 +412,7 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian2.subtract = function(left, right, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -442,7 +442,7 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian2.multiplyByScalar = function(cartesian, scalar, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -472,7 +472,7 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian2.divideByScalar = function(cartesian, scalar, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -500,7 +500,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.negate = function(cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -525,7 +525,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.abs = function(cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -555,7 +555,7 @@ define([ * @exception {DeveloperError} t is required and must be a number. */ Cartesian2.lerp = function(start, end, t, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(start)) { throw new DeveloperError('start is required.'); } @@ -586,7 +586,7 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian2.angleBetween = function(left, right) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -612,7 +612,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.mostOrthogonalAxis = function(cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required.'); } @@ -661,7 +661,7 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Cartesian2.equalsEpsilon = function(left, right, epsilon) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number.'); } diff --git a/Source/Core/Cartesian3.js b/Source/Core/Cartesian3.js index a76a07dc2d23..ca53f19190be 100644 --- a/Source/Core/Cartesian3.js +++ b/Source/Core/Cartesian3.js @@ -58,7 +58,7 @@ define([ * @exception {DeveloperError} spherical is required. */ Cartesian3.fromSpherical = function(spherical, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(spherical)) { throw new DeveloperError('spherical is required'); } @@ -152,7 +152,7 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian3.pack = function(value, array, startingIndex) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(value)) { throw new DeveloperError('value is required'); } @@ -180,7 +180,7 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian3.unpack = function(array, startingIndex, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(array)) { throw new DeveloperError('array is required'); } @@ -230,7 +230,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.getMaximumComponent = function(cartesian) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -249,7 +249,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.getMinimumComponent = function(cartesian) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -268,7 +268,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.magnitudeSquared = function(cartesian) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -308,7 +308,7 @@ define([ * var d = Cartesian3.distance(new Cartesian3(1.0, 0.0, 0.0), new Cartesian3(2.0, 0.0, 0.0)); */ Cartesian3.distance = function(left, right) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left) || !defined(right)) { throw new DeveloperError('left and right are required.'); } @@ -329,7 +329,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.normalize = function(cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -357,7 +357,7 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.dot = function(left, right) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -382,7 +382,7 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.multiplyComponents = function(left, right, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -413,7 +413,7 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.add = function(left, right, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -444,7 +444,7 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.subtract = function(left, right, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -475,7 +475,7 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian3.multiplyByScalar = function(cartesian, scalar, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -506,7 +506,7 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian3.divideByScalar = function(cartesian, scalar, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -535,7 +535,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.negate = function(cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -561,7 +561,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.abs = function(cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -592,7 +592,7 @@ define([ * @exception {DeveloperError} t is required and must be a number. */ Cartesian3.lerp = function(start, end, t, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(start)) { throw new DeveloperError('start is required.'); } @@ -623,7 +623,7 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.angleBetween = function(left, right) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -651,7 +651,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.mostOrthogonalAxis = function(cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required.'); } @@ -709,7 +709,7 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Cartesian3.equalsEpsilon = function(left, right, epsilon) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number.'); } @@ -736,7 +736,7 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.cross = function(left, right, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } diff --git a/Source/Core/Cartesian4.js b/Source/Core/Cartesian4.js index 7ed8057f50a6..94ac1c973eba 100644 --- a/Source/Core/Cartesian4.js +++ b/Source/Core/Cartesian4.js @@ -121,7 +121,7 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian4.pack = function(value, array, startingIndex) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(value)) { throw new DeveloperError('value is required'); } @@ -150,7 +150,7 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian4.unpack = function(array, startingIndex, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(array)) { throw new DeveloperError('array is required'); } @@ -203,7 +203,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.getMaximumComponent = function(cartesian) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -222,7 +222,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.getMinimumComponent = function(cartesian) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -241,7 +241,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.magnitudeSquared = function(cartesian) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -281,7 +281,7 @@ define([ * var d = Cartesian4.distance(new Cartesian4(1.0, 0.0, 0.0, 0.0), new Cartesian4(2.0, 0.0, 0.0, 0.0)); */ Cartesian4.distance = function(left, right) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left) || !defined(right)) { throw new DeveloperError('left and right are required.'); } @@ -302,7 +302,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.normalize = function(cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -331,7 +331,7 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian4.dot = function(left, right) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -356,7 +356,7 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian4.multiplyComponents = function(left, right, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -388,7 +388,7 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian4.add = function(left, right, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -420,7 +420,7 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian4.subtract = function(left, right, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -452,7 +452,7 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian4.multiplyByScalar = function(cartesian, scalar, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -484,7 +484,7 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian4.divideByScalar = function(cartesian, scalar, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -514,7 +514,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.negate = function(cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -541,7 +541,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.abs = function(cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -573,7 +573,7 @@ define([ * @exception {DeveloperError} t is required and must be a number. */ Cartesian4.lerp = function(start, end, t, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(start)) { throw new DeveloperError('start is required.'); } @@ -602,7 +602,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.mostOrthogonalAxis = function(cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required.'); } @@ -671,7 +671,7 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Cartesian4.equalsEpsilon = function(left, right, epsilon) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number.'); } diff --git a/Source/Core/Matrix2.js b/Source/Core/Matrix2.js index c442a10d8d11..ee56130d7374 100644 --- a/Source/Core/Matrix2.js +++ b/Source/Core/Matrix2.js @@ -73,7 +73,7 @@ define([ * @exception {DeveloperError} values is required. */ Matrix2.fromColumnMajorArray = function(values, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(values)) { throw new DeveloperError('values parameter is required'); } @@ -94,7 +94,7 @@ define([ * @exception {DeveloperError} values is required. */ Matrix2.fromRowMajorArray = function(values, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(values)) { throw new DeveloperError('values is required.'); } @@ -128,7 +128,7 @@ define([ * var m = Matrix2.fromScale(new Cartesian2(7.0, 8.0)); */ Matrix2.fromScale = function(scale, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(scale)) { throw new DeveloperError('scale is required.'); } @@ -164,7 +164,7 @@ define([ * var m = Matrix2.fromUniformScale(2.0); */ Matrix2.fromUniformScale = function(scale, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (typeof scale !== 'number') { throw new DeveloperError('scale is required.'); } @@ -200,7 +200,7 @@ define([ * var rotated = Matrix2.multiplyByVector(m, p); */ Matrix2.fromRotation = function(angle, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(angle)) { throw new DeveloperError('angle is required.'); } @@ -233,7 +233,7 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix2.toArray = function(matrix, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -267,7 +267,7 @@ define([ * myMatrix[column1Row0Index] = 10.0; */ Matrix2.getElementIndex = function(column, row) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (typeof row !== 'number' || row < 0 || row > 1) { throw new DeveloperError('row is required and must be 0 or 1.'); } @@ -294,7 +294,7 @@ define([ * @see Cartesian2 */ Matrix2.getColumn = function(matrix, index, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -333,7 +333,7 @@ define([ * @see Cartesian2 */ Matrix2.setColumn = function(matrix, index, cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -367,7 +367,7 @@ define([ * @see Cartesian2 */ Matrix2.getRow = function(matrix, index, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -405,7 +405,7 @@ define([ * @see Cartesian2 */ Matrix2.setRow = function(matrix, index, cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -436,7 +436,7 @@ define([ * @exception {DeveloperError} right is required. */ Matrix2.multiply = function(left, right, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -474,7 +474,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Matrix2.multiplyByVector = function(matrix, cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -507,7 +507,7 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Matrix2.multiplyByScalar = function(matrix, scalar, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -538,7 +538,7 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix2.negate = function(matrix, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -566,7 +566,7 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix2.transpose = function(matrix, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -621,7 +621,7 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Matrix2.equalsEpsilon = function(left, right, epsilon) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number'); } diff --git a/Source/Core/Matrix3.js b/Source/Core/Matrix3.js index a33108282e78..15b396c16f15 100644 --- a/Source/Core/Matrix3.js +++ b/Source/Core/Matrix3.js @@ -94,7 +94,7 @@ define([ * @exception {DeveloperError} values is required. */ Matrix3.fromColumnMajorArray = function(values, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(values)) { throw new DeveloperError('values parameter is required'); } @@ -115,7 +115,7 @@ define([ * @exception {DeveloperError} values is required. */ Matrix3.fromRowMajorArray = function(values, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(values)) { throw new DeveloperError('values is required.'); } @@ -147,7 +147,7 @@ define([ * @returns {Matrix3} The 3x3 rotation matrix from this quaternion. */ Matrix3.fromQuaternion = function(quaternion, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } @@ -211,7 +211,7 @@ define([ * var m = Matrix3.fromScale(new Cartesian3(7.0, 8.0, 9.0)); */ Matrix3.fromScale = function(scale, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(scale)) { throw new DeveloperError('scale is required.'); } @@ -254,7 +254,7 @@ define([ * var m = Matrix3.fromUniformScale(2.0); */ Matrix3.fromUniformScale = function(scale, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (typeof scale !== 'number') { throw new DeveloperError('scale is required.'); } @@ -296,7 +296,7 @@ define([ * var rotated = Matrix3.multiplyByVector(m, p); */ Matrix3.fromRotationX = function(angle, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(angle)) { throw new DeveloperError('angle is required.'); } @@ -342,7 +342,7 @@ define([ * var rotated = Matrix3.multiplyByVector(m, p); */ Matrix3.fromRotationY = function(angle, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(angle)) { throw new DeveloperError('angle is required.'); } @@ -388,7 +388,7 @@ define([ * var rotated = Matrix3.multiplyByVector(m, p); */ Matrix3.fromRotationZ = function(angle, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(angle)) { throw new DeveloperError('angle is required.'); } @@ -429,7 +429,7 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix3.toArray = function(matrix, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -468,7 +468,7 @@ define([ * myMatrix[column1Row0Index] = 10.0; */ Matrix3.getElementIndex = function(column, row) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (typeof row !== 'number' || row < 0 || row > 2) { throw new DeveloperError('row is required and must be 0, 1, or 2.'); } @@ -495,7 +495,7 @@ define([ * @see Cartesian3 */ Matrix3.getColumn = function(matrix, index, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -536,7 +536,7 @@ define([ * @see Cartesian3 */ Matrix3.setColumn = function(matrix, index, cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -571,7 +571,7 @@ define([ * @see Cartesian3 */ Matrix3.getRow = function(matrix, index, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -611,7 +611,7 @@ define([ * @see Cartesian3 */ Matrix3.setRow = function(matrix, index, cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -643,7 +643,7 @@ define([ * @exception {DeveloperError} right is required. */ Matrix3.multiply = function(left, right, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -694,7 +694,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Matrix3.multiplyByVector = function(matrix, cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -733,7 +733,7 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Matrix3.multiplyByScalar = function(matrix, scalar, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -770,7 +770,7 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix3.negate = function(matrix, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -804,7 +804,7 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix3.transpose = function(matrix, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -954,7 +954,7 @@ define([ * var c = Cartesian3.multiplyByScalar(v, lambda); // equal to Matrix3.multiplyByVector(a, v) */ Matrix3.getEigenDecomposition = function(matrix, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -1098,7 +1098,7 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Matrix3.equalsEpsilon = function(left, right, epsilon) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number'); } diff --git a/Source/Core/Matrix4.js b/Source/Core/Matrix4.js index e22a7a56b95c..a3e3513ad649 100644 --- a/Source/Core/Matrix4.js +++ b/Source/Core/Matrix4.js @@ -131,7 +131,7 @@ define([ * @exception {DeveloperError} values is required. */ Matrix4.fromColumnMajorArray = function(values, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(values)) { throw new DeveloperError('values parameter is required'); } @@ -152,7 +152,7 @@ define([ * @exception {DeveloperError} values is required. */ Matrix4.fromRowMajorArray = function(values, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(values)) { throw new DeveloperError('values is required.'); } @@ -197,7 +197,7 @@ define([ * @exception {DeveloperError} translation is required. */ Matrix4.fromRotationTranslation = function(rotation, translation, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(rotation)) { throw new DeveloperError('rotation is required.'); } @@ -258,7 +258,7 @@ define([ * result); */ Matrix4.fromTranslationQuaternionRotationScale = function(translation, rotation, scale, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(translation)) { throw new DeveloperError('translation is required.'); } @@ -356,7 +356,7 @@ define([ * var m = Matrix4.fromScale(new Cartesian3(7.0, 8.0, 9.0)); */ Matrix4.fromScale = function(scale, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(scale)) { throw new DeveloperError('scale is required.'); } @@ -408,7 +408,7 @@ define([ * var m = Matrix4.fromScale(2.0); */ Matrix4.fromUniformScale = function(scale, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (typeof scale !== 'number') { throw new DeveloperError('scale is required.'); } @@ -458,7 +458,7 @@ define([ * @exception {DeveloperError} camera.up is required. */ Matrix4.fromCamera = function(camera, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(camera)) { throw new DeveloperError('camera is required.'); } @@ -468,7 +468,7 @@ define([ var target = camera.target; var up = camera.up; - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(eye)) { throw new DeveloperError('camera.eye is required.'); } @@ -559,7 +559,7 @@ define([ * @exception {DeveloperError} far must be greater than zero. */ Matrix4.computePerspectiveFieldOfView = function(fovY, aspectRatio, near, far, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (fovY <= 0.0 || fovY > Math.PI) { throw new DeveloperError('fovY must be in [0, PI).'); } @@ -631,7 +631,7 @@ define([ * @exception {DeveloperError} far is required. */ Matrix4.computeOrthographicOffCenter = function(left, right, bottom, top, near, far, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required.'); } @@ -710,7 +710,7 @@ define([ * @exception {DeveloperError} far is required. */ Matrix4.computePerspectiveOffCenter = function(left, right, bottom, top, near, far, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required.'); } @@ -785,7 +785,7 @@ define([ * @exception {DeveloperError} near is required. */ Matrix4.computeInfinitePerspectiveOffCenter = function(left, right, bottom, top, near, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required.'); } @@ -932,7 +932,7 @@ define([ * */ Matrix4.toArray = function(matrix, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -981,7 +981,7 @@ define([ * myMatrix[column1Row0Index] = 10.0; */ Matrix4.getElementIndex = function(column, row) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (typeof row !== 'number' || row < 0 || row > 3) { throw new DeveloperError('row is required and must be 0, 1, 2, or 3.'); } @@ -1025,7 +1025,7 @@ define([ * */ Matrix4.getColumn = function(matrix, index, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -1084,7 +1084,7 @@ define([ * */ Matrix4.setColumn = function(matrix, index, cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -1136,7 +1136,7 @@ define([ * // a.x = 18.0; a.y = 19.0; a.z = 20.0; a.w = 21.0; */ Matrix4.getRow = function(matrix, index, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -1194,7 +1194,7 @@ define([ * */ Matrix4.setRow = function(matrix, index, cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -1227,7 +1227,7 @@ define([ * @exception {DeveloperError} right is required. */ Matrix4.multiply = function(left, right, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -1338,7 +1338,7 @@ define([ * Matrix4.multiplyByTranslation(m, position, m); */ Matrix4.multiplyByTranslation = function(matrix, translation, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -1407,7 +1407,7 @@ define([ * Matrix4.multiplyByUniformScale(m, scale, m); */ Matrix4.multiplyByUniformScale = function(matrix, scale, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (typeof scale !== 'number') { throw new DeveloperError('scale is required'); } @@ -1443,7 +1443,7 @@ define([ * Matrix4.multiplyByUniformScale(m, scale, m); */ Matrix4.multiplyByScale = function(matrix, scale, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -1501,7 +1501,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Matrix4.multiplyByVector = function(matrix, cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -1553,7 +1553,7 @@ define([ * // Matrix4.multiplyByVector(matrix, new Cartesian4(p.x, p.y, p.z, 1.0), result); */ Matrix4.multiplyByPoint = function(matrix, cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } @@ -1596,7 +1596,7 @@ define([ * */ Matrix4.multiplyByScalar = function(matrix, scalar, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -1657,7 +1657,7 @@ define([ * */ Matrix4.negate = function(matrix, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -1715,7 +1715,7 @@ define([ * */ Matrix4.transpose = function(matrix, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -1843,7 +1843,7 @@ define([ * */ Matrix4.equalsEpsilon = function(left, right, epsilon) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number'); } @@ -1883,7 +1883,7 @@ define([ * @see Cartesian3 */ Matrix4.getTranslation = function(matrix, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -1927,7 +1927,7 @@ define([ * */ Matrix4.getRotation = function(matrix, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -1965,7 +1965,7 @@ define([ * @exception {RuntimeError} matrix is not invertible because its determinate is zero. */ Matrix4.inverse = function(matrix, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -2092,7 +2092,7 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix4.inverseTransformation = function(matrix, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } diff --git a/Source/Core/Quaternion.js b/Source/Core/Quaternion.js index df7147c684ac..1232cd9d5583 100644 --- a/Source/Core/Quaternion.js +++ b/Source/Core/Quaternion.js @@ -74,7 +74,7 @@ define([ * @exception {DeveloperError} angle is required and must be a number. */ Quaternion.fromAxisAngle = function(axis, angle, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(axis)) { throw new DeveloperError('axis is required.'); } @@ -116,7 +116,7 @@ define([ * @see Matrix3.fromQuaternion */ Quaternion.fromRotationMatrix = function(matrix, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -204,7 +204,7 @@ define([ * @exception {DeveloperError} array is required. */ Quaternion.pack = function(value, array, startingIndex) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(value)) { throw new DeveloperError('value is required'); } @@ -233,7 +233,7 @@ define([ * @exception {DeveloperError} array is required. */ Quaternion.unpack = function(array, startingIndex, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(array)) { throw new DeveloperError('array is required'); } @@ -357,7 +357,7 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.conjugate = function(quaternion, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } @@ -383,7 +383,7 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.magnitudeSquared = function(quaternion) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } @@ -461,7 +461,7 @@ define([ * @exception {DeveloperError} right is required. */ Quaternion.add = function(left, right, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -493,7 +493,7 @@ define([ * @exception {DeveloperError} right is required. */ Quaternion.subtract = function(left, right, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -523,7 +523,7 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.negate = function(quaternion, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } @@ -551,7 +551,7 @@ define([ * @exception {DeveloperError} right is required. */ Quaternion.dot = function(left, right) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -577,7 +577,7 @@ define([ * @exception {DeveloperError} right is required. */ Quaternion.multiply = function(left, right, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } @@ -624,7 +624,7 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Quaternion.multiplyByScalar = function(quaternion, scalar, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } @@ -656,7 +656,7 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Quaternion.divideByScalar = function(quaternion, scalar, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } @@ -686,7 +686,7 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.getAxis = function(quaternion, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } @@ -721,7 +721,7 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.getAngle = function(quaternion) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } @@ -749,7 +749,7 @@ define([ * @exception {DeveloperError} t is required and must be a number. */ Quaternion.lerp = function(start, end, t, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(start)) { throw new DeveloperError('start is required.'); } @@ -784,7 +784,7 @@ define([ * @exception {DeveloperError} t is required and must be a number. */ Quaternion.slerp = function(start, end, t, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(start)) { throw new DeveloperError('start is required.'); } @@ -830,7 +830,7 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.log = function(quaternion, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required.'); } @@ -863,7 +863,7 @@ define([ * @exception {DeveloperError} cartesian is required. */ Quaternion.exp = function(cartesian, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required.'); } @@ -909,7 +909,7 @@ define([ * @see Quaternion#squad */ Quaternion.innerQuadrangle = function(q0, q1, q2, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(q0) || !defined(q1) || !defined(q2)) { throw new DeveloperError('q0, q1, and q2 are required.'); } @@ -958,7 +958,7 @@ define([ * var q = Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t); */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(q0) || !defined(q1) || !defined(s0) || !defined(s1)) { throw new DeveloperError('q0, q1, s0, and s1 are required.'); } @@ -1006,7 +1006,7 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Quaternion.equalsEpsilon = function(left, right, epsilon) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number.'); } diff --git a/Source/Renderer/Context.js b/Source/Renderer/Context.js index e884164bf735..5129c444b11f 100644 --- a/Source/Renderer/Context.js +++ b/Source/Renderer/Context.js @@ -182,7 +182,7 @@ define([ throw new RuntimeError('The browser does not support WebGL. Visit http://get.webgl.org.'); } - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(canvas)) { throw new DeveloperError('canvas is required.'); } @@ -1072,12 +1072,12 @@ define([ } else if (typeof typedArrayOrSizeInBytes === 'object' && typeof typedArrayOrSizeInBytes.byteLength === 'number') { sizeInBytes = typedArrayOrSizeInBytes.byteLength; } else { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); throw new DeveloperError('typedArrayOrSizeInBytes must be either a typed array or a number.'); //>>excludeEnd('debug'); } - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (sizeInBytes <= 0) { throw new DeveloperError('typedArrayOrSizeInBytes must be greater than zero.'); } @@ -1174,7 +1174,7 @@ define([ * BufferUsage.STATIC_DRAW, IndexDatatype.UNSIGNED_SHORT) */ Context.prototype.createIndexBuffer = function(typedArrayOrSizeInBytes, usage, indexDatatype) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!IndexDatatype.validate(indexDatatype)) { throw new DeveloperError('Invalid indexDatatype.'); } @@ -1330,7 +1330,7 @@ define([ var pixelFormat = defaultValue(description.pixelFormat, PixelFormat.RGBA); var pixelDatatype = defaultValue(description.pixelDatatype, PixelDatatype.UNSIGNED_BYTE); - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(width) || !defined(height)) { throw new DeveloperError('description requires a source field to create an initialized texture or width and height fields to create a blank texture.'); } @@ -1374,7 +1374,7 @@ define([ } if (PixelFormat.isDepthFormat(pixelFormat)) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (defined(source)) { throw new DeveloperError('When description.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, source cannot be provided.'); } @@ -1455,7 +1455,7 @@ define([ width = defaultValue(width, gl.drawingBufferWidth); height = defaultValue(height, gl.drawingBufferHeight); - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!PixelFormat.validate(pixelFormat)) { throw new DeveloperError('Invalid pixelFormat.'); } @@ -1547,7 +1547,7 @@ define([ if (defined(source)) { var faces = [source.positiveX, source.negativeX, source.positiveY, source.negativeY, source.positiveZ, source.negativeZ]; - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!faces[0] || !faces[1] || !faces[2] || !faces[3] || !faces[4] || !faces[5]) { throw new DeveloperError('description.source requires positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ faces.'); } @@ -1556,7 +1556,7 @@ define([ width = faces[0].width; height = faces[0].height; - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); for ( var i = 1; i < 6; ++i) { if ((Number(faces[i].width) !== width) || (Number(faces[i].height) !== height)) { throw new DeveloperError('Each face in description.source must have the same width and height.'); @@ -1572,7 +1572,7 @@ define([ var pixelFormat = defaultValue(description.pixelFormat, PixelFormat.RGBA); var pixelDatatype = defaultValue(description.pixelDatatype, PixelDatatype.UNSIGNED_BYTE); - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(width) || !defined(height)) { throw new DeveloperError('description requires a source field to create an initialized cube map or width and height fields to create a blank cube map.'); } @@ -1732,7 +1732,7 @@ define([ var width = defined(description.width) ? description.width : gl.drawingBufferWidth; var height = defined(description.height) ? description.height : gl.drawingBufferHeight; - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!RenderbufferFormat.validate(format)) { throw new DeveloperError('Invalid format.'); } @@ -1929,7 +1929,7 @@ define([ maximumAnisotropy : (defined(sampler.maximumAnisotropy)) ? sampler.maximumAnisotropy : 1.0 }; - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!TextureWrap.validate(s.wrapS)) { throw new DeveloperError('Invalid sampler.wrapS.'); } @@ -2061,7 +2061,7 @@ define([ function beginDraw(context, framebuffer, drawCommand, passState) { var rs = defined(drawCommand.renderState) ? drawCommand.renderState : context._defaultRenderState; - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (defined(framebuffer) && rs.depthTest) { if (rs.depthTest.enabled && !framebuffer.hasDepthAttachment()) { throw new DeveloperError('The depth test can not be enabled (drawCommand.renderState.depthTest.enabled) because the framebuffer (drawCommand.framebuffer) does not have a depth or depth-stencil renderbuffer.'); @@ -2089,7 +2089,7 @@ define([ var offset = drawCommand.offset; var count = drawCommand.count; - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!PrimitiveType.validate(primitiveType)) { throw new DeveloperError('drawCommand.primitiveType is required and must be valid.'); } @@ -2180,7 +2180,7 @@ define([ * @see Context#createRenderState */ Context.prototype.draw = function(drawCommand, passState) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(drawCommand)) { throw new DeveloperError('drawCommand is required.'); } @@ -2234,7 +2234,7 @@ define([ var height = readState.height || gl.drawingBufferHeight; var framebuffer = readState.framebuffer || null; - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (width <= 0) { throw new DeveloperError('readState.width must be greater than zero.'); } @@ -2564,7 +2564,7 @@ define([ * @see Context#createPickId */ Context.prototype.getObjectByPickColor = function(pickColor) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(pickColor)) { throw new DeveloperError('pickColor is required.'); } @@ -2607,7 +2607,7 @@ define([ * }); */ Context.prototype.createPickId = function(object) { - //>>excludeStart('debug', pragmas.debug); + //>>excludeStart('debug', !pragmas.debug); if (!defined(object)) { throw new DeveloperError('object is required.'); } From 03256839f8826c63cac32b932227c5177f7cbaa0 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 14 Nov 2013 17:24:42 -0500 Subject: [PATCH 08/33] Conditional include instead of conditionally exclude code. --- Source/Core/Cartesian2.js | 76 +++++++++++----------- Source/Core/Cartesian3.js | 84 ++++++++++++------------- Source/Core/Cartesian4.js | 72 ++++++++++----------- Source/Core/Matrix2.js | 66 +++++++++---------- Source/Core/Matrix3.js | 84 ++++++++++++------------- Source/Core/Matrix4.js | 126 ++++++++++++++++++------------------- Source/Core/Quaternion.js | 88 +++++++++++++------------- Source/Renderer/Context.js | 72 ++++++++++----------- Tools/build.js | 2 +- 9 files changed, 335 insertions(+), 335 deletions(-) diff --git a/Source/Core/Cartesian2.js b/Source/Core/Cartesian2.js index d6eb837dedc6..e3bc2afe8be8 100644 --- a/Source/Core/Cartesian2.js +++ b/Source/Core/Cartesian2.js @@ -125,7 +125,7 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian2.pack = function(value, array, startingIndex) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(value)) { throw new DeveloperError('value is required'); } @@ -133,7 +133,7 @@ define([ if (!defined(array)) { throw new DeveloperError('array is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); @@ -152,11 +152,11 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian2.unpack = function(array, startingIndex, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(array)) { throw new DeveloperError('array is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); @@ -201,11 +201,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.getMaximumComponent = function(cartesian) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return Math.max(cartesian.x, cartesian.y); }; @@ -220,11 +220,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.getMinimumComponent = function(cartesian) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return Math.min(cartesian.x, cartesian.y); }; @@ -239,11 +239,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.magnitudeSquared = function(cartesian) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return cartesian.x * cartesian.x + cartesian.y * cartesian.y; }; @@ -279,11 +279,11 @@ define([ * var d = Cartesian2.distance(new Cartesian2(1.0, 0.0), new Cartesian2(2.0, 0.0)); */ Cartesian2.distance = function(left, right) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left) || !defined(right)) { throw new DeveloperError('left and right are required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); Cartesian2.subtract(left, right, distanceScratch); return Cartesian2.magnitude(distanceScratch); @@ -300,11 +300,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.normalize = function(cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var magnitude = Cartesian2.magnitude(cartesian); if (!defined(result)) { @@ -327,14 +327,14 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian2.dot = function(left, right) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return left.x * right.x + left.y * right.y; }; @@ -352,14 +352,14 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian2.multiplyComponents = function(left, right, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian2(left.x * right.x, left.y * right.y); @@ -382,14 +382,14 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian2.add = function(left, right, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian2(left.x + right.x, left.y + right.y); @@ -412,14 +412,14 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian2.subtract = function(left, right, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian2(left.x - right.x, left.y - right.y); @@ -442,14 +442,14 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian2.multiplyByScalar = function(cartesian, scalar, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian2(cartesian.x * scalar, cartesian.y * scalar); @@ -472,14 +472,14 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian2.divideByScalar = function(cartesian, scalar, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian2(cartesian.x / scalar, cartesian.y / scalar); @@ -500,11 +500,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.negate = function(cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian2(-cartesian.x, -cartesian.y); @@ -525,11 +525,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.abs = function(cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian2(Math.abs(cartesian.x), Math.abs(cartesian.y)); @@ -555,7 +555,7 @@ define([ * @exception {DeveloperError} t is required and must be a number. */ Cartesian2.lerp = function(start, end, t, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(start)) { throw new DeveloperError('start is required.'); } @@ -565,7 +565,7 @@ define([ if (typeof t !== 'number') { throw new DeveloperError('t is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); Cartesian2.multiplyByScalar(end, t, lerpScratch); result = Cartesian2.multiplyByScalar(start, 1.0 - t, result); @@ -586,14 +586,14 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian2.angleBetween = function(left, right) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); Cartesian2.normalize(left, angleBetweenScratch); Cartesian2.normalize(right, angleBetweenScratch2); @@ -612,11 +612,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian2.mostOrthogonalAxis = function(cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var f = Cartesian2.normalize(cartesian, mostOrthogonalAxisScratch); Cartesian2.abs(f, f); @@ -661,11 +661,11 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Cartesian2.equalsEpsilon = function(left, right, epsilon) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return (left === right) || ((defined(left)) && diff --git a/Source/Core/Cartesian3.js b/Source/Core/Cartesian3.js index ca53f19190be..a71a18fbd145 100644 --- a/Source/Core/Cartesian3.js +++ b/Source/Core/Cartesian3.js @@ -58,11 +58,11 @@ define([ * @exception {DeveloperError} spherical is required. */ Cartesian3.fromSpherical = function(spherical, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(spherical)) { throw new DeveloperError('spherical is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { result = new Cartesian3(); @@ -152,7 +152,7 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian3.pack = function(value, array, startingIndex) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(value)) { throw new DeveloperError('value is required'); } @@ -160,7 +160,7 @@ define([ if (!defined(array)) { throw new DeveloperError('array is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); @@ -180,11 +180,11 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian3.unpack = function(array, startingIndex, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(array)) { throw new DeveloperError('array is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); @@ -230,11 +230,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.getMaximumComponent = function(cartesian) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return Math.max(cartesian.x, cartesian.y, cartesian.z); }; @@ -249,11 +249,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.getMinimumComponent = function(cartesian) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return Math.min(cartesian.x, cartesian.y, cartesian.z); }; @@ -268,11 +268,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.magnitudeSquared = function(cartesian) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z; }; @@ -308,11 +308,11 @@ define([ * var d = Cartesian3.distance(new Cartesian3(1.0, 0.0, 0.0), new Cartesian3(2.0, 0.0, 0.0)); */ Cartesian3.distance = function(left, right) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left) || !defined(right)) { throw new DeveloperError('left and right are required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); Cartesian3.subtract(left, right, distanceScratch); return Cartesian3.magnitude(distanceScratch); @@ -329,11 +329,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.normalize = function(cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var magnitude = Cartesian3.magnitude(cartesian); if (!defined(result)) { @@ -357,14 +357,14 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.dot = function(left, right) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return left.x * right.x + left.y * right.y + left.z * right.z; }; @@ -382,14 +382,14 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.multiplyComponents = function(left, right, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian3(left.x * right.x, left.y * right.y, left.z * right.z); @@ -413,14 +413,14 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.add = function(left, right, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian3(left.x + right.x, left.y + right.y, left.z + right.z); @@ -444,14 +444,14 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.subtract = function(left, right, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian3(left.x - right.x, left.y - right.y, left.z - right.z); @@ -475,14 +475,14 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian3.multiplyByScalar = function(cartesian, scalar, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian3(cartesian.x * scalar, cartesian.y * scalar, cartesian.z * scalar); @@ -506,14 +506,14 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian3.divideByScalar = function(cartesian, scalar, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian3(cartesian.x / scalar, cartesian.y / scalar, cartesian.z / scalar); @@ -535,11 +535,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.negate = function(cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian3(-cartesian.x, -cartesian.y, -cartesian.z); @@ -561,11 +561,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.abs = function(cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian3(Math.abs(cartesian.x), Math.abs(cartesian.y), Math.abs(cartesian.z)); @@ -592,7 +592,7 @@ define([ * @exception {DeveloperError} t is required and must be a number. */ Cartesian3.lerp = function(start, end, t, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(start)) { throw new DeveloperError('start is required.'); } @@ -602,7 +602,7 @@ define([ if (typeof t !== 'number') { throw new DeveloperError('t is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); Cartesian3.multiplyByScalar(end, t, lerpScratch); result = Cartesian3.multiplyByScalar(start, 1.0 - t, result); @@ -623,14 +623,14 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.angleBetween = function(left, right) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); Cartesian3.normalize(left, angleBetweenScratch); Cartesian3.normalize(right, angleBetweenScratch2); @@ -651,11 +651,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian3.mostOrthogonalAxis = function(cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var f = Cartesian3.normalize(cartesian, mostOrthogonalAxisScratch); Cartesian3.abs(f, f); @@ -709,11 +709,11 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Cartesian3.equalsEpsilon = function(left, right, epsilon) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return (left === right) || ((defined(left)) && @@ -736,14 +736,14 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian3.cross = function(left, right, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var leftX = left.x; var leftY = left.y; diff --git a/Source/Core/Cartesian4.js b/Source/Core/Cartesian4.js index 94ac1c973eba..e7e004b53af1 100644 --- a/Source/Core/Cartesian4.js +++ b/Source/Core/Cartesian4.js @@ -121,7 +121,7 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian4.pack = function(value, array, startingIndex) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(value)) { throw new DeveloperError('value is required'); } @@ -129,7 +129,7 @@ define([ if (!defined(array)) { throw new DeveloperError('array is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); @@ -150,11 +150,11 @@ define([ * @exception {DeveloperError} array is required. */ Cartesian4.unpack = function(array, startingIndex, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(array)) { throw new DeveloperError('array is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); @@ -203,11 +203,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.getMaximumComponent = function(cartesian) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return Math.max(cartesian.x, cartesian.y, cartesian.z, cartesian.w); }; @@ -222,11 +222,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.getMinimumComponent = function(cartesian) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return Math.min(cartesian.x, cartesian.y, cartesian.z, cartesian.w); }; @@ -241,11 +241,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.magnitudeSquared = function(cartesian) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z + cartesian.w * cartesian.w; }; @@ -281,11 +281,11 @@ define([ * var d = Cartesian4.distance(new Cartesian4(1.0, 0.0, 0.0, 0.0), new Cartesian4(2.0, 0.0, 0.0, 0.0)); */ Cartesian4.distance = function(left, right) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left) || !defined(right)) { throw new DeveloperError('left and right are required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); Cartesian4.subtract(left, right, distanceScratch); return Cartesian4.magnitude(distanceScratch); @@ -302,11 +302,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.normalize = function(cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var magnitude = Cartesian4.magnitude(cartesian); if (!defined(result)) { @@ -331,14 +331,14 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian4.dot = function(left, right) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w; }; @@ -356,14 +356,14 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian4.multiplyComponents = function(left, right, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian4(left.x * right.x, left.y * right.y, left.z * right.z, left.w * right.w); @@ -388,14 +388,14 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian4.add = function(left, right, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian4(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w); @@ -420,14 +420,14 @@ define([ * @exception {DeveloperError} right is required. */ Cartesian4.subtract = function(left, right, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian4(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w); @@ -452,14 +452,14 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian4.multiplyByScalar = function(cartesian, scalar, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian4(cartesian.x * scalar, cartesian.y * scalar, cartesian.z * scalar, cartesian.w * scalar); @@ -484,14 +484,14 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Cartesian4.divideByScalar = function(cartesian, scalar, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian4(cartesian.x / scalar, cartesian.y / scalar, cartesian.z / scalar, cartesian.w / scalar); @@ -514,11 +514,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.negate = function(cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian4(-cartesian.x, -cartesian.y, -cartesian.z, -cartesian.w); @@ -541,11 +541,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.abs = function(cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian4(Math.abs(cartesian.x), Math.abs(cartesian.y), Math.abs(cartesian.z), Math.abs(cartesian.w)); @@ -573,7 +573,7 @@ define([ * @exception {DeveloperError} t is required and must be a number. */ Cartesian4.lerp = function(start, end, t, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(start)) { throw new DeveloperError('start is required.'); } @@ -583,7 +583,7 @@ define([ if (typeof t !== 'number') { throw new DeveloperError('t is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); Cartesian4.multiplyByScalar(end, t, lerpScratch); result = Cartesian4.multiplyByScalar(start, 1.0 - t, result); @@ -602,11 +602,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Cartesian4.mostOrthogonalAxis = function(cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var f = Cartesian4.normalize(cartesian, mostOrthogonalAxisScratch); Cartesian4.abs(f, f); @@ -671,11 +671,11 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Cartesian4.equalsEpsilon = function(left, right, epsilon) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return (left === right) || ((defined(left)) && diff --git a/Source/Core/Matrix2.js b/Source/Core/Matrix2.js index ee56130d7374..a2c50624c5ef 100644 --- a/Source/Core/Matrix2.js +++ b/Source/Core/Matrix2.js @@ -73,11 +73,11 @@ define([ * @exception {DeveloperError} values is required. */ Matrix2.fromColumnMajorArray = function(values, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(values)) { throw new DeveloperError('values parameter is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return Matrix2.clone(values, result); }; @@ -94,11 +94,11 @@ define([ * @exception {DeveloperError} values is required. */ Matrix2.fromRowMajorArray = function(values, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(values)) { throw new DeveloperError('values is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix2(values[0], values[1], @@ -128,11 +128,11 @@ define([ * var m = Matrix2.fromScale(new Cartesian2(7.0, 8.0)); */ Matrix2.fromScale = function(scale, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(scale)) { throw new DeveloperError('scale is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix2( @@ -164,11 +164,11 @@ define([ * var m = Matrix2.fromUniformScale(2.0); */ Matrix2.fromUniformScale = function(scale, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (typeof scale !== 'number') { throw new DeveloperError('scale is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix2( @@ -200,11 +200,11 @@ define([ * var rotated = Matrix2.multiplyByVector(m, p); */ Matrix2.fromRotation = function(angle, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(angle)) { throw new DeveloperError('angle is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var cosAngle = Math.cos(angle); var sinAngle = Math.sin(angle); @@ -233,11 +233,11 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix2.toArray = function(matrix, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return [matrix[0], matrix[1], matrix[2], matrix[3]]; @@ -267,14 +267,14 @@ define([ * myMatrix[column1Row0Index] = 10.0; */ Matrix2.getElementIndex = function(column, row) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (typeof row !== 'number' || row < 0 || row > 1) { throw new DeveloperError('row is required and must be 0 or 1.'); } if (typeof column !== 'number' || column < 0 || column > 1) { throw new DeveloperError('column is required and must be 0 or 1.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return column * 2 + row; }; @@ -294,7 +294,7 @@ define([ * @see Cartesian2 */ Matrix2.getColumn = function(matrix, index, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -302,7 +302,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 1) { throw new DeveloperError('index is required and must be 0 or 1.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var startIndex = index * 2; var x = matrix[startIndex]; @@ -333,7 +333,7 @@ define([ * @see Cartesian2 */ Matrix2.setColumn = function(matrix, index, cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -343,7 +343,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 1) { throw new DeveloperError('index is required and must be 0 or 1.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); result = Matrix2.clone(matrix, result); var startIndex = index * 2; @@ -367,7 +367,7 @@ define([ * @see Cartesian2 */ Matrix2.getRow = function(matrix, index, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -375,7 +375,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 1) { throw new DeveloperError('index is required and must be 0 or 1.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var x = matrix[index]; var y = matrix[index + 2]; @@ -405,7 +405,7 @@ define([ * @see Cartesian2 */ Matrix2.setRow = function(matrix, index, cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -415,7 +415,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 1) { throw new DeveloperError('index is required and must be 0 or 1.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); result = Matrix2.clone(matrix, result); result[index] = cartesian.x; @@ -436,14 +436,14 @@ define([ * @exception {DeveloperError} right is required. */ Matrix2.multiply = function(left, right, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var column0Row0 = left[0] * right[0] + left[2] * right[1]; var column1Row0 = left[0] * right[2] + left[2] * right[3]; @@ -474,14 +474,14 @@ define([ * @exception {DeveloperError} cartesian is required. */ Matrix2.multiplyByVector = function(matrix, cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var x = matrix[0] * cartesian.x + matrix[2] * cartesian.y; var y = matrix[1] * cartesian.x + matrix[3] * cartesian.y; @@ -507,14 +507,14 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Matrix2.multiplyByScalar = function(matrix, scalar, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix2(matrix[0] * scalar, matrix[2] * scalar, @@ -538,11 +538,11 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix2.negate = function(matrix, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix2(-matrix[0], -matrix[2], @@ -566,7 +566,7 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix2.transpose = function(matrix, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -621,11 +621,11 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Matrix2.equalsEpsilon = function(left, right, epsilon) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return (left === right) || (defined(left) && diff --git a/Source/Core/Matrix3.js b/Source/Core/Matrix3.js index 15b396c16f15..968dfa6f8e4c 100644 --- a/Source/Core/Matrix3.js +++ b/Source/Core/Matrix3.js @@ -94,11 +94,11 @@ define([ * @exception {DeveloperError} values is required. */ Matrix3.fromColumnMajorArray = function(values, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(values)) { throw new DeveloperError('values parameter is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return Matrix3.clone(values, result); }; @@ -115,11 +115,11 @@ define([ * @exception {DeveloperError} values is required. */ Matrix3.fromRowMajorArray = function(values, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(values)) { throw new DeveloperError('values is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix3(values[0], values[1], values[2], @@ -147,11 +147,11 @@ define([ * @returns {Matrix3} The 3x3 rotation matrix from this quaternion. */ Matrix3.fromQuaternion = function(quaternion, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var x2 = quaternion.x * quaternion.x; var xy = quaternion.x * quaternion.y; @@ -211,11 +211,11 @@ define([ * var m = Matrix3.fromScale(new Cartesian3(7.0, 8.0, 9.0)); */ Matrix3.fromScale = function(scale, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(scale)) { throw new DeveloperError('scale is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix3( @@ -254,11 +254,11 @@ define([ * var m = Matrix3.fromUniformScale(2.0); */ Matrix3.fromUniformScale = function(scale, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (typeof scale !== 'number') { throw new DeveloperError('scale is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix3( @@ -296,11 +296,11 @@ define([ * var rotated = Matrix3.multiplyByVector(m, p); */ Matrix3.fromRotationX = function(angle, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(angle)) { throw new DeveloperError('angle is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var cosAngle = Math.cos(angle); var sinAngle = Math.sin(angle); @@ -342,11 +342,11 @@ define([ * var rotated = Matrix3.multiplyByVector(m, p); */ Matrix3.fromRotationY = function(angle, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(angle)) { throw new DeveloperError('angle is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var cosAngle = Math.cos(angle); var sinAngle = Math.sin(angle); @@ -388,11 +388,11 @@ define([ * var rotated = Matrix3.multiplyByVector(m, p); */ Matrix3.fromRotationZ = function(angle, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(angle)) { throw new DeveloperError('angle is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var cosAngle = Math.cos(angle); var sinAngle = Math.sin(angle); @@ -429,11 +429,11 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix3.toArray = function(matrix, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return [matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], matrix[6], matrix[7], matrix[8]]; @@ -468,14 +468,14 @@ define([ * myMatrix[column1Row0Index] = 10.0; */ Matrix3.getElementIndex = function(column, row) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (typeof row !== 'number' || row < 0 || row > 2) { throw new DeveloperError('row is required and must be 0, 1, or 2.'); } if (typeof column !== 'number' || column < 0 || column > 2) { throw new DeveloperError('column is required and must be 0, 1, or 2.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return column * 3 + row; }; @@ -495,7 +495,7 @@ define([ * @see Cartesian3 */ Matrix3.getColumn = function(matrix, index, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -503,7 +503,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 2) { throw new DeveloperError('index is required and must be 0, 1, or 2.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var startIndex = index * 3; var x = matrix[startIndex]; @@ -536,7 +536,7 @@ define([ * @see Cartesian3 */ Matrix3.setColumn = function(matrix, index, cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -546,7 +546,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 2) { throw new DeveloperError('index is required and must be 0, 1, or 2.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); result = Matrix3.clone(matrix, result); var startIndex = index * 3; @@ -571,7 +571,7 @@ define([ * @see Cartesian3 */ Matrix3.getRow = function(matrix, index, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -579,7 +579,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 2) { throw new DeveloperError('index is required and must be 0, 1, or 2.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var x = matrix[index]; var y = matrix[index + 3]; @@ -611,7 +611,7 @@ define([ * @see Cartesian3 */ Matrix3.setRow = function(matrix, index, cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -621,7 +621,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 2) { throw new DeveloperError('index is required and must be 0, 1, or 2.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); result = Matrix3.clone(matrix, result); result[index] = cartesian.x; @@ -643,14 +643,14 @@ define([ * @exception {DeveloperError} right is required. */ Matrix3.multiply = function(left, right, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var column0Row0 = left[0] * right[0] + left[3] * right[1] + left[6] * right[2]; var column0Row1 = left[1] * right[0] + left[4] * right[1] + left[7] * right[2]; @@ -694,14 +694,14 @@ define([ * @exception {DeveloperError} cartesian is required. */ Matrix3.multiplyByVector = function(matrix, cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var vX = cartesian.x; var vY = cartesian.y; @@ -733,14 +733,14 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Matrix3.multiplyByScalar = function(matrix, scalar, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix3(matrix[0] * scalar, matrix[3] * scalar, matrix[6] * scalar, @@ -770,11 +770,11 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix3.negate = function(matrix, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix3(-matrix[0], -matrix[3], -matrix[6], @@ -804,11 +804,11 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix3.transpose = function(matrix, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var column0Row0 = matrix[0]; var column0Row1 = matrix[3]; @@ -954,11 +954,11 @@ define([ * var c = Cartesian3.multiplyByScalar(v, lambda); // equal to Matrix3.multiplyByVector(a, v) */ Matrix3.getEigenDecomposition = function(matrix, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); // This routine was created based upon Matrix Computations, 3rd ed., by Golub and Van Loan, // section 8.4.3 The Classical Jacobi Algorithm @@ -1098,11 +1098,11 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Matrix3.equalsEpsilon = function(left, right, epsilon) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return (left === right) || (defined(left) && diff --git a/Source/Core/Matrix4.js b/Source/Core/Matrix4.js index a3e3513ad649..1adffc305b0e 100644 --- a/Source/Core/Matrix4.js +++ b/Source/Core/Matrix4.js @@ -131,11 +131,11 @@ define([ * @exception {DeveloperError} values is required. */ Matrix4.fromColumnMajorArray = function(values, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(values)) { throw new DeveloperError('values parameter is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return Matrix4.clone(values, result); }; @@ -152,11 +152,11 @@ define([ * @exception {DeveloperError} values is required. */ Matrix4.fromRowMajorArray = function(values, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(values)) { throw new DeveloperError('values is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix4(values[0], values[1], values[2], values[3], @@ -197,14 +197,14 @@ define([ * @exception {DeveloperError} translation is required. */ Matrix4.fromRotationTranslation = function(rotation, translation, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(rotation)) { throw new DeveloperError('rotation is required.'); } if (!defined(translation)) { throw new DeveloperError('translation is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix4(rotation[0], rotation[3], rotation[6], translation.x, @@ -258,7 +258,7 @@ define([ * result); */ Matrix4.fromTranslationQuaternionRotationScale = function(translation, rotation, scale, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(translation)) { throw new DeveloperError('translation is required.'); } @@ -268,7 +268,7 @@ define([ if (!defined(scale)) { throw new DeveloperError('scale is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { result = new Matrix4(); @@ -356,11 +356,11 @@ define([ * var m = Matrix4.fromScale(new Cartesian3(7.0, 8.0, 9.0)); */ Matrix4.fromScale = function(scale, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(scale)) { throw new DeveloperError('scale is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix4( @@ -408,11 +408,11 @@ define([ * var m = Matrix4.fromScale(2.0); */ Matrix4.fromUniformScale = function(scale, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (typeof scale !== 'number') { throw new DeveloperError('scale is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix4(scale, 0.0, 0.0, 0.0, @@ -458,17 +458,17 @@ define([ * @exception {DeveloperError} camera.up is required. */ Matrix4.fromCamera = function(camera, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(camera)) { throw new DeveloperError('camera is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var eye = camera.eye; var target = camera.target; var up = camera.up; - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(eye)) { throw new DeveloperError('camera.eye is required.'); } @@ -478,7 +478,7 @@ define([ if (!defined(up)) { throw new DeveloperError('camera.up is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); Cartesian3.normalize(Cartesian3.subtract(target, eye, fromCameraF), fromCameraF); Cartesian3.normalize(Cartesian3.cross(fromCameraF, up, fromCameraS), fromCameraS); @@ -559,7 +559,7 @@ define([ * @exception {DeveloperError} far must be greater than zero. */ Matrix4.computePerspectiveFieldOfView = function(fovY, aspectRatio, near, far, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (fovY <= 0.0 || fovY > Math.PI) { throw new DeveloperError('fovY must be in [0, PI).'); } @@ -575,7 +575,7 @@ define([ if (far <= 0.0) { throw new DeveloperError('far must be greater than zero.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var bottom = Math.tan(fovY * 0.5); @@ -631,7 +631,7 @@ define([ * @exception {DeveloperError} far is required. */ Matrix4.computeOrthographicOffCenter = function(left, right, bottom, top, near, far, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required.'); } @@ -650,7 +650,7 @@ define([ if (!defined(far)) { throw new DeveloperError('far is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var a = 1.0 / (right - left); var b = 1.0 / (top - bottom); @@ -710,7 +710,7 @@ define([ * @exception {DeveloperError} far is required. */ Matrix4.computePerspectiveOffCenter = function(left, right, bottom, top, near, far, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required.'); } @@ -729,7 +729,7 @@ define([ if (!defined(far)) { throw new DeveloperError('far is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var column0Row0 = 2.0 * near / (right - left); var column1Row1 = 2.0 * near / (top - bottom); @@ -785,7 +785,7 @@ define([ * @exception {DeveloperError} near is required. */ Matrix4.computeInfinitePerspectiveOffCenter = function(left, right, bottom, top, near, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required.'); } @@ -801,7 +801,7 @@ define([ if (!defined(near)) { throw new DeveloperError('near is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var column0Row0 = 2.0 * near / (right - left); var column1Row1 = 2.0 * near / (top - bottom); @@ -932,11 +932,11 @@ define([ * */ Matrix4.toArray = function(matrix, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return [matrix[0], matrix[1], matrix[2], matrix[3], @@ -981,14 +981,14 @@ define([ * myMatrix[column1Row0Index] = 10.0; */ Matrix4.getElementIndex = function(column, row) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (typeof row !== 'number' || row < 0 || row > 3) { throw new DeveloperError('row is required and must be 0, 1, 2, or 3.'); } if (typeof column !== 'number' || column < 0 || column > 3) { throw new DeveloperError('column is required and must be 0, 1, 2, or 3.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return column * 4 + row; }; @@ -1025,7 +1025,7 @@ define([ * */ Matrix4.getColumn = function(matrix, index, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -1033,7 +1033,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 3) { throw new DeveloperError('index is required and must be 0, 1, 2, or 3.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var startIndex = index * 4; var x = matrix[startIndex]; @@ -1084,7 +1084,7 @@ define([ * */ Matrix4.setColumn = function(matrix, index, cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -1094,7 +1094,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 3) { throw new DeveloperError('index is required and must be 0, 1, 2, or 3.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); result = Matrix4.clone(matrix, result); var startIndex = index * 4; @@ -1136,7 +1136,7 @@ define([ * // a.x = 18.0; a.y = 19.0; a.z = 20.0; a.w = 21.0; */ Matrix4.getRow = function(matrix, index, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } @@ -1144,7 +1144,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 3) { throw new DeveloperError('index is required and must be 0, 1, 2, or 3.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var x = matrix[index]; var y = matrix[index + 4]; @@ -1194,7 +1194,7 @@ define([ * */ Matrix4.setRow = function(matrix, index, cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } @@ -1204,7 +1204,7 @@ define([ if (typeof index !== 'number' || index < 0 || index > 3) { throw new DeveloperError('index is required and must be 0, 1, 2, or 3.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); result = Matrix4.clone(matrix, result); result[index] = cartesian.x; @@ -1227,14 +1227,14 @@ define([ * @exception {DeveloperError} right is required. */ Matrix4.multiply = function(left, right, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var left0 = left[0]; var left1 = left[1]; @@ -1338,14 +1338,14 @@ define([ * Matrix4.multiplyByTranslation(m, position, m); */ Matrix4.multiplyByTranslation = function(matrix, translation, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } if (!defined(translation)) { throw new DeveloperError('translation is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var x = translation.x; var y = translation.y; @@ -1407,11 +1407,11 @@ define([ * Matrix4.multiplyByUniformScale(m, scale, m); */ Matrix4.multiplyByUniformScale = function(matrix, scale, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (typeof scale !== 'number') { throw new DeveloperError('scale is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); uniformScaleScratch.x = scale; uniformScaleScratch.y = scale; @@ -1443,14 +1443,14 @@ define([ * Matrix4.multiplyByUniformScale(m, scale, m); */ Matrix4.multiplyByScale = function(matrix, scale, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } if (!defined(scale)) { throw new DeveloperError('scale is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var scaleX = scale.x; var scaleY = scale.y; @@ -1501,14 +1501,14 @@ define([ * @exception {DeveloperError} cartesian is required. */ Matrix4.multiplyByVector = function(matrix, cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var vX = cartesian.x; var vY = cartesian.y; @@ -1553,11 +1553,11 @@ define([ * // Matrix4.multiplyByVector(matrix, new Cartesian4(p.x, p.y, p.z, 1.0), result); */ Matrix4.multiplyByPoint = function(matrix, cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); scratchPoint.x = cartesian.x; scratchPoint.y = cartesian.y; @@ -1596,14 +1596,14 @@ define([ * */ Matrix4.multiplyByScalar = function(matrix, scalar, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix4(matrix[0] * scalar, matrix[4] * scalar, matrix[8] * scalar, matrix[12] * scalar, @@ -1657,11 +1657,11 @@ define([ * */ Matrix4.negate = function(matrix, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix4(-matrix[0], -matrix[4], -matrix[8], -matrix[12], @@ -1715,11 +1715,11 @@ define([ * */ Matrix4.transpose = function(matrix, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix4(matrix[0], matrix[1], matrix[2], matrix[3], @@ -1843,7 +1843,7 @@ define([ * */ Matrix4.equalsEpsilon = function(left, right, epsilon) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number'); } @@ -1883,11 +1883,11 @@ define([ * @see Cartesian3 */ Matrix4.getTranslation = function(matrix, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian3(matrix[12], matrix[13], matrix[14]); @@ -1927,11 +1927,11 @@ define([ * */ Matrix4.getRotation = function(matrix, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Matrix3(matrix[0], matrix[4], matrix[8], @@ -1965,11 +1965,11 @@ define([ * @exception {RuntimeError} matrix is not invertible because its determinate is zero. */ Matrix4.inverse = function(matrix, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); // // Ported from: @@ -2092,11 +2092,11 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix4.inverseTransformation = function(matrix, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); //This function is an optimized version of the below 4 lines. //var rT = Matrix3.transpose(Matrix4.getRotation(matrix)); diff --git a/Source/Core/Quaternion.js b/Source/Core/Quaternion.js index 1232cd9d5583..4917541a2f46 100644 --- a/Source/Core/Quaternion.js +++ b/Source/Core/Quaternion.js @@ -74,14 +74,14 @@ define([ * @exception {DeveloperError} angle is required and must be a number. */ Quaternion.fromAxisAngle = function(axis, angle, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(axis)) { throw new DeveloperError('axis is required.'); } if (typeof angle !== 'number') { throw new DeveloperError('angle is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var halfAngle = angle / 2.0; var s = Math.sin(halfAngle); @@ -116,11 +116,11 @@ define([ * @see Matrix3.fromQuaternion */ Quaternion.fromRotationMatrix = function(matrix, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var root; var x; @@ -204,7 +204,7 @@ define([ * @exception {DeveloperError} array is required. */ Quaternion.pack = function(value, array, startingIndex) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(value)) { throw new DeveloperError('value is required'); } @@ -212,7 +212,7 @@ define([ if (!defined(array)) { throw new DeveloperError('array is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); @@ -233,11 +233,11 @@ define([ * @exception {DeveloperError} array is required. */ Quaternion.unpack = function(array, startingIndex, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(array)) { throw new DeveloperError('array is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); @@ -357,11 +357,11 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.conjugate = function(quaternion, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Quaternion(-quaternion.x, -quaternion.y, -quaternion.z, quaternion.w); @@ -383,11 +383,11 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.magnitudeSquared = function(quaternion) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return quaternion.x * quaternion.x + quaternion.y * quaternion.y + quaternion.z * quaternion.z + quaternion.w * quaternion.w; }; @@ -461,14 +461,14 @@ define([ * @exception {DeveloperError} right is required. */ Quaternion.add = function(left, right, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Quaternion(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w); @@ -493,14 +493,14 @@ define([ * @exception {DeveloperError} right is required. */ Quaternion.subtract = function(left, right, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Quaternion(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w); @@ -523,11 +523,11 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.negate = function(quaternion, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Quaternion(-quaternion.x, -quaternion.y, -quaternion.z, -quaternion.w); @@ -551,14 +551,14 @@ define([ * @exception {DeveloperError} right is required. */ Quaternion.dot = function(left, right) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w; }; @@ -577,14 +577,14 @@ define([ * @exception {DeveloperError} right is required. */ Quaternion.multiply = function(left, right, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var leftX = left.x; var leftY = left.y; @@ -624,14 +624,14 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Quaternion.multiplyByScalar = function(quaternion, scalar, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Quaternion(quaternion.x * scalar, quaternion.y * scalar, quaternion.z * scalar, quaternion.w * scalar); @@ -656,14 +656,14 @@ define([ * @exception {DeveloperError} scalar is required and must be a number. */ Quaternion.divideByScalar = function(quaternion, scalar, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!defined(result)) { return new Quaternion(quaternion.x / scalar, quaternion.y / scalar, quaternion.z / scalar, quaternion.w / scalar); @@ -686,11 +686,11 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.getAxis = function(quaternion, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var w = quaternion.w; if (Math.abs(w - 1.0) < CesiumMath.EPSILON6) { @@ -721,11 +721,11 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.getAngle = function(quaternion) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (Math.abs(quaternion.w - 1.0) < CesiumMath.EPSILON6) { return 0.0; @@ -749,7 +749,7 @@ define([ * @exception {DeveloperError} t is required and must be a number. */ Quaternion.lerp = function(start, end, t, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(start)) { throw new DeveloperError('start is required.'); } @@ -759,7 +759,7 @@ define([ if (typeof t !== 'number') { throw new DeveloperError('t is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); lerpScratch = Quaternion.multiplyByScalar(end, t, lerpScratch); result = Quaternion.multiplyByScalar(start, 1.0 - t, result); @@ -784,7 +784,7 @@ define([ * @exception {DeveloperError} t is required and must be a number. */ Quaternion.slerp = function(start, end, t, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(start)) { throw new DeveloperError('start is required.'); } @@ -794,7 +794,7 @@ define([ if (typeof t !== 'number') { throw new DeveloperError('t is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var dot = Quaternion.dot(start, end); @@ -830,11 +830,11 @@ define([ * @exception {DeveloperError} quaternion is required. */ Quaternion.log = function(quaternion, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(quaternion)) { throw new DeveloperError('quaternion is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var theta = Math.acos(CesiumMath.clamp(quaternion.w, -1.0, 1.0)); var thetaOverSinTheta = 0.0; @@ -863,11 +863,11 @@ define([ * @exception {DeveloperError} cartesian is required. */ Quaternion.exp = function(cartesian, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var theta = Cartesian3.magnitude(cartesian); var sinThetaOverTheta = 0.0; @@ -909,11 +909,11 @@ define([ * @see Quaternion#squad */ Quaternion.innerQuadrangle = function(q0, q1, q2, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(q0) || !defined(q1) || !defined(q2)) { throw new DeveloperError('q0, q1, and q2 are required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var qInv = Quaternion.conjugate(q1, squadScratchQuaternion0); Quaternion.multiply(qInv, q2, squadScratchQuaternion1); @@ -958,7 +958,7 @@ define([ * var q = Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t); */ Quaternion.squad = function(q0, q1, s0, s1, t, result) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(q0) || !defined(q1) || !defined(s0) || !defined(s1)) { throw new DeveloperError('q0, q1, s0, and s1 are required.'); } @@ -966,7 +966,7 @@ define([ if (typeof t !== 'number') { throw new DeveloperError('t is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var slerp0 = Quaternion.slerp(q0, q1, t, squadScratchQuaternion0); var slerp1 = Quaternion.slerp(s0, s1, t, squadScratchQuaternion1); @@ -1006,11 +1006,11 @@ define([ * @exception {DeveloperError} epsilon is required and must be a number. */ Quaternion.equalsEpsilon = function(left, right, epsilon) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return (left === right) || ((defined(left)) && diff --git a/Source/Renderer/Context.js b/Source/Renderer/Context.js index 5129c444b11f..530c5f471e43 100644 --- a/Source/Renderer/Context.js +++ b/Source/Renderer/Context.js @@ -182,11 +182,11 @@ define([ throw new RuntimeError('The browser does not support WebGL. Visit http://get.webgl.org.'); } - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(canvas)) { throw new DeveloperError('canvas is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); this._canvas = canvas; @@ -1072,12 +1072,12 @@ define([ } else if (typeof typedArrayOrSizeInBytes === 'object' && typeof typedArrayOrSizeInBytes.byteLength === 'number') { sizeInBytes = typedArrayOrSizeInBytes.byteLength; } else { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); throw new DeveloperError('typedArrayOrSizeInBytes must be either a typed array or a number.'); - //>>excludeEnd('debug'); + //>>includeEnd('debug'); } - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (sizeInBytes <= 0) { throw new DeveloperError('typedArrayOrSizeInBytes must be greater than zero.'); } @@ -1085,7 +1085,7 @@ define([ if (!BufferUsage.validate(usage)) { throw new DeveloperError('usage is invalid.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var buffer = gl.createBuffer(); gl.bindBuffer(bufferTarget, buffer); @@ -1174,11 +1174,11 @@ define([ * BufferUsage.STATIC_DRAW, IndexDatatype.UNSIGNED_SHORT) */ Context.prototype.createIndexBuffer = function(typedArrayOrSizeInBytes, usage, indexDatatype) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!IndexDatatype.validate(indexDatatype)) { throw new DeveloperError('Invalid indexDatatype.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if ((indexDatatype.value === IndexDatatype.UNSIGNED_INT.value) && !this.getElementIndexUint()) { throw new RuntimeError('IndexDatatype.UNSIGNED_INT requires OES_element_index_uint, which is not supported on this system.'); @@ -1330,7 +1330,7 @@ define([ var pixelFormat = defaultValue(description.pixelFormat, PixelFormat.RGBA); var pixelDatatype = defaultValue(description.pixelDatatype, PixelDatatype.UNSIGNED_BYTE); - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(width) || !defined(height)) { throw new DeveloperError('description requires a source field to create an initialized texture or width and height fields to create a blank texture.'); } @@ -1367,18 +1367,18 @@ define([ if ((pixelFormat === PixelFormat.DEPTH_STENCIL) && (pixelDatatype !== PixelDatatype.UNSIGNED_INT_24_8_WEBGL)) { throw new DeveloperError('When description.pixelFormat is DEPTH_STENCIL, description.pixelDatatype must be UNSIGNED_INT_24_8_WEBGL.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if ((pixelDatatype === PixelDatatype.FLOAT) && !this.getFloatingPointTexture()) { throw new RuntimeError('When description.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.'); } if (PixelFormat.isDepthFormat(pixelFormat)) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (defined(source)) { throw new DeveloperError('When description.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, source cannot be provided.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if (!this.getDepthTexture()) { throw new RuntimeError('When description.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, this WebGL implementation must support WEBGL_depth_texture. Check getDepthTexture().'); @@ -1455,7 +1455,7 @@ define([ width = defaultValue(width, gl.drawingBufferWidth); height = defaultValue(height, gl.drawingBufferHeight); - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!PixelFormat.validate(pixelFormat)) { throw new DeveloperError('Invalid pixelFormat.'); } @@ -1479,7 +1479,7 @@ define([ if (framebufferYOffset + height > gl.drawingBufferHeight) { throw new DeveloperError('framebufferYOffset + height must be less than or equal to drawingBufferHeight.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var textureTarget = gl.TEXTURE_2D; var texture = gl.createTexture(); @@ -1547,22 +1547,22 @@ define([ if (defined(source)) { var faces = [source.positiveX, source.negativeX, source.positiveY, source.negativeY, source.positiveZ, source.negativeZ]; - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!faces[0] || !faces[1] || !faces[2] || !faces[3] || !faces[4] || !faces[5]) { throw new DeveloperError('description.source requires positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ faces.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); width = faces[0].width; height = faces[0].height; - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); for ( var i = 1; i < 6; ++i) { if ((Number(faces[i].width) !== width) || (Number(faces[i].height) !== height)) { throw new DeveloperError('Each face in description.source must have the same width and height.'); } } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); } else { width = description.width; height = description.height; @@ -1572,7 +1572,7 @@ define([ var pixelFormat = defaultValue(description.pixelFormat, PixelFormat.RGBA); var pixelDatatype = defaultValue(description.pixelDatatype, PixelDatatype.UNSIGNED_BYTE); - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(width) || !defined(height)) { throw new DeveloperError('description requires a source field to create an initialized cube map or width and height fields to create a blank cube map.'); } @@ -1600,7 +1600,7 @@ define([ if (!PixelDatatype.validate(pixelDatatype)) { throw new DeveloperError('Invalid description.pixelDatatype.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); if ((pixelDatatype === PixelDatatype.FLOAT) && !this.getFloatingPointTexture()) { throw new RuntimeError('When description.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.'); @@ -1732,7 +1732,7 @@ define([ var width = defined(description.width) ? description.width : gl.drawingBufferWidth; var height = defined(description.height) ? description.height : gl.drawingBufferHeight; - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!RenderbufferFormat.validate(format)) { throw new DeveloperError('Invalid format.'); } @@ -1752,7 +1752,7 @@ define([ if (height > this.getMaximumRenderbufferSize()) { throw new DeveloperError('Height must be less than or equal to the maximum renderbuffer size (' + this.getMaximumRenderbufferSize() + '). Check getMaximumRenderbufferSize().'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return new Renderbuffer(gl, format, width, height); }; @@ -1929,7 +1929,7 @@ define([ maximumAnisotropy : (defined(sampler.maximumAnisotropy)) ? sampler.maximumAnisotropy : 1.0 }; - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!TextureWrap.validate(s.wrapS)) { throw new DeveloperError('Invalid sampler.wrapS.'); } @@ -1949,7 +1949,7 @@ define([ if (s.maximumAnisotropy < 1.0) { throw new DeveloperError('sampler.maximumAnisotropy must be greater than or equal to one.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return s; }; @@ -2061,13 +2061,13 @@ define([ function beginDraw(context, framebuffer, drawCommand, passState) { var rs = defined(drawCommand.renderState) ? drawCommand.renderState : context._defaultRenderState; - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (defined(framebuffer) && rs.depthTest) { if (rs.depthTest.enabled && !framebuffer.hasDepthAttachment()) { throw new DeveloperError('The depth test can not be enabled (drawCommand.renderState.depthTest.enabled) because the framebuffer (drawCommand.framebuffer) does not have a depth or depth-stencil renderbuffer.'); } } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); /////////////////////////////////////////////////////////////////////// @@ -2089,7 +2089,7 @@ define([ var offset = drawCommand.offset; var count = drawCommand.count; - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!PrimitiveType.validate(primitiveType)) { throw new DeveloperError('drawCommand.primitiveType is required and must be valid.'); } @@ -2105,7 +2105,7 @@ define([ if (count < 0) { throw new DeveloperError('drawCommand.count must be omitted or greater than or equal to zero.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); context._us.setModel(defaultValue(drawCommand.modelMatrix, Matrix4.IDENTITY)); drawCommand.shaderProgram._setUniforms(drawCommand.uniformMap, context._us, context._validateSP); @@ -2180,7 +2180,7 @@ define([ * @see Context#createRenderState */ Context.prototype.draw = function(drawCommand, passState) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(drawCommand)) { throw new DeveloperError('drawCommand is required.'); } @@ -2188,7 +2188,7 @@ define([ if (!defined(drawCommand.shaderProgram)) { throw new DeveloperError('drawCommand.shaderProgram is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); passState = defaultValue(passState, this._defaultPassState); // The command's framebuffer takes presidence over the pass' framebuffer, e.g., for off-screen rendering. @@ -2234,7 +2234,7 @@ define([ var height = readState.height || gl.drawingBufferHeight; var framebuffer = readState.framebuffer || null; - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (width <= 0) { throw new DeveloperError('readState.width must be greater than zero.'); } @@ -2242,7 +2242,7 @@ define([ if (height <= 0) { throw new DeveloperError('readState.height must be greater than zero.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); var pixels = new Uint8Array(4 * width * height); @@ -2564,11 +2564,11 @@ define([ * @see Context#createPickId */ Context.prototype.getObjectByPickColor = function(pickColor) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(pickColor)) { throw new DeveloperError('pickColor is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); return this._pickObjects[pickColor.toRgba()]; }; @@ -2607,11 +2607,11 @@ define([ * }); */ Context.prototype.createPickId = function(object) { - //>>excludeStart('debug', !pragmas.debug); + //>>includeStart('debug', pragmas.debug); if (!defined(object)) { throw new DeveloperError('object is required.'); } - //>>excludeEnd('debug'); + //>>includeEnd('debug'); // the increment and assignment have to be separate statements to // actually detect overflow in the Uint32 value diff --git a/Tools/build.js b/Tools/build.js index 81ddd043af6e..dce0d2a0843e 100644 --- a/Tools/build.js +++ b/Tools/build.js @@ -3,6 +3,6 @@ useStrict : true, optimizeCss : 'standard', pragmas : { - debug : true + debug : false } }) \ No newline at end of file From 4adde0e970a3daed74993a9c7994ab81b3d52290 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 14 Nov 2013 19:24:25 -0500 Subject: [PATCH 09/33] Set default build option to be debug. Fix two unclosed debug regions. --- Source/Core/Matrix2.js | 2 +- Source/Core/Matrix4.js | 2 +- Tools/build.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/Matrix2.js b/Source/Core/Matrix2.js index a2c50624c5ef..12f9fc6110d7 100644 --- a/Source/Core/Matrix2.js +++ b/Source/Core/Matrix2.js @@ -570,7 +570,7 @@ define([ if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } - //excludeEnd('debug'); + //>>includeEnd('debug'); var column0Row0 = matrix[0]; var column0Row1 = matrix[2]; diff --git a/Source/Core/Matrix4.js b/Source/Core/Matrix4.js index 1adffc305b0e..22071194ed2c 100644 --- a/Source/Core/Matrix4.js +++ b/Source/Core/Matrix4.js @@ -1847,7 +1847,7 @@ define([ if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number'); } - //excludeEnd('debug'); + //>>includeEnd('debug'); return (left === right) || (defined(left) && diff --git a/Tools/build.js b/Tools/build.js index dce0d2a0843e..81ddd043af6e 100644 --- a/Tools/build.js +++ b/Tools/build.js @@ -3,6 +3,6 @@ useStrict : true, optimizeCss : 'standard', pragmas : { - debug : false + debug : true } }) \ No newline at end of file From c7e550a3638a28115f994ad81a1dba8829b8610a Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 14 Nov 2013 20:29:49 -0500 Subject: [PATCH 10/33] Add targets to create preprocessed, combined (and minified) script. --- build.xml | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 1facd11ed972..0bec2d1f285c 100644 --- a/build.xml +++ b/build.xml @@ -21,7 +21,11 @@ - + + + + + @@ -46,6 +50,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -316,6 +345,7 @@ + From b8ac66c34ffbf5990377a16bb9be2da7cf4188e9 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 14 Nov 2013 20:55:21 -0500 Subject: [PATCH 11/33] Fix formatting. --- build.xml | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/build.xml b/build.xml index 0bec2d1f285c..84972b8b09bb 100644 --- a/build.xml +++ b/build.xml @@ -20,12 +20,12 @@ - + - + - + @@ -50,31 +50,31 @@ - + - - - - - - - - - - - - - + + + + + + + + + + + + + - + - - - - - - + + + + + + From 3ee361a29c15878e7a470d53d18caf8467ad7ed0 Mon Sep 17 00:00:00 2001 From: Patrick Cozzi Date: Fri, 15 Nov 2013 07:51:08 -0500 Subject: [PATCH 12/33] Added more pragma.debugs --- Source/Core/BoundingSphere.js | 18 ++++++++++++++++++ Source/Core/Math.js | 11 +++++++++++ Source/Core/Transforms.js | 12 ++++++++++++ Source/Renderer/Context.js | 2 -- Source/Scene/PerspectiveFrustum.js | 4 ++++ Source/Scene/PerspectiveOffCenterFrustum.js | 10 ++++++++++ 6 files changed, 55 insertions(+), 2 deletions(-) diff --git a/Source/Core/BoundingSphere.js b/Source/Core/BoundingSphere.js index 9d27ef114d99..714fa16ffa9c 100644 --- a/Source/Core/BoundingSphere.js +++ b/Source/Core/BoundingSphere.js @@ -352,9 +352,11 @@ define([ stride = defaultValue(stride, 3); + //>>includeStart('debug', pragmas.debug); if (stride < 3) { throw new DeveloperError('stride must be 3 or greater.'); } + //>>includeEnd('debug'); var currentPos = fromPointsCurrentPos; currentPos.x = positions[0] + center.x; @@ -506,9 +508,11 @@ define([ * var sphere = BoundingSphere.fromCornerPoints(new Cartesian3(-0.5, -0.5, -0.5), new Cartesian3(0.5, 0.5, 0.5)); */ BoundingSphere.fromCornerPoints = function(corner, oppositeCorner, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(corner) || !defined(oppositeCorner)) { throw new DeveloperError('corner and oppositeCorner are required.'); } + //>>includeEnd('debug'); if (!defined(result)) { result = new BoundingSphere(); @@ -537,9 +541,11 @@ define([ * var boundingSphere = BoundingSphere.fromEllipsoid(ellipsoid); */ BoundingSphere.fromEllipsoid = function(ellipsoid, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(ellipsoid)) { throw new DeveloperError('ellipsoid is required.'); } + //>>includeEnd('debug'); if (!defined(result)) { result = new BoundingSphere(); @@ -587,6 +593,7 @@ define([ * @exception {DeveloperError} right is required. */ BoundingSphere.union = function(left, right, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required.'); } @@ -594,6 +601,7 @@ define([ if (!defined(right)) { throw new DeveloperError('right is required.'); } + //>>includeEnd('debug'); if (!defined(result)) { result = new BoundingSphere(); @@ -628,6 +636,7 @@ define([ * @exception {DeveloperError} point is required. */ BoundingSphere.expand = function(sphere, point, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(sphere)) { throw new DeveloperError('sphere is required.'); } @@ -635,6 +644,7 @@ define([ if (!defined(point)) { throw new DeveloperError('point is required.'); } + //>>includeEnd('debug'); result = BoundingSphere.clone(sphere, result); @@ -662,6 +672,7 @@ define([ * @exception {DeveloperError} plane is required. */ BoundingSphere.intersect = function(sphere, plane) { + //>>includeStart('debug', pragmas.debug); if (!defined(sphere)) { throw new DeveloperError('sphere is required.'); } @@ -669,6 +680,7 @@ define([ if (!defined(plane)) { throw new DeveloperError('plane is required.'); } + //>>includeEnd('debug'); var center = sphere.center; var radius = sphere.radius; @@ -699,6 +711,7 @@ define([ * @exception {DeveloperError} transform is required. */ BoundingSphere.transform = function(sphere, transform, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(sphere)) { throw new DeveloperError('sphere is required.'); } @@ -706,6 +719,7 @@ define([ if (!defined(transform)) { throw new DeveloperError('transform is required.'); } + //>>includeEnd('debug'); if (!defined(result)) { result = new BoundingSphere(); @@ -741,6 +755,7 @@ define([ * @exception {DeveloperError} direction is required. */ BoundingSphere.getPlaneDistances = function(sphere, position, direction, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(sphere)) { throw new DeveloperError('sphere is required.'); } @@ -752,6 +767,7 @@ define([ if (!defined(direction)) { throw new DeveloperError('direction is required.'); } + //>>includeEnd('debug'); if (!defined(result)) { result = new Interval(); @@ -789,9 +805,11 @@ define([ * @exception {DeveloperError} sphere is required. */ BoundingSphere.projectTo2D = function(sphere, projection, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(sphere)) { throw new DeveloperError('sphere is required.'); } + //>>includeEnd('debug'); projection = defaultValue(projection, projectTo2DProjection); diff --git a/Source/Core/Math.js b/Source/Core/Math.js index 4248a829716a..df8b784e7c87 100644 --- a/Source/Core/Math.js +++ b/Source/Core/Math.js @@ -486,9 +486,11 @@ define([ * @exception {DeveloperError} A number greater than or equal to 0 is required. */ CesiumMath.factorial = function(n) { + //>>includeStart('debug', pragmas.debug); if (typeof n !== 'number' || n < 0) { throw new DeveloperError('A number greater than or equal to 0 is required.'); } + //>>includeEnd('debug'); var length = factorials.length; if (n >= length) { @@ -520,9 +522,11 @@ define([ CesiumMath.incrementWrap = function(n, maximumValue, minimumValue) { minimumValue = defaultValue(minimumValue, 0.0); + //>>includeStart('debug', pragmas.debug); if (maximumValue <= minimumValue) { throw new DeveloperError('Maximum value must be greater than minimum value.'); } + //>>includeEnd('debug'); ++n; if (n > maximumValue) { @@ -547,9 +551,11 @@ define([ * var f = CesiumMath.isPowerOfTwo(20); // false */ CesiumMath.isPowerOfTwo = function(n) { + //>>includeStart('debug', pragmas.debug); if (typeof n !== 'number' || n < 0) { throw new DeveloperError('A number greater than or equal to 0 is required.'); } + //>>includeEnd('debug'); return (n !== 0) && ((n & (n - 1)) === 0); }; @@ -570,9 +576,11 @@ define([ * var m = CesiumMath.nextPowerOfTwo(32); // 32 */ CesiumMath.nextPowerOfTwo = function(n) { + //>>includeStart('debug', pragmas.debug); if (typeof n !== 'number' || n < 0) { throw new DeveloperError('A number greater than or equal to 0 is required.'); } + //>>includeEnd('debug'); // From http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 --n; @@ -613,9 +621,12 @@ define([ * @exception {DeveloperError} seed is required. */ CesiumMath.setRandomNumberSeed = function(seed) { + //>>includeStart('debug', pragmas.debug); if (!defined(seed)) { throw new DeveloperError('seed is required.'); } + //>>includeEnd('debug'); + randomNumberGenerator = new MersenneTwister(seed); }; diff --git a/Source/Core/Transforms.js b/Source/Core/Transforms.js index cd299d143398..dd067d92de86 100644 --- a/Source/Core/Transforms.js +++ b/Source/Core/Transforms.js @@ -72,9 +72,11 @@ define([ * var transform = Transforms.eastNorthUpToFixedFrame(center); */ Transforms.eastNorthUpToFixedFrame = function(origin, ellipsoid, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(origin)) { throw new DeveloperError('origin is required.'); } + //>>includeEnd('debug'); // If x and y are zero, assume origin is at a pole, which is a special case. if (CesiumMath.equalsEpsilon(origin.x, 0.0, CesiumMath.EPSILON14) && @@ -176,9 +178,11 @@ define([ * var transform = Transforms.northEastDownToFixedFrame(center); */ Transforms.northEastDownToFixedFrame = function(origin, ellipsoid, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(origin)) { throw new DeveloperError('origin is required.'); } + //>>includeEnd('debug'); if (CesiumMath.equalsEpsilon(origin.x, 0.0, CesiumMath.EPSILON14) && CesiumMath.equalsEpsilon(origin.y, 0.0, CesiumMath.EPSILON14)) { @@ -282,9 +286,11 @@ define([ * updateAndRender(); */ Transforms.computeTemeToPseudoFixedMatrix = function (date, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(date)) { throw new DeveloperError('date is required.'); } + //>>includeEnd('debug'); // GMST is actually computed using UT1. We're using UTC as an approximation of UT1. // We do not want to use the function like convertTaiToUtc in JulianDate because @@ -422,9 +428,11 @@ define([ * updateAndRender(); */ Transforms.computeIcrfToFixedMatrix = function(date, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(date)) { throw new DeveloperError('date is required.'); } + //>>includeEnd('debug'); var fixedToIcrfMtx = Transforms.computeFixedToIcrfMatrix(date, result); if (!defined(fixedToIcrfMtx)) { @@ -468,9 +476,11 @@ define([ * } */ Transforms.computeFixedToIcrfMatrix = function(date, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(date)) { throw new DeveloperError('date is required.'); } + //>>includeEnd('debug'); // Compute pole wander var eop = Transforms.earthOrientationParameters.compute(date, eopScratch); @@ -588,6 +598,7 @@ define([ * @see czm_viewportTransformation */ Transforms.pointToWindowCoordinates = function (modelViewProjectionMatrix, viewportTransformation, point, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(modelViewProjectionMatrix)) { throw new DeveloperError('modelViewProjectionMatrix is required.'); } @@ -599,6 +610,7 @@ define([ if (!defined(point)) { throw new DeveloperError('point is required.'); } + //>>includeEnd('debug'); var tmp = pointToWindowCoordinatesTemp; diff --git a/Source/Renderer/Context.js b/Source/Renderer/Context.js index 530c5f471e43..cc421a17341f 100644 --- a/Source/Renderer/Context.js +++ b/Source/Renderer/Context.js @@ -2069,8 +2069,6 @@ define([ } //>>includeEnd('debug'); - /////////////////////////////////////////////////////////////////////// - if (defined(framebuffer)) { framebuffer._bind(); validateFramebuffer(context, framebuffer); diff --git a/Source/Scene/PerspectiveFrustum.js b/Source/Scene/PerspectiveFrustum.js index 96c1a1226aec..64c5877fb00b 100644 --- a/Source/Scene/PerspectiveFrustum.js +++ b/Source/Scene/PerspectiveFrustum.js @@ -66,14 +66,17 @@ define([ }; function update(frustum) { + //>>includeStart('debug', pragmas.debug); if (!defined(frustum.fovy) || !defined(frustum.aspectRatio) || !defined(frustum.near) || !defined(frustum.far)) { throw new DeveloperError('fovy, aspectRatio, near, or far parameters are not set.'); } + //>>includeEnd('debug'); var f = frustum._offCenterFrustum; if (frustum.fovy !== frustum._fovy || frustum.aspectRatio !== frustum._aspectRatio || frustum.near !== frustum._near || frustum.far !== frustum._far) { + //>>includeStart('debug', pragmas.debug); if (frustum.fovy < 0 || frustum.fovy >= Math.PI) { throw new DeveloperError('fovy must be in the range [0, PI).'); } @@ -85,6 +88,7 @@ define([ if (frustum.near < 0 || frustum.near > frustum.far) { throw new DeveloperError('near must be greater than zero and less than far.'); } + //>>includeEnd('debug'); frustum._fovy = frustum.fovy; frustum._aspectRatio = frustum.aspectRatio; diff --git a/Source/Scene/PerspectiveOffCenterFrustum.js b/Source/Scene/PerspectiveOffCenterFrustum.js index 39aa0dc7cad6..841807c003cb 100644 --- a/Source/Scene/PerspectiveOffCenterFrustum.js +++ b/Source/Scene/PerspectiveOffCenterFrustum.js @@ -96,11 +96,13 @@ define([ }; function update(frustum) { + //>>includeStart('debug', pragmas.debug); if (!defined(frustum.right) || !defined(frustum.left) || !defined(frustum.top) || !defined(frustum.bottom) || !defined(frustum.near) || !defined(frustum.far)) { throw new DeveloperError('right, left, top, bottom, near, or far parameters are not set.'); } + //>>includeEnd('debug'); var t = frustum.top; var b = frustum.bottom; @@ -113,9 +115,11 @@ define([ l !== frustum._left || r !== frustum._right || n !== frustum._near || f !== frustum._far) { + //>>includeStart('debug', pragmas.debug); if (frustum.near <= 0 || frustum.near > frustum.far) { throw new DeveloperError('near must be greater than zero and less than far.'); } + //>>includeEnd('debug'); frustum._left = l; frustum._right = r; @@ -183,6 +187,7 @@ define([ * var intersect = cullingVolume.getVisibility(boundingVolume); */ PerspectiveOffCenterFrustum.prototype.computeCullingVolume = function(position, direction, up) { + //>>includeStart('debug', pragmas.debug); if (!defined(position)) { throw new DeveloperError('position is required.'); } @@ -194,6 +199,7 @@ define([ if (!defined(up)) { throw new DeveloperError('up is required.'); } + //>>includeEnd('debug'); var planes = this._cullingVolume.planes; @@ -337,13 +343,16 @@ define([ PerspectiveOffCenterFrustum.prototype.getPixelSize = function(drawingBufferDimensions, distance) { update(this); + //>>includeStart('debug', pragmas.debug); if (!defined(drawingBufferDimensions)) { throw new DeveloperError('drawingBufferDimensions is required.'); } + //>>includeEnd('debug'); var width = drawingBufferDimensions.x; var height = drawingBufferDimensions.y; + //>>includeStart('debug', pragmas.debug); if (width <= 0) { throw new DeveloperError('drawingBufferDimensions.x must be greater than zero.'); } @@ -351,6 +360,7 @@ define([ if (height <= 0) { throw new DeveloperError('drawingBufferDimensions.y must be greater than zero.'); } + //>>includeEnd('debug'); distance = defaultValue(distance, this.near); From 83f5bc99043f2fdc6f3f909a44801166d9e18f0d Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Wed, 20 Nov 2013 22:11:48 -0500 Subject: [PATCH 13/33] Generate AMD stubs to combined/minified Cesium. --- Tools/buildTasks/generateStubs.js | 22 ++++++++++++++++++++++ build.xml | 11 +++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Tools/buildTasks/generateStubs.js diff --git a/Tools/buildTasks/generateStubs.js b/Tools/buildTasks/generateStubs.js new file mode 100644 index 000000000000..5f0668fdb6f1 --- /dev/null +++ b/Tools/buildTasks/generateStubs.js @@ -0,0 +1,22 @@ +/*global importClass,project,attributes,elements,java,Packages*/ +importClass(Packages.org.mozilla.javascript.tools.shell.Main); /*global Main*/ +Main.exec(['-e', '{}']); +var load = Main.global.load; + +load(project.getProperty('tasksDirectory') + '/shared.js'); /*global forEachFile,readFileContents,writeFileContents,File,FileReader,FileWriter,FileUtils*/ + +var contents = ''; + +forEachFile('sourcefiles', function(relativePath, file) { + "use strict"; + + var moduleName = relativePath.replace('\\', '/'); + moduleName = moduleName.substring(0, moduleName.lastIndexOf('.')); + var name = moduleName.substring(moduleName.lastIndexOf('/') + 1); + + contents += 'define(\'' + moduleName + '\', [], function() {\n' + + ' return Cesium.' + name + ';\n' + + '});\n\n'; +}); + +writeFileContents(attributes.get('output'), contents); diff --git a/build.xml b/build.xml index 84972b8b09bb..7bc86ae080a4 100644 --- a/build.xml +++ b/build.xml @@ -173,6 +173,7 @@ + @@ -233,6 +234,11 @@ + + + + + @@ -316,6 +322,11 @@ + + + + + From cb10e2d3181be134f76a50196da339bef9697c3b Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 21 Nov 2013 10:10:31 -0500 Subject: [PATCH 14/33] Run tests for combined/minified Cesium (mostly working). --- Specs/SpecRunner.js | 127 ++++++++++++++++++++---------- Tools/buildTasks/generateStubs.js | 17 +++- build.xml | 15 +++- 3 files changed, 114 insertions(+), 45 deletions(-) diff --git a/Specs/SpecRunner.js b/Specs/SpecRunner.js index 705e6260cfaa..e0baed101f00 100644 --- a/Specs/SpecRunner.js +++ b/Specs/SpecRunner.js @@ -169,16 +169,55 @@ var afterAll; var readyToCreateTests = false; var createTests; - require.config({ - baseUrl : getQueryParameter('baseUrl') || '../Source', - paths : { - 'Specs' : '../Specs' - }, - waitSeconds : 30 - }); + var combined = getQueryParameter('combined'); + var minified = getQueryParameter('minified'); + var loadTests = true; + + // set up require for AMD, combined or minified and + // start loading all of Cesium early, so it's all available for code coverage calculations. + if (combined || minified) { + require.config({ + baseUrl : getQueryParameter('baseUrl') || '../Build', + waitSeconds : 30 + }); - //start loading all of Cesium early, so it's all available for code coverage calculations. - require(['Cesium']); + var builtCesium = (minified) ? 'Cesium/Cesium' : 'CesiumUnminified/Cesium'; + require([builtCesium, 'Stubs/Cesium', 'Stubs/map'], function(BuiltCesium, StubCesium, map) { + var paths = map; + paths['Specs'] = '../Specs'; + paths['ThirdParty'] = '../Source/ThirdParty'; + paths['Workers'] = '../Source/Workers'; + + require.config({ + baseUrl : getQueryParameter('baseUrl') || '../Build', + /* + paths : { + 'Specs' : '../Specs', + 'ThirdParty' : '../Source/ThirdParty', + 'Workers' : '../Source/Workers' // TODO need to fix this + }, + map : map, + */ + + paths : paths, + waitSeconds : 30 + }); + + requireTests(); + }); + + loadTests= false; + } else { + require.config({ + baseUrl : getQueryParameter('baseUrl') || '../Source', + paths : { + 'Specs' : '../Specs' + }, + waitSeconds : 30 + }); + + require(['Cesium']); + } defineSuite = function(deps, name, suite, categories) { if (typeof suite === 'object' || typeof suite === 'string') { @@ -233,39 +272,45 @@ var afterAll; }); } - //specs is an array defined by SpecList.js - require([ - 'Specs/addDefaultMatchers', - 'Specs/equalsMethodEqualityTester' - ].concat(specs), function( - addDefaultMatchers, - equalsMethodEqualityTester) { - var env = jasmine.getEnv(); - - env.beforeEach(addDefaultMatchers); - env.addEqualityTester(equalsMethodEqualityTester); - - createTests = function() { - var reporter = new jasmine.HtmlReporter(); - var isSuiteFocused = jasmine.HtmlReporterHelpers.isSuiteFocused; - var suites = jasmine.getEnv().currentRunner().suites(); - - for ( var i = 1, insertPoint = 0, len = suites.length; i < len; i++) { - var suite = suites[i]; - if (isSuiteFocused(suite)) { - suites.splice(i, 1); - suites.splice(insertPoint, 0, suite); - insertPoint++; - i--; + function requireTests() { + //specs is an array defined by SpecList.js + require([ + 'Specs/addDefaultMatchers', + 'Specs/equalsMethodEqualityTester' + ].concat(specs), function( + addDefaultMatchers, + equalsMethodEqualityTester) { + var env = jasmine.getEnv(); + + env.beforeEach(addDefaultMatchers); + env.addEqualityTester(equalsMethodEqualityTester); + + createTests = function() { + var reporter = new jasmine.HtmlReporter(); + var isSuiteFocused = jasmine.HtmlReporterHelpers.isSuiteFocused; + var suites = jasmine.getEnv().currentRunner().suites(); + + for ( var i = 1, insertPoint = 0, len = suites.length; i < len; i++) { + var suite = suites[i]; + if (isSuiteFocused(suite)) { + suites.splice(i, 1); + suites.splice(insertPoint, 0, suite); + insertPoint++; + i--; + } } - } - env.addReporter(reporter); - env.specFilter = reporter.specFilter; - env.execute(); - }; + env.addReporter(reporter); + env.specFilter = reporter.specFilter; + env.execute(); + }; + + readyToCreateTests = true; + createTestsIfReady(); + }); + } - readyToCreateTests = true; - createTestsIfReady(); - }); + if (loadTests) { + requireTests(); + } }()); \ No newline at end of file diff --git a/Tools/buildTasks/generateStubs.js b/Tools/buildTasks/generateStubs.js index 5f0668fdb6f1..2fe1eca2c1b7 100644 --- a/Tools/buildTasks/generateStubs.js +++ b/Tools/buildTasks/generateStubs.js @@ -6,6 +6,11 @@ var load = Main.global.load; load(project.getProperty('tasksDirectory') + '/shared.js'); /*global forEachFile,readFileContents,writeFileContents,File,FileReader,FileWriter,FileUtils*/ var contents = ''; +var map = '/*global define*/\n' + + 'define(function() {\n' + + ' return {\n' + + ' \'*\' : {\n'; +var insertComma = false; forEachFile('sourcefiles', function(relativePath, file) { "use strict"; @@ -17,6 +22,16 @@ forEachFile('sourcefiles', function(relativePath, file) { contents += 'define(\'' + moduleName + '\', [], function() {\n' + ' return Cesium.' + name + ';\n' + '});\n\n'; + map += (insertComma ? ',\n' : '') + ' \'' + moduleName + '\' : \'Stubs/Cesium\''; + + if (!insertComma) { + insertComma = true; + } }); -writeFileContents(attributes.get('output'), contents); +map += '\n }\n' + + ' }\n' + + '});'; + +writeFileContents(attributes.get('stuboutput'), contents); +writeFileContents(attributes.get('mapoutput'), map); diff --git a/build.xml b/build.xml index 7bc86ae080a4..1e567e3e29af 100644 --- a/build.xml +++ b/build.xml @@ -194,6 +194,14 @@ + + + + + + + + @@ -235,7 +243,8 @@ - + + @@ -323,8 +332,8 @@ - - + + From 93a311d07629ee8c19ba0bdb8d74e393c3fd0576 Mon Sep 17 00:00:00 2001 From: Scott Hunter Date: Thu, 21 Nov 2013 15:49:24 -0500 Subject: [PATCH 15/33] Fix the stub process for running specs. * Cesium.js now exports modules using the actual module name instead of rewriting the names to be identifiers. * Stubs/map (misnamed) now provides path mappings. * Cesium.js includes createTaskProcessorWorker because Specs need it. * Use the require.js shim feature to require in the combined Cesium. --- Specs/SpecRunner.js | 38 +++++++++++++----------------- Tools/buildTasks/createCesiumJs.js | 6 ++--- Tools/buildTasks/generateStubs.js | 36 ++++++++++++++-------------- build.xml | 32 +++++++++++++------------ 4 files changed, 55 insertions(+), 57 deletions(-) diff --git a/Specs/SpecRunner.js b/Specs/SpecRunner.js index e0baed101f00..2eb6ca0d7bd1 100644 --- a/Specs/SpecRunner.js +++ b/Specs/SpecRunner.js @@ -173,34 +173,31 @@ var afterAll; var minified = getQueryParameter('minified'); var loadTests = true; + require.config({ + waitSeconds : 30 + }); + // set up require for AMD, combined or minified and // start loading all of Cesium early, so it's all available for code coverage calculations. if (combined || minified) { require.config({ - baseUrl : getQueryParameter('baseUrl') || '../Build', - waitSeconds : 30 + baseUrl : getQueryParameter('baseUrl') || (minified ? '../Build/Cesium' : '../Build/CesiumUnminified'), + paths : { + 'Stubs' : '../Stubs' + }, + shim : { + 'Cesium' : { + exports : 'Cesium' + } + } }); - var builtCesium = (minified) ? 'Cesium/Cesium' : 'CesiumUnminified/Cesium'; - require([builtCesium, 'Stubs/Cesium', 'Stubs/map'], function(BuiltCesium, StubCesium, map) { + require(['Cesium', 'Stubs/map'], function(BuiltCesium, map) { var paths = map; - paths['Specs'] = '../Specs'; - paths['ThirdParty'] = '../Source/ThirdParty'; - paths['Workers'] = '../Source/Workers'; + paths['Specs'] = '../../Specs'; require.config({ - baseUrl : getQueryParameter('baseUrl') || '../Build', - /* - paths : { - 'Specs' : '../Specs', - 'ThirdParty' : '../Source/ThirdParty', - 'Workers' : '../Source/Workers' // TODO need to fix this - }, - map : map, - */ - - paths : paths, - waitSeconds : 30 + paths : paths }); requireTests(); @@ -212,8 +209,7 @@ var afterAll; baseUrl : getQueryParameter('baseUrl') || '../Source', paths : { 'Specs' : '../Specs' - }, - waitSeconds : 30 + } }); require(['Cesium']); diff --git a/Tools/buildTasks/createCesiumJs.js b/Tools/buildTasks/createCesiumJs.js index c9f78822494d..91b2890f07a2 100644 --- a/Tools/buildTasks/createCesiumJs.js +++ b/Tools/buildTasks/createCesiumJs.js @@ -19,16 +19,16 @@ forEachFile('sourcefiles', function(relativePath, file) { var baseName = file.getName(); var assignmentName = baseName.substring(0, baseName.lastIndexOf('.')); - assignmentName = String(assignmentName).replace(nonIdentifierRegexp, '_'); + assignmentName = "['" + String(assignmentName) + "']"; if (/Shaders\//.test(moduleId)) { - assignmentName = '_shaders.' + assignmentName; + assignmentName = '._shaders' + assignmentName; } var parameterName = String(moduleId).replace(nonIdentifierRegexp, '_'); moduleIds.push("'./" + moduleId + "'"); parameters.push(parameterName); - assignments.push('Cesium.' + assignmentName + ' = ' + parameterName + ';'); + assignments.push('Cesium' + assignmentName + ' = ' + parameterName + ';'); }); var contents = '\ diff --git a/Tools/buildTasks/generateStubs.js b/Tools/buildTasks/generateStubs.js index 2fe1eca2c1b7..d2cd3a2a2925 100644 --- a/Tools/buildTasks/generateStubs.js +++ b/Tools/buildTasks/generateStubs.js @@ -6,32 +6,32 @@ var load = Main.global.load; load(project.getProperty('tasksDirectory') + '/shared.js'); /*global forEachFile,readFileContents,writeFileContents,File,FileReader,FileWriter,FileUtils*/ var contents = ''; -var map = '/*global define*/\n' + - 'define(function() {\n' + - ' return {\n' + - ' \'*\' : {\n'; -var insertComma = false; +var modulePathMappings = []; forEachFile('sourcefiles', function(relativePath, file) { "use strict"; - var moduleName = relativePath.replace('\\', '/'); - moduleName = moduleName.substring(0, moduleName.lastIndexOf('.')); - var name = moduleName.substring(moduleName.lastIndexOf('/') + 1); + var moduleId = relativePath.replace('\\', '/'); + moduleId = moduleId.substring(0, moduleId.lastIndexOf('.')); - contents += 'define(\'' + moduleName + '\', [], function() {\n' + - ' return Cesium.' + name + ';\n' + - '});\n\n'; - map += (insertComma ? ',\n' : '') + ' \'' + moduleName + '\' : \'Stubs/Cesium\''; + var baseName = file.getName(); + var propertyName = baseName.substring(0, baseName.lastIndexOf('.')); + propertyName = "['" + String(propertyName) + "']"; - if (!insertComma) { - insertComma = true; - } + contents += '\ +define(\'' + moduleId + '\', function() {\n\ + return Cesium' + propertyName + ';\n\ +});\n\n'; + + modulePathMappings.push(' \'' + moduleId + '\' : \'../Stubs/Cesium\''); }); -map += '\n }\n' + - ' }\n' + - '});'; +var map = '\ +/*global define*/\n\ +define(function() {\n\ + return {\n' + modulePathMappings.join(',\n') + '\n\ + }\n\ +});'; writeFileContents(attributes.get('stuboutput'), contents); writeFileContents(attributes.get('mapoutput'), map); diff --git a/build.xml b/build.xml index 1e567e3e29af..0ebb650f6691 100644 --- a/build.xml +++ b/build.xml @@ -181,24 +181,26 @@ - - - - - - + + + + + + + + + + + + + + - - - - - + - + - - @@ -333,7 +335,7 @@ - + From 62b0a30a65b87eb3bb7ddfedeb7d7a852d1b02d8 Mon Sep 17 00:00:00 2001 From: Scott Hunter Date: Thu, 21 Nov 2013 16:31:44 -0500 Subject: [PATCH 16/33] Fix JSHint warnings. --- Specs/SpecRunner.js | 7 +++---- Tools/buildTasks/createCesiumJs.js | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Specs/SpecRunner.js b/Specs/SpecRunner.js index 2eb6ca0d7bd1..dd470ed4597d 100644 --- a/Specs/SpecRunner.js +++ b/Specs/SpecRunner.js @@ -192,9 +192,8 @@ var afterAll; } }); - require(['Cesium', 'Stubs/map'], function(BuiltCesium, map) { - var paths = map; - paths['Specs'] = '../../Specs'; + require(['Cesium', 'Stubs/map'], function(BuiltCesium, paths) { + paths.Specs = '../../Specs'; require.config({ paths : paths @@ -203,7 +202,7 @@ var afterAll; requireTests(); }); - loadTests= false; + loadTests = false; } else { require.config({ baseUrl : getQueryParameter('baseUrl') || '../Source', diff --git a/Tools/buildTasks/createCesiumJs.js b/Tools/buildTasks/createCesiumJs.js index 91b2890f07a2..e6247d1566e8 100644 --- a/Tools/buildTasks/createCesiumJs.js +++ b/Tools/buildTasks/createCesiumJs.js @@ -35,6 +35,7 @@ var contents = '\ /*global define*/\n\ define([' + moduleIds.join(', ') + '], function(' + parameters.join(', ') + ') {\n\ "use strict";\n\ + /*jshint sub:true*/\n\ var Cesium = {\n\ _shaders : {}\n\ };\n\ From ce6826e0c53c30e39c37df8a7b8d54054de5f409 Mon Sep 17 00:00:00 2001 From: Scott Hunter Date: Thu, 21 Nov 2013 16:40:42 -0500 Subject: [PATCH 17/33] Clean up warnings in generated files. --- Tools/buildTasks/generateStubs.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Tools/buildTasks/generateStubs.js b/Tools/buildTasks/generateStubs.js index d2cd3a2a2925..4b4892e121e3 100644 --- a/Tools/buildTasks/generateStubs.js +++ b/Tools/buildTasks/generateStubs.js @@ -5,7 +5,11 @@ var load = Main.global.load; load(project.getProperty('tasksDirectory') + '/shared.js'); /*global forEachFile,readFileContents,writeFileContents,File,FileReader,FileWriter,FileUtils*/ -var contents = ''; +var contents = '\ +/*global define,Cesium*/\n\ +(function() {\n\ +"use strict";\n\ +/*jshint sub:true*/\n'; var modulePathMappings = []; forEachFile('sourcefiles', function(relativePath, file) { @@ -26,11 +30,14 @@ define(\'' + moduleId + '\', function() {\n\ modulePathMappings.push(' \'' + moduleId + '\' : \'../Stubs/Cesium\''); }); +contents += '})();'; + var map = '\ /*global define*/\n\ define(function() {\n\ + "use strict";\ return {\n' + modulePathMappings.join(',\n') + '\n\ - }\n\ + };\n\ });'; writeFileContents(attributes.get('stuboutput'), contents); From 7b2b20f440b61ad1744a0f52b4c0c56681b7c9be Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Fri, 22 Nov 2013 15:58:16 -0500 Subject: [PATCH 18/33] Rename. --- Specs/SpecRunner.js | 2 +- Tools/buildTasks/generateStubs.js | 4 ++-- build.xml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Specs/SpecRunner.js b/Specs/SpecRunner.js index dd470ed4597d..ff9ea245bca6 100644 --- a/Specs/SpecRunner.js +++ b/Specs/SpecRunner.js @@ -192,7 +192,7 @@ var afterAll; } }); - require(['Cesium', 'Stubs/map'], function(BuiltCesium, paths) { + require(['Cesium', 'Stubs/paths'], function(BuiltCesium, paths) { paths.Specs = '../../Specs'; require.config({ diff --git a/Tools/buildTasks/generateStubs.js b/Tools/buildTasks/generateStubs.js index 4b4892e121e3..629b92f44008 100644 --- a/Tools/buildTasks/generateStubs.js +++ b/Tools/buildTasks/generateStubs.js @@ -32,7 +32,7 @@ define(\'' + moduleId + '\', function() {\n\ contents += '})();'; -var map = '\ +var paths = '\ /*global define*/\n\ define(function() {\n\ "use strict";\ @@ -41,4 +41,4 @@ define(function() {\n\ });'; writeFileContents(attributes.get('stuboutput'), contents); -writeFileContents(attributes.get('mapoutput'), map); +writeFileContents(attributes.get('pathsoutput'), paths); diff --git a/build.xml b/build.xml index 0ebb650f6691..9e549d666503 100644 --- a/build.xml +++ b/build.xml @@ -246,7 +246,7 @@ - + @@ -334,7 +334,7 @@ - + From b72c7ed80fbb901c913166f29279e7d9fe333be2 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Fri, 22 Nov 2013 16:07:00 -0500 Subject: [PATCH 19/33] Update after merge. --- Source/Core/Cartesian2.js | 21 +++++++++++++-------- Source/Core/Cartesian3.js | 21 +++++++++++++-------- Source/Core/Cartesian4.js | 21 +++++++++++++-------- Source/Core/Matrix2.js | 3 +++ Source/Core/Matrix3.js | 3 +++ Source/Core/Matrix4.js | 3 +++ 6 files changed, 48 insertions(+), 24 deletions(-) diff --git a/Source/Core/Cartesian2.js b/Source/Core/Cartesian2.js index b8d6a6816cd5..36797decf063 100644 --- a/Source/Core/Cartesian2.js +++ b/Source/Core/Cartesian2.js @@ -238,16 +238,19 @@ define([ * @param {Cartesian2} [result] The object into which to store the result. * @returns {Cartesian2} A cartesian with the minimum components. * - * @exception {DeveloperError} first cartesian is missing. - * @exception {DeveloperError} second cartesian is missing. + * @exception {DeveloperError} first is required. + * @exception {DeveloperError} second is required. */ Cartesian2.getMinimumByComponent = function(first, second, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(first)) { - throw new DeveloperError('first cartesian is missing'); + throw new DeveloperError('first is required.'); } if (!defined(second)) { - throw new DeveloperError('second cartesian is missing'); + throw new DeveloperError('second is required.'); } + //>>includeEnd('debug'); + if (!defined(result)) { result = new Cartesian2(); } @@ -267,16 +270,18 @@ define([ * @param {Cartesian2} [result] The object into which to store the result. * @returns {Cartesian2} A cartesian with the maximum components. * - * @exception {DeveloperError} first cartesian is missing. - * @exception {DeveloperError} second cartesian is missing. + * @exception {DeveloperError} first is required. + * @exception {DeveloperError} second is required. */ Cartesian2.getMaximumByComponent = function(first, second, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(first)) { - throw new DeveloperError('first cartesian is missing'); + throw new DeveloperError('first is required.'); } if (!defined(second)) { - throw new DeveloperError('second cartesian is missing'); + throw new DeveloperError('second is required.'); } + //>>includeEnd('debug'); if (!defined(result)) { result = new Cartesian2(); diff --git a/Source/Core/Cartesian3.js b/Source/Core/Cartesian3.js index 8472fdeaf908..174befffd9ad 100644 --- a/Source/Core/Cartesian3.js +++ b/Source/Core/Cartesian3.js @@ -267,16 +267,19 @@ define([ * @param {Cartesian3} [result] The object into which to store the result. * @returns {Cartesian3} A cartesian with the minimum components. * - * @exception {DeveloperError} first cartesian is missing. - * @exception {DeveloperError} second cartesian is missing. + * @exception {DeveloperError} first is required. + * @exception {DeveloperError} second is required. */ Cartesian3.getMinimumByComponent = function(first, second, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(first)) { - throw new DeveloperError('first cartesian is missing'); + throw new DeveloperError('first is required.'); } if (!defined(second)) { - throw new DeveloperError('second cartesian is missing'); + throw new DeveloperError('second is required.'); } + //>>includeEnd('debug'); + if (!defined(result)) { result = new Cartesian3(); } @@ -297,16 +300,18 @@ define([ * @param {Cartesian3} [result] The object into which to store the result. * @returns {Cartesian3} A cartesian with the maximum components. * - * @exception {DeveloperError} first cartesian is missing. - * @exception {DeveloperError} second cartesian is missing. + * @exception {DeveloperError} first is required. + * @exception {DeveloperError} second is required. */ Cartesian3.getMaximumByComponent = function(first, second, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(first)) { - throw new DeveloperError('first cartesian is missing'); + throw new DeveloperError('first is required.'); } if (!defined(second)) { - throw new DeveloperError('second cartesian is missing'); + throw new DeveloperError('second is required.'); } + //>>includeEnd('debug'); if (!defined(result)) { result = new Cartesian3(); diff --git a/Source/Core/Cartesian4.js b/Source/Core/Cartesian4.js index 71d4823395fd..87d750d21b71 100644 --- a/Source/Core/Cartesian4.js +++ b/Source/Core/Cartesian4.js @@ -240,16 +240,19 @@ define([ * @param {Cartesian4} [result] The object into which to store the result. * @returns {Cartesian4} A cartesian with the minimum components. * - * @exception {DeveloperError} first cartesian is missing. - * @exception {DeveloperError} second cartesian is missing. + * @exception {DeveloperError} first is required. + * @exception {DeveloperError} second is required. */ Cartesian4.getMinimumByComponent = function(first, second, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(first)) { - throw new DeveloperError('first cartesian is missing'); + throw new DeveloperError('first is required.'); } if (!defined(second)) { - throw new DeveloperError('second cartesian is missing'); + throw new DeveloperError('second is required.'); } + //>>includeEnd('debug'); + if (!defined(result)) { result = new Cartesian4(); } @@ -271,16 +274,18 @@ define([ * @param {Cartesian4} [result] The object into which to store the result. * @returns {Cartesian4} A cartesian with the maximum components. * - * @exception {DeveloperError} first cartesian is missing. - * @exception {DeveloperError} second cartesian is missing. + * @exception {DeveloperError} first is required. + * @exception {DeveloperError} second is required. */ Cartesian4.getMaximumByComponent = function(first, second, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(first)) { - throw new DeveloperError('first cartesian is missing'); + throw new DeveloperError('first is required.'); } if (!defined(second)) { - throw new DeveloperError('second cartesian is missing'); + throw new DeveloperError('second is required.'); } + //>>includeEnd('debug'); if (!defined(result)) { result = new Cartesian4(); diff --git a/Source/Core/Matrix2.js b/Source/Core/Matrix2.js index f770599bce63..87e4e13aa19c 100644 --- a/Source/Core/Matrix2.js +++ b/Source/Core/Matrix2.js @@ -599,9 +599,12 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix2.abs = function(matrix, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } + //>>includeEnd('debug'); + if (!defined(result)) { return new Matrix2(Math.abs(matrix[0]), Math.abs(matrix[2]), Math.abs(matrix[1]), Math.abs(matrix[3])); diff --git a/Source/Core/Matrix3.js b/Source/Core/Matrix3.js index dc5aeedd3d4d..ce1859e26e70 100644 --- a/Source/Core/Matrix3.js +++ b/Source/Core/Matrix3.js @@ -1005,9 +1005,12 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix3.abs = function(matrix, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } + //>>includeEnd('debug'); + if (!defined(result)) { return new Matrix3(Math.abs(matrix[0]), Math.abs(matrix[3]), Math.abs(matrix[6]), Math.abs(matrix[1]), Math.abs(matrix[4]), Math.abs(matrix[7]), diff --git a/Source/Core/Matrix4.js b/Source/Core/Matrix4.js index 84b982db4623..bb5fac46ad65 100644 --- a/Source/Core/Matrix4.js +++ b/Source/Core/Matrix4.js @@ -1765,9 +1765,12 @@ define([ * @exception {DeveloperError} matrix is required. */ Matrix4.abs = function(matrix, result) { + //>>includeStart('debug', pragmas.debug); if (!defined(matrix)) { throw new DeveloperError('matrix is required'); } + //>>includeEnd('debug'); + if (!defined(result)) { return new Matrix4(Math.abs(matrix[0]), Math.abs(matrix[4]), Math.abs(matrix[8]), Math.abs(matrix[12]), Math.abs(matrix[1]), Math.abs(matrix[5]), Math.abs(matrix[9]), Math.abs(matrix[13]), From 64b27c2909319409a117942908cdcd1c0b328367 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 26 Nov 2013 19:51:46 -0500 Subject: [PATCH 20/33] Run tests with release version. --- Specs/Core/BoundingSphereSpec.js | 32 ++-- Specs/Core/Cartesian2Spec.js | 66 +++---- Specs/Core/Cartesian3Spec.js | 72 ++++---- Specs/Core/Cartesian4Spec.js | 62 +++---- Specs/Core/MathSpec.js | 22 +-- Specs/Core/Matrix2Spec.js | 56 +++--- Specs/Core/Matrix3Spec.js | 70 ++++---- Specs/Core/Matrix4Spec.js | 142 +++++++-------- Specs/Core/QuaternionSpec.js | 70 ++++---- Specs/Core/TransformsSpec.js | 20 +-- Specs/Renderer/ContextSpec.js | 6 +- Specs/Scene/PerspectiveFrustumSpec.js | 20 +-- .../Scene/PerspectiveOffCenterFrustumSpec.js | 18 +- Specs/SpecRunner.js | 10 +- Specs/addDefaultMatchers.js | 166 ++++++++++-------- 15 files changed, 427 insertions(+), 405 deletions(-) diff --git a/Specs/Core/BoundingSphereSpec.js b/Specs/Core/BoundingSphereSpec.js index 66acc86d575e..4f1c70e371b9 100644 --- a/Specs/Core/BoundingSphereSpec.js +++ b/Specs/Core/BoundingSphereSpec.js @@ -253,7 +253,7 @@ defineSuite([ function callWithStrideOf2() { BoundingSphere.fromVertices(getPositionsAsFlatArray(), undefined, 2); } - expect(callWithStrideOf2).toThrow(); + expect(callWithStrideOf2).toThrowDeveloperError(); }); it('fromVertices fills result parameter if specified', function() { @@ -315,13 +315,13 @@ defineSuite([ it('fromCornerPoints throws without corner', function() { expect(function() { BoundingSphere.fromCornerPoints(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromCornerPoints throws without oppositeCorner', function() { expect(function() { BoundingSphere.fromCornerPoints(Cartesian3.UNIT_X); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromEllipsoid', function() { @@ -342,7 +342,7 @@ defineSuite([ it('fromEllipsoid throws without ellipsoid', function() { expect(function() { BoundingSphere.fromEllipsoid(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('sphere on the positive side of a plane', function() { @@ -458,7 +458,7 @@ defineSuite([ it('static projectTo2D throws without sphere', function() { expect(function() { BoundingSphere.projectTo2D(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static clone returns undefined with no parameter', function() { @@ -469,73 +469,73 @@ defineSuite([ var right = new BoundingSphere(); expect(function() { BoundingSphere.union(undefined, right); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static union throws with no right parameter', function() { var left = new BoundingSphere(); expect(function() { BoundingSphere.union(left, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static expand throws without a sphere', function() { var plane = new Cartesian3(); expect(function() { BoundingSphere.expand(undefined, plane); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static expand throws without a point', function() { var sphere = new BoundingSphere(); expect(function() { BoundingSphere.expand(sphere, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static intersect throws without a sphere', function() { var plane = new Cartesian4(); expect(function() { BoundingSphere.intersect(undefined, plane); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static intersect throws without a plane', function() { var sphere = new BoundingSphere(); expect(function() { BoundingSphere.intersect(sphere, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static transform throws without a sphere', function() { expect(function() { BoundingSphere.transform(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static transform throws without a transform', function() { var sphere = new BoundingSphere(); expect(function() { BoundingSphere.transform(sphere); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getPlaneDistances throws without a sphere', function() { expect(function() { BoundingSphere.getPlaneDistances(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getPlaneDistances throws without a position', function() { expect(function() { BoundingSphere.getPlaneDistances(new BoundingSphere()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getPlaneDistances throws without a direction', function() { expect(function() { BoundingSphere.getPlaneDistances(new BoundingSphere(), new Cartesian3()); - }).toThrow(); + }).toThrowDeveloperError(); }); function expectBoundingSphereToContainPoint(boundingSphere, point, projection) { diff --git a/Specs/Core/Cartesian2Spec.js b/Specs/Core/Cartesian2Spec.js index fcc7b6c41f3c..c4a0cea0b124 100644 --- a/Specs/Core/Cartesian2Spec.js +++ b/Specs/Core/Cartesian2Spec.js @@ -48,7 +48,7 @@ defineSuite([ it('fromArray throws without values', function() { expect(function() { Cartesian2.fromArray(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('clone without a result parameter', function() { @@ -152,13 +152,13 @@ defineSuite([ it('getMinimumByComponent throws without first', function() { expect(function() { Cartesian2.getMinimumByComponent(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('getMinimumByComponent throws without second', function() { expect(function() { Cartesian2.getMinimumByComponent(new Cartesian2()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('getMinimumByComponent works when first\'s or second\'s X is lesser', function() { @@ -240,13 +240,13 @@ defineSuite([ it('getMaximumByComponent throws without first', function() { expect(function() { Cartesian2.getMaximumByComponent(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('getMaximumByComponent throws without second', function() { expect(function() { Cartesian2.getMaximumByComponent(new Cartesian2()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('getMaximumByComponent works when first\'s or second\'s X is greater', function() { @@ -287,13 +287,13 @@ defineSuite([ it('distance throws without left', function() { expect(function() { Cartesian2.distance(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('distance throws without right', function() { expect(function() { Cartesian2.distance(Cartesian2.UNIT_X); - }).toThrow(); + }).toThrowDeveloperError(); }); it('normalize works without a result parameter', function() { @@ -626,117 +626,117 @@ defineSuite([ it('static getMaximumComponent throws with no parameter', function() { expect(function() { Cartesian2.getMaximumComponent(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getMinimumComponent throws with no parameter', function() { expect(function() { Cartesian2.getMinimumComponent(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static magnitudeSquared throws with no parameter', function() { expect(function() { Cartesian2.magnitudeSquared(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static magnitude throws with no parameter', function() { expect(function() { Cartesian2.magnitude(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static normalize throws with no parameter', function() { expect(function() { Cartesian2.normalize(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static dot throws with no left parameter', function() { expect(function() { Cartesian2.dot(undefined, new Cartesian2()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static dot throws with no right parameter', function() { expect(function() { Cartesian2.dot(new Cartesian2(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyComponents throw with no left parameter', function() { var right = new Cartesian2(4.0, 5.0); expect(function() { Cartesian2.multiplyComponents(undefined, right); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyComponents throw with no right parameter', function() { var left = new Cartesian2(4.0, 5.0); expect(function() { Cartesian2.multiplyComponents(left, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static add throws with no left parameter', function() { expect(function() { Cartesian2.add(undefined, new Cartesian2()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static add throws with no right parameter', function() { expect(function() { Cartesian2.add(new Cartesian2(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static subtract throws with no left parameter', function() { expect(function() { Cartesian2.subtract(undefined, new Cartesian2()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static subtract throws with no right parameter', function() { expect(function() { Cartesian2.subtract(new Cartesian2(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByScalar throws with no cartesian parameter', function() { expect(function() { Cartesian2.multiplyByScalar(undefined, 2.0); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByScalar throws with no scalar parameter', function() { expect(function() { Cartesian2.multiplyByScalar(new Cartesian2(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static divideByScalar throws with no cartesian parameter', function() { expect(function() { Cartesian2.divideByScalar(undefined, 2.0); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static divideByScalar throws with no scalar parameter', function() { expect(function() { Cartesian2.divideByScalar(new Cartesian2(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static negate throws with no cartesian parameter', function() { expect(function() { Cartesian2.negate(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static abs throws with no cartesian parameter', function() { expect(function() { Cartesian2.abs(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static lerp throws with no start parameter', function() { @@ -744,7 +744,7 @@ defineSuite([ var t = 0.25; expect(function() { Cartesian2.lerp(undefined, end, t); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static lerp throws with no end parameter', function() { @@ -752,7 +752,7 @@ defineSuite([ var t = 0.25; expect(function() { Cartesian2.lerp(start, undefined, t); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static lerp throws with no t parameter', function() { @@ -760,33 +760,33 @@ defineSuite([ var end = new Cartesian2(8.0, 20.0); expect(function() { Cartesian2.lerp(start, end, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static angleBetween throws with no left parameter', function() { var right = new Cartesian2(8.0, 20.0); expect(function() { Cartesian2.angleBetween(undefined, right); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static angleBetween throws with no right parameter', function() { var left = new Cartesian2(4.0, 8.0); expect(function() { Cartesian2.angleBetween(left, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static mostOrthogonalAxis throws with no cartesian parameter', function() { expect(function() { Cartesian2.mostOrthogonalAxis(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static equalsEpsilon throws with no epsilon', function() { expect(function() { Cartesian2.equalsEpsilon(new Cartesian2(), new Cartesian2(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromElements returns a cartesian2 with corrrect coordinates', function(){ diff --git a/Specs/Core/Cartesian3Spec.js b/Specs/Core/Cartesian3Spec.js index 747b43878d94..887d1c5aadbe 100644 --- a/Specs/Core/Cartesian3Spec.js +++ b/Specs/Core/Cartesian3Spec.js @@ -63,7 +63,7 @@ defineSuite([ it('fromArray throws without values', function() { expect(function() { Cartesian3.fromArray(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('clone without a result parameter', function() { @@ -177,13 +177,13 @@ defineSuite([ it('getMinimumByComponent throws without first', function() { expect(function() { Cartesian3.getMinimumByComponent(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('getMinimumByComponent throws without second', function() { expect(function() { Cartesian3.getMinimumByComponent(new Cartesian3()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('getMinimumByComponent works when first\'s or second\'s X is lesser', function() { @@ -275,13 +275,13 @@ defineSuite([ it('getMaximumByComponent throws without first', function() { expect(function() { Cartesian3.getMaximumByComponent(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('getMaximumByComponent throws without second', function() { expect(function() { Cartesian3.getMaximumByComponent(new Cartesian3()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('getMaximumByComponent works when first\'s or second\'s X is greater', function() { @@ -332,13 +332,13 @@ defineSuite([ it('distance throws without left', function() { expect(function() { Cartesian3.distance(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('distance throws without right', function() { expect(function() { Cartesian3.distance(Cartesian3.UNIT_X); - }).toThrow(); + }).toThrowDeveloperError(); }); it('normalize works without a result parameter', function() { @@ -705,7 +705,7 @@ defineSuite([ it('fromSpherical throws with no spherical parameter', function() { expect(function() { Cartesian3.fromSpherical(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); @@ -716,117 +716,117 @@ defineSuite([ it('static getMaximumComponent throws with no parameter', function() { expect(function() { Cartesian3.getMaximumComponent(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getMinimumComponent throws with no parameter', function() { expect(function() { Cartesian3.getMinimumComponent(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static magnitudeSquared throws with no parameter', function() { expect(function() { Cartesian3.magnitudeSquared(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static magnitude throws with no parameter', function() { expect(function() { Cartesian3.magnitude(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static normalize throws with no parameter', function() { expect(function() { Cartesian3.normalize(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static dot throws with no left parameter', function() { expect(function() { Cartesian3.dot(undefined, new Cartesian3()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyComponents throw with no left parameter', function() { var right = new Cartesian3(4.0, 5.0, 6.0); expect(function() { Cartesian3.multiplyComponents(undefined, right); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyComponents throw with no right parameter', function() { var left = new Cartesian3(4.0, 5.0, 6.0); expect(function() { Cartesian3.multiplyComponents(left, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static dot throws with no right parameter', function() { expect(function() { Cartesian3.dot(new Cartesian3(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static add throws with no left parameter', function() { expect(function() { Cartesian3.add(undefined, new Cartesian3()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static add throws with no right parameter', function() { expect(function() { Cartesian3.add(new Cartesian3(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static subtract throws with no left parameter', function() { expect(function() { Cartesian3.subtract(undefined, new Cartesian3()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static subtract throws with no right parameter', function() { expect(function() { Cartesian3.subtract(new Cartesian3(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByScalar throws with no cartesian parameter', function() { expect(function() { Cartesian3.multiplyByScalar(undefined, 2.0); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByScalar throws with no scalar parameter', function() { expect(function() { Cartesian3.multiplyByScalar(new Cartesian3(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static divideByScalar throws with no cartesian parameter', function() { expect(function() { Cartesian3.divideByScalar(undefined, 2.0); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static divideByScalar throws with no scalar parameter', function() { expect(function() { Cartesian3.divideByScalar(new Cartesian3(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static negate throws with no cartesian parameter', function() { expect(function() { Cartesian3.negate(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static abs throws with no cartesian parameter', function() { expect(function() { Cartesian3.abs(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static lerp throws with no start parameter', function() { @@ -834,7 +834,7 @@ defineSuite([ var t = 0.25; expect(function() { Cartesian3.lerp(undefined, end, t); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static lerp throws with no end parameter', function() { @@ -842,7 +842,7 @@ defineSuite([ var t = 0.25; expect(function() { Cartesian3.lerp(start, undefined, t); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static lerp throws with no t parameter', function() { @@ -850,47 +850,47 @@ defineSuite([ var end = new Cartesian3(8.0, 20.0, 6.0); expect(function() { Cartesian3.lerp(start, end, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static angleBetween throws with no left parameter', function() { var right = new Cartesian3(8.0, 20.0, 6.0); expect(function() { Cartesian3.angleBetween(undefined, right); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static angleBetween throws with no right parameter', function() { var left = new Cartesian3(4.0, 8.0, 6.0); expect(function() { Cartesian3.angleBetween(left, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static mostOrthogonalAxis throws with no cartesian parameter', function() { expect(function() { Cartesian3.mostOrthogonalAxis(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static equalsEpsilon throws with no epsilon', function() { expect(function() { Cartesian3.equalsEpsilon(new Cartesian3(), new Cartesian3(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static cross throw with no left paramater', function() { var right = new Cartesian3(4, 3, 6); expect(function() { Cartesian3.cross(undefined, right); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static cross throw with no left paramater', function() { var left = new Cartesian3(1, 2, 5); expect(function() { Cartesian3.cross(left, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromElements returns a cartesian3 with corrrect coordinates', function(){ diff --git a/Specs/Core/Cartesian4Spec.js b/Specs/Core/Cartesian4Spec.js index 7edf6a1a6548..3e74d384583b 100644 --- a/Specs/Core/Cartesian4Spec.js +++ b/Specs/Core/Cartesian4Spec.js @@ -44,7 +44,7 @@ defineSuite([ it('fromArray throws without values', function() { expect(function() { Cartesian4.fromArray(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('clone without a result parameter', function() { @@ -176,13 +176,13 @@ defineSuite([ it('getMinimumByComponent throws without first', function() { expect(function() { Cartesian4.getMinimumByComponent(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('getMinimumByComponent throws without second', function() { expect(function() { Cartesian4.getMinimumByComponent(new Cartesian4()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('getMinimumByComponent works when first\'s or second\'s X is lesser', function() { @@ -292,13 +292,13 @@ defineSuite([ it('getMaximumByComponent throws without first', function() { expect(function() { Cartesian4.getMaximumByComponent(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('getMaximumByComponent throws without second', function() { expect(function() { Cartesian4.getMaximumByComponent(new Cartesian4()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('getMaximumByComponent works when first\'s or second\'s X is greater', function() { @@ -359,13 +359,13 @@ defineSuite([ it('distance throws without left', function() { expect(function() { Cartesian4.distance(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('distance throws without right', function() { expect(function() { Cartesian4.distance(Cartesian4.UNIT_X); - }).toThrow(); + }).toThrowDeveloperError(); }); it('normalize works without a result parameter', function() { @@ -700,117 +700,117 @@ defineSuite([ it('static getMaximumComponent throws with no parameter', function() { expect(function() { Cartesian4.getMaximumComponent(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getMinimumComponent throws with no parameter', function() { expect(function() { Cartesian4.getMinimumComponent(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static magnitudeSquared throws with no parameter', function() { expect(function() { Cartesian4.magnitudeSquared(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static magnitude throws with no parameter', function() { expect(function() { Cartesian4.magnitude(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static normalize throws with no parameter', function() { expect(function() { Cartesian4.normalize(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static dot throws with no left parameter', function() { expect(function() { Cartesian4.dot(undefined, new Cartesian4()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyComponents throw with no left parameter', function() { var right = new Cartesian4(4.0, 5.0, 6.0, 7.0); expect(function() { Cartesian4.multiplyComponents(undefined, right); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyComponents throw with no right parameter', function() { var left = new Cartesian4(4.0, 5.0, 6.0, 7.0); expect(function() { Cartesian4.multiplyComponents(left, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static dot throws with no right parameter', function() { expect(function() { Cartesian4.dot(new Cartesian4(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static add throws with no left parameter', function() { expect(function() { Cartesian4.add(undefined, new Cartesian4()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static add throws with no right parameter', function() { expect(function() { Cartesian4.add(new Cartesian4(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static subtract throws with no left parameter', function() { expect(function() { Cartesian4.subtract(undefined, new Cartesian4()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static subtract throws with no right parameter', function() { expect(function() { Cartesian4.subtract(new Cartesian4(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByScalar throws with no cartesian parameter', function() { expect(function() { Cartesian4.multiplyByScalar(undefined, 2.0); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByScalar throws with no scalar parameter', function() { expect(function() { Cartesian4.multiplyByScalar(new Cartesian4(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static divideByScalar throws with no cartesian parameter', function() { expect(function() { Cartesian4.divideByScalar(undefined, 2.0); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static divideByScalar throws with no scalar parameter', function() { expect(function() { Cartesian4.divideByScalar(new Cartesian4(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static negate throws with no cartesian parameter', function() { expect(function() { Cartesian4.negate(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static abs throws with no cartesian parameter', function() { expect(function() { Cartesian4.abs(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static lerp throws with no start parameter', function() { @@ -818,7 +818,7 @@ defineSuite([ var t = 0.25; expect(function() { Cartesian4.lerp(undefined, end, t); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static lerp throws with no end parameter', function() { @@ -826,7 +826,7 @@ defineSuite([ var t = 0.25; expect(function() { Cartesian4.lerp(start, undefined, t); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static lerp throws with no t parameter', function() { @@ -834,19 +834,19 @@ defineSuite([ var end = new Cartesian4(8.0, 20.0, 6.0, 7.0); expect(function() { Cartesian4.lerp(start, end, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static mostOrthogonalAxis throws with no cartesian parameter', function() { expect(function() { Cartesian4.mostOrthogonalAxis(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static equalsEpsilon throws with no epsilon', function() { expect(function() { Cartesian4.equalsEpsilon(new Cartesian4(), new Cartesian4(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromElements returns a cartesian4 with corrrect coordinates', function(){ diff --git a/Specs/Core/MathSpec.js b/Specs/Core/MathSpec.js index 19e0f27d08ba..957841a8b75f 100644 --- a/Specs/Core/MathSpec.js +++ b/Specs/Core/MathSpec.js @@ -150,63 +150,63 @@ defineSuite([ it('factorial throws for non-numbers', function() { expect(function() { CesiumMath.factorial({}); - }).toThrow(); + }).toThrowDeveloperError(); }); it('factorial throws for negative numbers', function() { expect(function() { CesiumMath.factorial(-1); - }).toThrow(); + }).toThrowDeveloperError(); }); it('factorial throws for undefined', function() { expect(function() { CesiumMath.factorial(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('incrementWrap throws for minimum value >= maximum value', function() { expect(function() { CesiumMath.incrementWrap(5, 0, 10); - }).toThrow(); + }).toThrowDeveloperError(); expect(function() { CesiumMath.incrementWrap(5, 10, 10); - }).toThrow(); + }).toThrowDeveloperError(); }); it('isPowerOfTwo throws for non-numbers', function() { expect(function() { CesiumMath.isPowerOfTwo({}); - }).toThrow(); + }).toThrowDeveloperError(); }); it('isPowerOfTwo throws for negative numbers', function() { expect(function() { CesiumMath.isPowerOfTwo(-1); - }).toThrow(); + }).toThrowDeveloperError(); }); it('isPowerOfTwo throws for undefined', function() { expect(function() { CesiumMath.isPowerOfTwo(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('nextPowerOfTwo throws for non-numbers', function() { expect(function() { CesiumMath.nextPowerOfTwo({}); - }).toThrow(); + }).toThrowDeveloperError(); }); it('nextPowerOfTwo throws for negative numbers', function() { expect(function() { CesiumMath.nextPowerOfTwo(-1); - }).toThrow(); + }).toThrowDeveloperError(); }); it('nextPowerOfTwo throws for undefined', function() { expect(function() { CesiumMath.nextPowerOfTwo(); - }).toThrow(); + }).toThrowDeveloperError(); }); }); diff --git a/Specs/Core/Matrix2Spec.js b/Specs/Core/Matrix2Spec.js index daa75a8797d3..4adf0b6580b7 100644 --- a/Specs/Core/Matrix2Spec.js +++ b/Specs/Core/Matrix2Spec.js @@ -108,7 +108,7 @@ defineSuite([ it('fromRotation throws without angle', function() { expect(function() { Matrix2.fromRotation(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('clone works without a result parameter', function() { @@ -378,7 +378,7 @@ defineSuite([ it('abs throws without a matrix', function() { expect(function() { return Matrix2.abs(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('abs works without a result parameter', function() { @@ -482,25 +482,25 @@ defineSuite([ it('fromRowMajorArray throws with undefined parameter', function() { expect(function() { Matrix2.fromRowMajorArray(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromColumnMajorArray throws with undefined parameter', function() { expect(function() { Matrix2.fromColumnMajorArray(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static fromScale throws without scale parameter', function() { expect(function() { Matrix2.fromScale(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static fromUniformScale throws without scale parameter', function() { expect(function() { Matrix2.fromUniformScale(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static clone returns undefined without matrix parameter', function() { @@ -510,13 +510,13 @@ defineSuite([ it('static toArray throws without matrix parameter', function() { expect(function() { Matrix2.toArray(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getColumn throws without matrix parameter', function() { expect(function() { Matrix2.getColumn(undefined, 1); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getElement throws without row parameter', function() { @@ -524,7 +524,7 @@ defineSuite([ var col = 0.0; expect(function() { Matrix2.getElementIndex(col, row); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getElement throws without column parameter', function() { @@ -532,28 +532,28 @@ defineSuite([ var col; expect(function() { Matrix2.getElementIndex(col, row); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getColumn throws without of range index parameter', function() { var matrix = new Matrix2(); expect(function() { Matrix2.getColumn(matrix, 2); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setColumn throws without matrix parameter', function() { var cartesian = new Cartesian2(); expect(function() { Matrix2.setColumn(undefined, 2, cartesian); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setColumn throws without cartesian parameter', function() { var matrix = new Matrix2(); expect(function() { Matrix2.setColumn(matrix, 1, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setColumn throws without of range index parameter', function() { @@ -561,34 +561,34 @@ defineSuite([ var cartesian = new Cartesian2(); expect(function() { Matrix2.setColumn(matrix, 2, cartesian); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getRow throws without matrix parameter', function() { expect(function() { Matrix2.getRow(undefined, 1); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getRow throws without of range index parameter', function() { var matrix = new Matrix2(); expect(function() { Matrix2.getRow(matrix, 2); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setRow throws without matrix parameter', function() { var cartesian = new Cartesian2(); expect(function() { Matrix2.setRow(undefined, 2, cartesian); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setRow throws without cartesian parameter', function() { var matrix = new Matrix2(); expect(function() { Matrix2.setRow(matrix, 1, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setRow throws without of range index parameter', function() { @@ -596,65 +596,65 @@ defineSuite([ var cartesian = new Cartesian2(); expect(function() { Matrix2.setRow(matrix, 2, cartesian); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiply throws with no left parameter', function() { var right = new Matrix2(); expect(function() { Matrix2.multiply(undefined, right); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiply throws with no right parameter', function() { var left = new Matrix2(); expect(function() { Matrix2.multiply(left, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByVector throws with no matrix parameter', function() { var cartesian = new Cartesian2(); expect(function() { Matrix2.multiplyByVector(undefined, cartesian); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByVector throws with no cartesian parameter', function() { var matrix = new Matrix2(); expect(function() { Matrix2.multiplyByVector(matrix, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByScalar throws with no matrix parameter', function() { expect(function() { Matrix2.multiplyByScalar(undefined, 2); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByScalar throws with non-numeric scalar parameter', function() { var matrix = new Matrix2(); expect(function() { Matrix2.multiplyByScalar(matrix, {}); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static negate throws with matrix parameter', function() { expect(function() { Matrix2.negate(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static transpose throws with matrix parameter', function() { expect(function() { Matrix2.transpose(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static equalsEpsilon throws with non-number parameter', function() { expect(function() { Matrix2.equalsEpsilon(new Matrix2(), new Matrix2(), {}); - }).toThrow(); + }).toThrowDeveloperError(); }); }); diff --git a/Specs/Core/Matrix3Spec.js b/Specs/Core/Matrix3Spec.js index 63962ff25b68..745867d40bb6 100644 --- a/Specs/Core/Matrix3Spec.js +++ b/Specs/Core/Matrix3Spec.js @@ -157,7 +157,7 @@ defineSuite([ it('fromRotationX throws without angle', function() { expect(function() { Matrix3.fromRotationX(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromRotationY works without a result parameter', function() { @@ -179,7 +179,7 @@ defineSuite([ it('fromRotationY throws without angle', function() { expect(function() { Matrix3.fromRotationY(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromRotationZ works without a result parameter', function() { @@ -201,7 +201,7 @@ defineSuite([ it('fromRotationZ throws without angle', function() { expect(function() { Matrix3.fromRotationZ(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('clone works without a result parameter', function() { @@ -536,7 +536,7 @@ defineSuite([ it('getEigenDecomposition throws without a matrix', function() { expect(function() { return Matrix3.getEigenDecomposition(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('computes eigenvalues and eigenvectors', function() { @@ -597,7 +597,7 @@ defineSuite([ it('abs throws without a matrix', function() { expect(function() { return Matrix3.abs(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('abs works without a result parameter', function() { @@ -746,13 +746,13 @@ defineSuite([ it('fromRowMajorArray throws with undefined parameter', function() { expect(function() { Matrix3.fromRowMajorArray(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromColumnMajorArray throws with undefined parameter', function() { expect(function() { Matrix3.fromColumnMajorArray(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static clone returns undefined without matrix parameter', function() { @@ -762,7 +762,7 @@ defineSuite([ it('static toArray throws without matrix parameter', function() { expect(function() { Matrix3.toArray(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getElement throws without row parameter', function() { @@ -770,7 +770,7 @@ defineSuite([ var col = 0.0; expect(function() { Matrix3.getElementIndex(col, row); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getElement throws without column parameter', function() { @@ -778,34 +778,34 @@ defineSuite([ var col; expect(function() { Matrix3.getElementIndex(col, row); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getColumn throws without matrix parameter', function() { expect(function() { Matrix3.getColumn(undefined, 1); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getColumn throws without of range index parameter', function() { var matrix = new Matrix3(); expect(function() { Matrix3.getColumn(matrix, 3); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setColumn throws without matrix parameter', function() { var cartesian = new Cartesian3(); expect(function() { Matrix3.setColumn(undefined, 2, cartesian); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setColumn throws without cartesian parameter', function() { var matrix = new Matrix3(); expect(function() { Matrix3.setColumn(matrix, 1, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setColumn throws without of range index parameter', function() { @@ -813,34 +813,34 @@ defineSuite([ var cartesian = new Cartesian3(); expect(function() { Matrix3.setColumn(matrix, 3, cartesian); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getRow throws without matrix parameter', function() { expect(function() { Matrix3.getRow(undefined, 1); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getRow throws without of range index parameter', function() { var matrix = new Matrix3(); expect(function() { Matrix3.getRow(matrix, 3); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setRow throws without matrix parameter', function() { var cartesian = new Cartesian3(); expect(function() { Matrix3.setRow(undefined, 2, cartesian); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setRow throws without cartesian parameter', function() { var matrix = new Matrix3(); expect(function() { Matrix3.setRow(matrix, 1, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setRow throws without of range index parameter', function() { @@ -848,101 +848,101 @@ defineSuite([ var cartesian = new Cartesian3(); expect(function() { Matrix3.setRow(matrix, 3, cartesian); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiply throws with no left parameter', function() { var right = new Matrix3(); expect(function() { Matrix3.multiply(undefined, right); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiply throws with no right parameter', function() { var left = new Matrix3(); expect(function() { Matrix3.multiply(left, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByVector throws with no matrix parameter', function() { var cartesian = new Cartesian3(); expect(function() { Matrix3.multiplyByVector(undefined, cartesian); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByVector throws with no cartesian parameter', function() { var matrix = new Matrix3(); expect(function() { Matrix3.multiplyByVector(matrix, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByScalar throws with no matrix parameter', function() { expect(function() { Matrix3.multiplyByScalar(undefined, 2); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByScalar throws with non-numeric scalar parameter', function() { var matrix = new Matrix3(); expect(function() { Matrix3.multiplyByScalar(matrix, {}); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static negate throws without matrix parameter', function() { expect(function() { Matrix3.negate(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static transpose throws without matrix parameter', function() { expect(function() { Matrix3.transpose(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static determinant throws without matrix parameter', function() { expect(function() { Matrix3.determinant(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static inverse throws without matrix parameter', function() { expect(function() { Matrix3.inverse(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static inverse throws when matrix is not invertible', function() { expect(function() { Matrix3.inverse(new Matrix3(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static fromQuaternion throws without quaternion parameter', function() { expect(function() { Matrix3.fromQuaternion(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static fromScale throws without scale parameter', function() { expect(function() { Matrix3.fromScale(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static fromUniformScale throws without scale parameter', function() { expect(function() { Matrix3.fromUniformScale(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static equalsEpsilon throws with non-number parameter', function() { expect(function() { Matrix3.equalsEpsilon(new Matrix3(), new Matrix3(), {}); - }).toThrow(); + }).toThrowDeveloperError(); }); }); diff --git a/Specs/Core/Matrix4Spec.js b/Specs/Core/Matrix4Spec.js index ef3a8735caec..a3298772a9f2 100644 --- a/Specs/Core/Matrix4Spec.js +++ b/Specs/Core/Matrix4Spec.js @@ -988,7 +988,7 @@ defineSuite([ it('abs throws without a matrix', function() { expect(function() { return Matrix4.abs(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('abs works without a result parameter', function() { @@ -1027,67 +1027,67 @@ defineSuite([ it('fromRowMajorArray throws with undefined parameter', function() { expect(function() { Matrix4.fromRowMajorArray(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromColumnMajorArray throws with undefined parameter', function() { expect(function() { Matrix4.fromColumnMajorArray(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromRotationTranslation throws without rotation parameter', function() { expect(function() { Matrix4.fromRotationTranslation(undefined, new Cartesian3()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromRotationTranslation throws without translation parameter', function() { expect(function() { Matrix4.fromRotationTranslation(new Matrix4(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromTranslationQuaternionRotationScale throws without translation parameter', function() { expect(function() { Matrix4.fromTranslationQuaternionRotationScale(undefined, new Quaternion(), new Cartesian3()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromTranslationQuaternionRotationScale throws without rotation parameter', function() { expect(function() { Matrix4.fromTranslationQuaternionRotationScale(new Matrix3(), undefined, new Cartesian3()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromTranslationQuaternionRotationScale throws without scale parameter', function() { expect(function() { Matrix4.fromTranslationQuaternionRotationScale(new Matrix3(), new Quaternion(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromTranslation throws without translation parameter', function() { expect(function() { Matrix4.fromTranslation(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromScale throws without scale parameter', function() { expect(function() { Matrix4.fromScale(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromUniformScale throws without scale parameter', function() { expect(function() { Matrix4.fromUniformScale(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromCamera throws without camera', function() { expect(function() { Matrix4.fromCamera(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromCamera throws without eye', function() { @@ -1096,7 +1096,7 @@ defineSuite([ target : Cartesian3.negate(Cartesian3.UNIT_Z), up : Cartesian3.UNIT_Y }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromCamera throws without target', function() { @@ -1105,7 +1105,7 @@ defineSuite([ eye : Cartesian3.ZERO, up : Cartesian3.UNIT_Y }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromCamera throws without up', function() { @@ -1114,149 +1114,149 @@ defineSuite([ eye : Cartesian3.ZERO, target : Cartesian3.negate(Cartesian3.UNIT_Z) }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createOrthographicOffCenter throws without left', function() { expect(function() { var right = 0, bottom = 0, top = 0, near = 0, far = 0; Matrix4.computeOrthographicOffCenter(undefined, right, bottom, top, near, far); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createOrthographicOffCenter throws without right', function() { expect(function() { var left = 0, bottom = 0, top = 0, near = 0, far = 0; Matrix4.computeOrthographicOffCenter(left, undefined, bottom, top, near, far); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createOrthographicOffCenter throws without bottom', function() { expect(function() { var left = 0, right = 0, top = 0, near = 0, far = 0; Matrix4.computeOrthographicOffCenter(left, right, undefined, top, near, far); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createOrthographicOffCenter throws without top', function() { expect(function() { var left = 0, right = 0, bottom = 0, near = 0, far = 0; Matrix4.computeOrthographicOffCenter(left, right, bottom, undefined, near, far); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createOrthographicOffCenter throws without near', function() { expect(function() { var left = 0, right = 0, bottom = 0, top = 0, far = 0; Matrix4.computeOrthographicOffCenter(left, right, bottom, top, undefined, far); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createOrthographicOffCenter throws without far', function() { expect(function() { var left = 0, right = 0, bottom = 0, top = 0, near = 0; Matrix4.computeOrthographicOffCenter(left, right, bottom, top, near, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createPerspectiveOffCenter throws without left', function() { expect(function() { var right = 0, bottom = 0, top = 0, near = 0, far = 0; Matrix4.computePerspectiveOffCenter (undefined, right, bottom, top, near, far); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createPerspectiveOffCenter throws without right', function() { expect(function() { var left = 0, bottom = 0, top = 0, near = 0, far = 0; Matrix4.computePerspectiveOffCenter (left, undefined, bottom, top, near, far); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createPerspectiveOffCenter throws without bottom', function() { expect(function() { var left = 0, right = 0, top = 0, near = 0, far = 0; Matrix4.computePerspectiveOffCenter (left, right, undefined, top, near, far); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createPerspectiveOffCenter throws without top', function() { expect(function() { var left = 0, right = 0, bottom = 0, near = 0, far = 0; Matrix4.computePerspectiveOffCenter (left, right, bottom, undefined, near, far); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createPerspectiveOffCenter throws without near', function() { expect(function() { var left = 0, right = 0, bottom = 0, top = 0, far = 0; Matrix4.computePerspectiveOffCenter (left, right, bottom, top, undefined, far); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createPerspectiveOffCenter throws without far', function() { expect(function() { var left = 0, right = 0, bottom = 0, top = 0, near = 0; Matrix4.computePerspectiveOffCenter (left, right, bottom, top, near, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createInfinitePerspectiveOffCenter throws without left', function() { expect(function() { var right = 0, bottom = 0, top = 0, near = 0, far = 0; Matrix4.computeInfinitePerspectiveOffCenter (undefined, right, bottom, top, near, far); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createInfinitePerspectiveOffCenter throws without right', function() { expect(function() { var left = 0, bottom = 0, top = 0, near = 0, far = 0; Matrix4.computeInfinitePerspectiveOffCenter (left, undefined, bottom, top, near, far); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createInfinitePerspectiveOffCenter throws without bottom', function() { expect(function() { var left = 0, right = 0, top = 0, near = 0, far = 0; Matrix4.computeInfinitePerspectiveOffCenter (left, right, undefined, top, near, far); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createInfinitePerspectiveOffCenter throws without top', function() { expect(function() { var left = 0, right = 0, bottom = 0, near = 0, far = 0; Matrix4.computeInfinitePerspectiveOffCenter (left, right, bottom, undefined, near, far); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createInfinitePerspectiveOffCenter throws without near', function() { expect(function() { var left = 0, right = 0, bottom = 0, top = 0, far = 0; Matrix4.computeInfinitePerspectiveOffCenter (left, right, bottom, top, undefined, far); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createPerspectiveFieldOfView throws with out of range y field of view', function() { expect(function() { Matrix4.computePerspectiveFieldOfView(0, 1, 2, 3); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createPerspectiveFieldOfView throws with out of range aspect', function() { expect(function() { Matrix4.computePerspectiveFieldOfView(1, 0, 2, 3); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createPerspectiveFieldOfView throws with out of range near', function() { expect(function() { Matrix4.computePerspectiveFieldOfView(1, 1, 0, 3); - }).toThrow(); + }).toThrowDeveloperError(); }); it('createPerspectiveFieldOfView throws with out of range far', function() { expect(function() { Matrix4.computePerspectiveFieldOfView(1, 1, 2, 0); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static clone returns undefined without matrix parameter', function() { @@ -1266,7 +1266,7 @@ defineSuite([ it('static toArray throws without matrix parameter', function() { expect(function() { Matrix4.toArray(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getElement throws without row parameter', function() { @@ -1274,7 +1274,7 @@ defineSuite([ var col = 0.0; expect(function() { Matrix4.getElementIndex(col, row); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getElement throws without column parameter', function() { @@ -1282,34 +1282,34 @@ defineSuite([ var col; expect(function() { Matrix4.getElementIndex(col, row); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getColumn throws without matrix parameter', function() { expect(function() { Matrix4.getColumn(undefined, 1); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getColumn throws without of range index parameter', function() { var matrix = new Matrix4(); expect(function() { Matrix4.getColumn(matrix, 4); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setColumn throws without matrix parameter', function() { var cartesian = new Cartesian4(); expect(function() { Matrix4.setColumn(undefined, 2, cartesian); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setColumn throws without cartesian parameter', function() { var matrix = new Matrix4(); expect(function() { Matrix4.setColumn(matrix, 1, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setColumn throws without of range index parameter', function() { @@ -1317,34 +1317,34 @@ defineSuite([ var cartesian = new Cartesian4(); expect(function() { Matrix4.setColumn(matrix, 4, cartesian); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getRow throws without matrix parameter', function() { expect(function() { Matrix4.getRow(undefined, 1); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getRow throws without of range index parameter', function() { var matrix = new Matrix4(); expect(function() { Matrix4.getRow(matrix, 4); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setRow throws without matrix parameter', function() { var cartesian = new Cartesian4(); expect(function() { Matrix4.setRow(undefined, 2, cartesian); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setRow throws without cartesian parameter', function() { var matrix = new Matrix4(); expect(function() { Matrix4.setRow(matrix, 1, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static setRow throws without of range index parameter', function() { @@ -1352,150 +1352,150 @@ defineSuite([ var cartesian = new Cartesian4(); expect(function() { Matrix4.setRow(matrix, 4, cartesian); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiply throws with no left parameter', function() { var right = new Matrix4(); expect(function() { Matrix4.multiply(undefined, right); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiply throws with no right parameter', function() { var left = new Matrix4(); expect(function() { Matrix4.multiply(left, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByTranslation throws with no matrix parameter', function() { var translation = new Cartesian3(); expect(function() { Matrix4.multiplyByTranslation(undefined, translation); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByTranslation throws with no translation parameter', function() { var m = new Matrix4(); expect(function() { Matrix4.multiplyByTranslation(m, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByUniformScale throws with no matrix parameter', function() { expect(function() { Matrix4.multiplyByUniformScale(undefined, 2.0); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByUniformScale throws with no scale parameter', function() { var m = new Matrix4(); expect(function() { Matrix4.multiplyByUniformScale(m, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByScale throws with no matrix parameter', function() { expect(function() { Matrix4.multiplyByScale(undefined, new Cartesian3()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByScale throws with no scale parameter', function() { var m = new Matrix4(); expect(function() { Matrix4.multiplyByScale(m, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByVector throws with no matrix parameter', function() { var cartesian = new Cartesian4(); expect(function() { Matrix4.multiplyByVector(undefined, cartesian); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByVector throws with no cartesian parameter', function() { var matrix = new Matrix4(); expect(function() { Matrix4.multiplyByVector(matrix, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByPoint throws with no matrix parameter', function() { var cartesian = new Cartesian4(); expect(function() { Matrix4.multiplyByPoint(undefined, cartesian); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByPoint throws with no cartesian parameter', function() { var matrix = new Matrix4(); expect(function() { Matrix4.multiplyByPoint(matrix, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByScalar throws with no matrix parameter', function() { expect(function() { Matrix4.multiplyByScalar(undefined, 2); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByScalar throws with non-numeric scalar parameter', function() { var matrix = new Matrix4(); expect(function() { Matrix4.multiplyByScalar(matrix, {}); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static negate throws without matrix parameter', function() { expect(function() { Matrix4.negate(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static transpose throws without matrix parameter', function() { expect(function() { Matrix4.transpose(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static equalsEpsilon throws with non-number parameter', function() { expect(function() { Matrix4.equalsEpsilon(new Matrix4(), new Matrix4(), {}); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getTranslation throws without matrix parameter', function() { expect(function() { Matrix4.getTranslation(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getRotation throws without matrix parameter', function() { expect(function() { Matrix4.getRotation(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static inverse throws without matrix parameter', function() { expect(function() { Matrix4.inverse(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static inverse throws with non-inversable matrix', function() { var matrix = new Matrix4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); expect(function() { Matrix4.inverse(matrix); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static inverseTransformation throws without matrix parameter', function() { expect(function() { Matrix4.inverseTransformation(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); }); diff --git a/Specs/Core/QuaternionSpec.js b/Specs/Core/QuaternionSpec.js index 66c31f207bfa..c94a45b85fae 100644 --- a/Specs/Core/QuaternionSpec.js +++ b/Specs/Core/QuaternionSpec.js @@ -659,19 +659,19 @@ defineSuite([ it('fromAxisAngle throws with undefined axis', function() { expect(function() { Quaternion.fromAxisAngle(undefined, 1.0); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromAxisAngle throws with non-numeric angle', function() { expect(function() { Quaternion.fromAxisAngle(Cartesian3.UNIT_X, {}); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fromRotationMatrix throws with undefined matrix', function() { expect(function() { Quaternion.fromRotationMatrix(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static clone returns undefined with no parameter', function() { @@ -681,121 +681,121 @@ defineSuite([ it('static conjugate throws with no parameter', function() { expect(function() { Quaternion.conjugate(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static magnitudeSquared throws with no parameter', function() { expect(function() { Quaternion.magnitudeSquared(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static magnitude throws with no parameter', function() { expect(function() { Quaternion.magnitude(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static normalize throws with no parameter', function() { expect(function() { Quaternion.normalize(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static inverse throws with no parameter', function() { expect(function() { Quaternion.inverse(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static dot throws with no left parameter', function() { expect(function() { Quaternion.dot(undefined, new Quaternion()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static dot throws with no right parameter', function() { expect(function() { Quaternion.dot(new Quaternion(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiply throws with no right parameter', function() { expect(function() { Quaternion.multiply(new Quaternion(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiply throws with no left parameter', function() { expect(function() { Quaternion.multiply(undefined, new Quaternion()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static add throws with no left parameter', function() { expect(function() { Quaternion.add(undefined, new Quaternion()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static add throws with no right parameter', function() { expect(function() { Quaternion.add(new Quaternion(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static subtract throws with no left parameter', function() { expect(function() { Quaternion.subtract(undefined, new Quaternion()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static subtract throws with no right parameter', function() { expect(function() { Quaternion.subtract(new Quaternion(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByScalar throws with no quaternion parameter', function() { expect(function() { Quaternion.multiplyByScalar(undefined, 2.0); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static multiplyByScalar throws with no scalar parameter', function() { expect(function() { Quaternion.multiplyByScalar(new Quaternion(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static divideByScalar throws with no quaternion parameter', function() { expect(function() { Quaternion.divideByScalar(undefined, 2.0); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static divideByScalar throws with no scalar parameter', function() { expect(function() { Quaternion.divideByScalar(new Quaternion(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getAxis throws with no parameter', function() { expect(function() { Quaternion.getAxis(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static getAngle throws with no parameter', function() { expect(function() { Quaternion.getAngle(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static negate throws with no quaternion parameter', function() { expect(function() { Quaternion.negate(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static lerp throws with no start parameter', function() { @@ -803,7 +803,7 @@ defineSuite([ var t = 0.25; expect(function() { Quaternion.lerp(undefined, end, t); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static lerp throws with no end parameter', function() { @@ -811,7 +811,7 @@ defineSuite([ var t = 0.25; expect(function() { Quaternion.lerp(start, undefined, t); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static lerp throws with no t parameter', function() { @@ -819,7 +819,7 @@ defineSuite([ var end = new Quaternion(8.0, 20.0, 6.0, 7.0); expect(function() { Quaternion.lerp(start, end, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static slerp throws with no start parameter', function() { @@ -827,7 +827,7 @@ defineSuite([ var t = 0.25; expect(function() { Quaternion.slerp(undefined, end, t); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static slerp throws with no end parameter', function() { @@ -835,7 +835,7 @@ defineSuite([ var t = 0.25; expect(function() { Quaternion.slerp(start, undefined, t); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static slerp throws with no t parameter', function() { @@ -843,43 +843,43 @@ defineSuite([ var end = new Quaternion(8.0, 20.0, 6.0, 7.0); expect(function() { Quaternion.slerp(start, end, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static log throws with no quaternion parameter', function() { expect(function() { Quaternion.log(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static exp throws with no cartesian parameter', function() { expect(function() { Quaternion.exp(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static innerQuadrangle throws without q0, q1, or q2 parameter', function() { expect(function() { Quaternion.innerQuadrangle(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static squad throws without q0, q1, s0, or s1 parameter', function() { expect(function() { Quaternion.squad(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static squad throws without t parameter', function() { expect(function() { Quaternion.squad(new Quaternion(), new Quaternion(), new Quaternion(), new Quaternion()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('static equalsEpsilon throws with no epsilon', function() { expect(function() { Quaternion.equalsEpsilon(new Quaternion(), new Quaternion(), undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); createPackableSpecs(Quaternion, new Quaternion(1, 2, 3, 4), [1, 2, 3, 4]); diff --git a/Specs/Core/TransformsSpec.js b/Specs/Core/TransformsSpec.js index 0becd9ebaa5c..ce6cbe7839ae 100644 --- a/Specs/Core/TransformsSpec.js +++ b/Specs/Core/TransformsSpec.js @@ -232,11 +232,11 @@ defineSuite([ it('throws if the date parameter is not specified', function() { expect(function() { Transforms.computeIcrfToFixedMatrix(undefined); - }).toThrow(); + }).toThrowDeveloperError(); expect(function() { Transforms.computeFixedToIcrfMatrix(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('works with data from STK Components', function() { @@ -469,7 +469,7 @@ defineSuite([ runs(function() { expect(function() { return Transforms.computeIcrfToFixedMatrix(time); - }).toThrow(); + }).toThrowDeveloperError(); }); }); @@ -484,7 +484,7 @@ defineSuite([ runs(function() { expect(function() { return Transforms.computeIcrfToFixedMatrix(time); - }).toThrow(); + }).toThrowDeveloperError(); }); }); @@ -571,36 +571,36 @@ defineSuite([ it('eastNorthUpToFixedFrame throws without an origin', function() { expect(function() { Transforms.eastNorthUpToFixedFrame(undefined, Ellipsoid.WGS84); - }).toThrow(); + }).toThrowDeveloperError(); }); it('northEastDownToFixedFrame throws without an origin', function() { expect(function() { Transforms.northEastDownToFixedFrame(undefined, Ellipsoid.WGS84); - }).toThrow(); + }).toThrowDeveloperError(); }); it('computeTemeToPseudoFixedMatrix throws without a date', function() { expect(function() { Transforms.computeTemeToPseudoFixedMatrix(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('pointToWindowCoordinates throws without modelViewProjectionMatrix', function() { expect(function() { Transforms.pointToWindowCoordinates(undefined, Matrix4.IDENTITY, Cartesian3.ZERO); - }).toThrow(); + }).toThrowDeveloperError(); }); it('pointToWindowCoordinates throws without viewportTransformation', function() { expect(function() { Transforms.pointToWindowCoordinates(Matrix4.IDENTITY, undefined, Cartesian3.ZERO); - }).toThrow(); + }).toThrowDeveloperError(); }); it('pointToWindowCoordinates throws without a point', function() { expect(function() { Transforms.pointToWindowCoordinates(Matrix4.IDENTITY, Matrix4.IDENTITY, undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); }); diff --git a/Specs/Renderer/ContextSpec.js b/Specs/Renderer/ContextSpec.js index a7278a1457bd..b6412aabeaba 100644 --- a/Specs/Renderer/ContextSpec.js +++ b/Specs/Renderer/ContextSpec.js @@ -284,7 +284,7 @@ defineSuite([ it('throws when creating a pick ID without an object', function() { expect(function() { context.createPickId(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('returns undefined when retrieving an object by unknown pick color', function() { @@ -294,13 +294,13 @@ defineSuite([ it('throws when getObjectByPickColor is called without a color', function() { expect(function() { context.getObjectByPickColor(undefined); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to construct (null canvas)', function() { expect(function() { return new Context(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('isDestroyed', function() { diff --git a/Specs/Scene/PerspectiveFrustumSpec.js b/Specs/Scene/PerspectiveFrustumSpec.js index 1b35e6fd562c..b87948857d3b 100644 --- a/Specs/Scene/PerspectiveFrustumSpec.js +++ b/Specs/Scene/PerspectiveFrustumSpec.js @@ -31,51 +31,51 @@ defineSuite([ frustum.fovy = -1.0; expect(function() { return frustum.projectionMatrix; - }).toThrow(); + }).toThrowDeveloperError(); frustum.fovy = CesiumMath.TWO_PI; expect(function() { return frustum.projectionMatrix; - }).toThrow(); + }).toThrowDeveloperError(); }); it('negative aspect ratio throws an exception', function() { frustum.aspectRatio = -1.0; expect(function() { return frustum.projectionMatrix; - }).toThrow(); + }).toThrowDeveloperError(); }); it('out of range near plane throws an exception', function() { frustum.near = -1.0; expect(function() { return frustum.projectionMatrix; - }).toThrow(); + }).toThrowDeveloperError(); }); it('negative far plane throws an exception', function() { frustum.far = -1.0; expect(function() { return frustum.projectionMatrix; - }).toThrow(); + }).toThrowDeveloperError(); }); it('computeCullingVolume with no position throws an exception', function() { expect(function() { return frustum.computeCullingVolume(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('computeCullingVolume with no direction throws an exception', function() { expect(function() { return frustum.computeCullingVolume(new Cartesian3()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('computeCullingVolume with no up throws an exception', function() { expect(function() { return frustum.computeCullingVolume(new Cartesian3(), new Cartesian3()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('get frustum left plane', function() { @@ -134,7 +134,7 @@ defineSuite([ it('get pixel size throws without canvas dimensions', function() { expect(function() { return frustum.getPixelSize(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('get pixel size', function() { @@ -165,6 +165,6 @@ defineSuite([ var frustum = new PerspectiveFrustum(); expect(function() { return frustum.infiniteProjectionMatrix; - }).toThrow(); + }).toThrowDeveloperError(); }); }); diff --git a/Specs/Scene/PerspectiveOffCenterFrustumSpec.js b/Specs/Scene/PerspectiveOffCenterFrustumSpec.js index cb924c4182f2..a87c39bb86f7 100644 --- a/Specs/Scene/PerspectiveOffCenterFrustumSpec.js +++ b/Specs/Scene/PerspectiveOffCenterFrustumSpec.js @@ -33,32 +33,32 @@ defineSuite([ frustum.near = -1.0; expect(function() { return frustum.projectionMatrix; - }).toThrow(); + }).toThrowDeveloperError(); }); it('negative far plane throws an exception', function() { frustum.far = -1.0; expect(function() { return frustum.projectionMatrix; - }).toThrow(); + }).toThrowDeveloperError(); }); it('computeCullingVolume with no position throws an exception', function() { expect(function() { return frustum.computeCullingVolume(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('computeCullingVolume with no direction throws an exception', function() { expect(function() { return frustum.computeCullingVolume(new Cartesian3()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('computeCullingVolume with no up throws an exception', function() { expect(function() { return frustum.computeCullingVolume(new Cartesian3(), new Cartesian3()); - }).toThrow(); + }).toThrowDeveloperError(); }); it('get frustum left plane', function() { @@ -129,19 +129,19 @@ defineSuite([ it('get pixel size throws without canvas dimensions', function() { expect(function() { return frustum.getPixelSize(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('get pixel size throws without canvas width less than or equal to zero', function() { expect(function() { return frustum.getPixelSize(new Cartesian2(0.0, 1.0)); - }).toThrow(); + }).toThrowDeveloperError(); }); it('get pixel size throws without canvas height less than or equal to zero', function() { expect(function() { return frustum.getPixelSize(new Cartesian2(1.0, 0.0)); - }).toThrow(); + }).toThrowDeveloperError(); }); it('get pixel size', function() { @@ -169,6 +169,6 @@ defineSuite([ var frustum = new PerspectiveOffCenterFrustum(); expect(function() { return frustum.infiniteProjectionMatrix; - }).toThrow(); + }).toThrowDeveloperError(); }); }); diff --git a/Specs/SpecRunner.js b/Specs/SpecRunner.js index 505543ef79a4..246d153904ff 100644 --- a/Specs/SpecRunner.js +++ b/Specs/SpecRunner.js @@ -176,8 +176,8 @@ var afterAll; var readyToCreateTests = false; var createTests; - var combined = getQueryParameter('combined'); - var minified = getQueryParameter('minified'); + var built = getQueryParameter('built'); + var release = getQueryParameter('release'); var loadTests = true; require.config({ @@ -186,9 +186,9 @@ var afterAll; // set up require for AMD, combined or minified and // start loading all of Cesium early, so it's all available for code coverage calculations. - if (combined || minified) { + if (built) { require.config({ - baseUrl : getQueryParameter('baseUrl') || (minified ? '../Build/Cesium' : '../Build/CesiumUnminified'), + baseUrl : getQueryParameter('baseUrl') || '../Build/Cesium', paths : { 'Stubs' : '../Stubs' }, @@ -287,7 +287,7 @@ var afterAll; equalsMethodEqualityTester) { var env = jasmine.getEnv(); - env.beforeEach(addDefaultMatchers); + env.beforeEach(addDefaultMatchers(!release)); env.addEqualityTester(equalsMethodEqualityTester); createTests = function() { diff --git a/Specs/addDefaultMatchers.js b/Specs/addDefaultMatchers.js index 2ad3029ec168..de57cc48b4c4 100644 --- a/Specs/addDefaultMatchers.js +++ b/Specs/addDefaultMatchers.js @@ -13,93 +13,115 @@ define([ }; } - var defaultMatchers = { - toBeGreaterThanOrEqualTo : function(value, epsilon) { - return this.actual >= value; - }, - - toBeLessThanOrEqualTo : function(value, epsilon) { - return this.actual <= value; - }, - - toBeBetween : function(lower, upper) { - if (lower > upper) { - var tmp = upper; - upper = lower; - lower = tmp; - } - return this.actual >= lower && this.actual <= upper; - }, - - toEqual : function(expected) { - return equals(this.env, this.actual, expected); - }, - - toEqualEpsilon : function(expected, epsilon) { - function equalityTester(a, b) { - var to_run; - if (defined(a)) { - if (typeof a.equalsEpsilon === 'function') { - return a.equalsEpsilon(b, epsilon); - } else if(a instanceof Object) { - // Check if the current object has a static function named 'equalsEpsilon' - to_run = Object.getPrototypeOf(a).constructor.equalsEpsilon; - if( typeof to_run === 'function') { - return to_run(a, b, epsilon); + function createDefaultMatchers(debug) { + return { + toBeGreaterThanOrEqualTo : function(value, epsilon) { + return this.actual >= value; + }, + + toBeLessThanOrEqualTo : function(value, epsilon) { + return this.actual <= value; + }, + + toBeBetween : function(lower, upper) { + if (lower > upper) { + var tmp = upper; + upper = lower; + lower = tmp; + } + return this.actual >= lower && this.actual <= upper; + }, + + toEqual : function(expected) { + return equals(this.env, this.actual, expected); + }, + + toEqualEpsilon : function(expected, epsilon) { + function equalityTester(a, b) { + var to_run; + if (defined(a)) { + if (typeof a.equalsEpsilon === 'function') { + return a.equalsEpsilon(b, epsilon); + } else if(a instanceof Object) { + // Check if the current object has a static function named 'equalsEpsilon' + to_run = Object.getPrototypeOf(a).constructor.equalsEpsilon; + if( typeof to_run === 'function') { + return to_run(a, b, epsilon); + } } } - } - - if (defined(b)) { - if (typeof b.equalsEpsilon === 'function') { - return b.equalsEpsilon(a, epsilon); - } else if(b instanceof Object) { - // Check if the current object has a static function named 'equalsEpsilon' - to_run = Object.getPrototypeOf(b).constructor.equalsEpsilon; - if( typeof to_run === 'function') { - return to_run(b, a, epsilon); + + if (defined(b)) { + if (typeof b.equalsEpsilon === 'function') { + return b.equalsEpsilon(a, epsilon); + } else if(b instanceof Object) { + // Check if the current object has a static function named 'equalsEpsilon' + to_run = Object.getPrototypeOf(b).constructor.equalsEpsilon; + if( typeof to_run === 'function') { + return to_run(b, a, epsilon); + } } } - } - if (typeof a === 'number' || typeof b === 'number') { - return Math.abs(a - b) <= epsilon; - } + if (typeof a === 'number' || typeof b === 'number') { + return Math.abs(a - b) <= epsilon; + } - return undefined; - } + return undefined; + } - var origTesters = this.env.equalityTesters_; - this.env.equalityTesters_ = [equalityTester]; + var origTesters = this.env.equalityTesters_; + this.env.equalityTesters_ = [equalityTester]; - var result = equals(this.env, this.actual, expected); + var result = equals(this.env, this.actual, expected); - this.env.equalityTesters_ = origTesters; + this.env.equalityTesters_ = origTesters; - return result; - }, + return result; + }, - toConformToInterface : function(expectedInterface) { - // All function properties on the prototype should also exist on the actual's prototype. - var actualPrototype = this.actual.prototype; - var expectedInterfacePrototype = expectedInterface.prototype; + toConformToInterface : function(expectedInterface) { + // All function properties on the prototype should also exist on the actual's prototype. + var actualPrototype = this.actual.prototype; + var expectedInterfacePrototype = expectedInterface.prototype; - for ( var item in expectedInterfacePrototype) { - if (expectedInterfacePrototype.hasOwnProperty(item) && typeof expectedInterfacePrototype[item] === 'function' && !actualPrototype.hasOwnProperty(item)) { - this.message = createMissingFunctionMessageFunction(item, actualPrototype, expectedInterfacePrototype); - return false; + for ( var item in expectedInterfacePrototype) { + if (expectedInterfacePrototype.hasOwnProperty(item) && typeof expectedInterfacePrototype[item] === 'function' && !actualPrototype.hasOwnProperty(item)) { + this.message = createMissingFunctionMessageFunction(item, actualPrototype, expectedInterfacePrototype); + return false; + } } - } - return true; - }, + return true; + }, + + toBeInstanceOf : function(expectedConstructor) { + return this.actual instanceof expectedConstructor; + }, + + toThrowDeveloperError : (function() { + if (debug) { + return function(func) { + var threw = false; + try { + func(); + } catch (e) { + threw = true; + } + return threw; + }; + } - toBeInstanceOf : function(expectedConstructor) { - return this.actual instanceof expectedConstructor; - } - }; + return function() { + return true; + }; + }()) + }; + } - return function() { - this.addMatchers(defaultMatchers); + return function(debug) { + return function() { + this.addMatchers(createDefaultMatchers(debug)); + }; }; }); From b27cc42cdca89577df998918c468758d2613ddd9 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 26 Nov 2013 20:11:27 -0500 Subject: [PATCH 21/33] Fix renderer tests. --- Specs/Renderer/BufferSpec.js | 8 +++---- Specs/Renderer/CubeMapSpec.js | 22 ++++++++--------- Specs/Renderer/FramebufferSpec.js | 2 +- Specs/Renderer/RenderbufferSpec.js | 10 ++++---- Specs/Renderer/SamplerSpec.js | 10 ++++---- Specs/Renderer/TextureSpec.js | 38 +++++++++++++++--------------- 6 files changed, 45 insertions(+), 45 deletions(-) diff --git a/Specs/Renderer/BufferSpec.js b/Specs/Renderer/BufferSpec.js index efa423363081..3b46a209776e 100644 --- a/Specs/Renderer/BufferSpec.js +++ b/Specs/Renderer/BufferSpec.js @@ -64,7 +64,7 @@ defineSuite([ it('only allows typed array or size when creating a vertex buffer', function() { expect(function() { buffer = context.createVertexBuffer({}, BufferUsage.STATIC_DRAW); - }).toThrow(); + }).toThrowDeveloperError(); }); it('creates index buffer', function() { @@ -105,7 +105,7 @@ defineSuite([ it('only allows typed array or size when creating a vertex buffer', function() { expect(function() { buffer = context.createIndexBuffer({}, BufferUsage.STATIC_DRAW, IndexDatatype.UNSIGNED_SHORT); - }).toThrow(); + }).toThrowDeveloperError(); }); it('destroys', function() { @@ -118,13 +118,13 @@ defineSuite([ it('fails to create', function() { expect(function() { buffer = context.createVertexBuffer(0, BufferUsage.STATIC_DRAW); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to create again', function() { expect(function() { buffer = context.createVertexBuffer(4, 0); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to provide an array view', function() { diff --git a/Specs/Renderer/CubeMapSpec.js b/Specs/Renderer/CubeMapSpec.js index 624ef463d5aa..a1a16802bb15 100644 --- a/Specs/Renderer/CubeMapSpec.js +++ b/Specs/Renderer/CubeMapSpec.js @@ -885,13 +885,13 @@ defineSuite([ it('fails to create (description)', function() { expect(function() { cubeMap = context.createCubeMap(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to create (source)', function() { expect(function() { cubeMap = context.createCubeMap({}); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to create (width, no height)', function() { @@ -899,7 +899,7 @@ defineSuite([ cubeMap = context.createCubeMap({ width : 16 }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to create (width != height)', function() { @@ -908,7 +908,7 @@ defineSuite([ width : 16, height : 32 }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to create (small width)', function() { @@ -917,7 +917,7 @@ defineSuite([ width : 0, height : 0 }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to create (large width)', function() { @@ -926,7 +926,7 @@ defineSuite([ width : context.getMaximumCubeMapSize() + 1, height : context.getMaximumCubeMapSize() + 1 }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to create (PixelFormat)', function() { @@ -936,7 +936,7 @@ defineSuite([ height : 16, pixelFormat : 'invalid PixelFormat' }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws during creation if pixel format is depth or depth-stencil', function() { @@ -946,7 +946,7 @@ defineSuite([ height : 16, pixelFormat : PixelFormat.DEPTH_COMPONENT }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws during creation if pixelDatatype is FLOAT, and OES_texture_float is not supported', function() { @@ -969,7 +969,7 @@ defineSuite([ pixelFormat : PixelFormat.RGBA, pixelDatatype : 'invalid pixelDatatype' }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to create (source)', function() { @@ -977,7 +977,7 @@ defineSuite([ cubeMap = context.createCubeMap({ source : {} }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to create (source width and height)', function() { @@ -992,7 +992,7 @@ defineSuite([ negativeZ : blueOverRedImage // 1x2 } }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to copy from an image (source)', function() { diff --git a/Specs/Renderer/FramebufferSpec.js b/Specs/Renderer/FramebufferSpec.js index 1c1414ab9c3b..a7019f377720 100644 --- a/Specs/Renderer/FramebufferSpec.js +++ b/Specs/Renderer/FramebufferSpec.js @@ -563,7 +563,7 @@ defineSuite([ } }) }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to destroy', function() { diff --git a/Specs/Renderer/RenderbufferSpec.js b/Specs/Renderer/RenderbufferSpec.js index e93c5077b1db..cdcd30297997 100644 --- a/Specs/Renderer/RenderbufferSpec.js +++ b/Specs/Renderer/RenderbufferSpec.js @@ -57,7 +57,7 @@ defineSuite([ renderbuffer = context.createRenderbuffer({ format : 'invalid format' }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to create (small width)', function() { @@ -65,7 +65,7 @@ defineSuite([ renderbuffer = context.createRenderbuffer({ width : 0 }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to create (large width)', function() { @@ -73,7 +73,7 @@ defineSuite([ renderbuffer = context.createRenderbuffer({ width : context.getMaximumRenderbufferSize() + 1 }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to create (small height)', function() { @@ -81,7 +81,7 @@ defineSuite([ renderbuffer = context.createRenderbuffer({ height : 0 }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to create (large height)', function() { @@ -89,7 +89,7 @@ defineSuite([ renderbuffer = context.createRenderbuffer({ height : context.getMaximumRenderbufferSize() + 1 }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('fails to destroy', function() { diff --git a/Specs/Renderer/SamplerSpec.js b/Specs/Renderer/SamplerSpec.js index 2bac555594a4..269e72385bda 100644 --- a/Specs/Renderer/SamplerSpec.js +++ b/Specs/Renderer/SamplerSpec.js @@ -23,7 +23,7 @@ defineSuite([ context.createSampler({ wrapS : 'invalid wrap' }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating a sampler with invalid wrapT', function() { @@ -31,7 +31,7 @@ defineSuite([ context.createSampler({ wrapT : 'invalid wrap' }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating a sampler with invalid minificationFilter', function() { @@ -39,7 +39,7 @@ defineSuite([ context.createSampler({ minificationFilter : 'invalid filter' }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating a sampler with invalid magnificationFilter', function() { @@ -47,7 +47,7 @@ defineSuite([ context.createSampler({ magnificationFilter : 'invalid filter' }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating a sampler with invalid maximumAnisotropy', function() { @@ -55,7 +55,7 @@ defineSuite([ context.createSampler({ maximumAnisotropy : 0.0 }); - }).toThrow(); + }).toThrowDeveloperError(); }); }, 'WebGL'); diff --git a/Specs/Renderer/TextureSpec.js b/Specs/Renderer/TextureSpec.js index 160352dbb6eb..ed4e58deb335 100644 --- a/Specs/Renderer/TextureSpec.js +++ b/Specs/Renderer/TextureSpec.js @@ -439,13 +439,13 @@ defineSuite([ it('throws when creating a texture without a description', function() { expect(function() { texture = context.createTexture2D(); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating a texture without a source', function() { expect(function() { texture = context.createTexture2D({}); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating a texture with width and no height', function() { @@ -453,7 +453,7 @@ defineSuite([ texture = context.createTexture2D({ width : 16 }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating a texture with height and no width', function() { @@ -461,7 +461,7 @@ defineSuite([ texture = context.createTexture2D({ height : 16 }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating a texture with zero width', function() { @@ -470,7 +470,7 @@ defineSuite([ width : 0, height : 16 }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating a texture with width larger than the maximum texture size', function() { @@ -479,7 +479,7 @@ defineSuite([ width : context.getMaximumTextureSize() + 1, height : 16 }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating a texture with zero height', function() { @@ -488,7 +488,7 @@ defineSuite([ width : 16, height : 0 }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating a texture with height larger than the maximum texture size', function() { @@ -497,7 +497,7 @@ defineSuite([ width : 16, height : context.getMaximumTextureSize() + 1 }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating a texture with an invalid pixel format', function() { @@ -506,7 +506,7 @@ defineSuite([ source : blueImage, pixelFormat : 'invalid PixelFormat' }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating a texture with an invalid pixel datatype', function() { @@ -516,7 +516,7 @@ defineSuite([ pixelFormat : PixelFormat.RGBA, pixelDatatype : 'invalid pixelDatatype' }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating if pixelFormat is DEPTH_COMPONENT and pixelDatatype is not UNSIGNED_SHORT or UNSIGNED_INT', function() { @@ -525,7 +525,7 @@ defineSuite([ pixelFormat : PixelFormat.DEPTH_COMPONENT, pixelDatatype : PixelDatatype.UNSIGNED_BYTE }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating if pixelFormat is DEPTH_STENCIL and pixelDatatype is not UNSIGNED_INT_24_8_WEBGL', function() { @@ -534,7 +534,7 @@ defineSuite([ pixelFormat : PixelFormat.DEPTH_STENCIL, pixelDatatype : PixelDatatype.UNSIGNED_BYTE }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating if pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, and source is provided', function() { @@ -544,7 +544,7 @@ defineSuite([ pixelFormat : PixelFormat.DEPTH_COMPONENT, pixelDatatype : PixelDatatype.UNSIGNED_SHORT }); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating if pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, and WEBGL_depth_texture is not supported', function() { @@ -576,37 +576,37 @@ defineSuite([ it('throws when creating from the framebuffer with an invalid pixel format', function() { expect(function() { texture = context.createTexture2DFromFramebuffer('invalid PixelFormat'); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating from the framebuffer if PixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL', function() { expect(function() { texture = context.createTexture2DFromFramebuffer(PixelFormat.DEPTH_COMPONENT); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating from the framebuffer with a negative framebufferXOffset', function() { expect(function() { texture = context.createTexture2DFromFramebuffer(PixelFormat.RGB, -1); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating from the framebuffer with a negative framebufferYOffset', function() { expect(function() { texture = context.createTexture2DFromFramebuffer(PixelFormat.RGB, 0, -1); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating from the framebuffer with a width greater than the canvas clientWidth', function() { expect(function() { texture = context.createTexture2DFromFramebuffer(PixelFormat.RGB, 0, 0, context.getCanvas().clientWidth + 1); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when creating from the framebuffer with a height greater than the canvas clientHeight', function() { expect(function() { texture = context.createTexture2DFromFramebuffer(PixelFormat.RGB, 0, 0, 1, context.getCanvas().clientHeight + 1); - }).toThrow(); + }).toThrowDeveloperError(); }); it('throws when copying to a texture from the framebuffer with a DEPTH_COMPONENT or DEPTH_STENCIL pixel format', function() { From 468e385d1008ba36bc6cedd2ee7cd605c8085555 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 26 Nov 2013 20:59:04 -0500 Subject: [PATCH 22/33] Fix after merge. --- Source/Renderer/Context.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Renderer/Context.js b/Source/Renderer/Context.js index a29a844d0e71..0b082ae17c26 100644 --- a/Source/Renderer/Context.js +++ b/Source/Renderer/Context.js @@ -1325,8 +1325,8 @@ define([ options = defaultValue(options, defaultValue.EMPTY_OBJECT); var source = options.source; - var width = defined(source) ? source.width : description.width; - var height = defined(source) ? source.height : description.height; + var width = defined(source) ? source.width : options.width; + var height = defined(source) ? source.height : options.height; var pixelFormat = defaultValue(options.pixelFormat, PixelFormat.RGBA); var pixelDatatype = defaultValue(options.pixelDatatype, PixelDatatype.UNSIGNED_BYTE); @@ -1569,8 +1569,8 @@ define([ } var size = width; - var pixelFormat = defaultValue(description.pixelFormat, PixelFormat.RGBA); - var pixelDatatype = defaultValue(description.pixelDatatype, PixelDatatype.UNSIGNED_BYTE); + var pixelFormat = defaultValue(options.pixelFormat, PixelFormat.RGBA); + var pixelDatatype = defaultValue(options.pixelDatatype, PixelDatatype.UNSIGNED_BYTE); //>>includeStart('debug', pragmas.debug); if (!defined(width) || !defined(height)) { From e4830a2ca95ab18b9f1e27b45c0885dd9d8fce67 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Wed, 27 Nov 2013 08:56:15 -0500 Subject: [PATCH 23/33] Fix buildModuleUrl tests. --- Specs/Core/buildModuleUrlSpec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Specs/Core/buildModuleUrlSpec.js b/Specs/Core/buildModuleUrlSpec.js index 21c659503fd4..465f9e69f7fc 100644 --- a/Specs/Core/buildModuleUrlSpec.js +++ b/Specs/Core/buildModuleUrlSpec.js @@ -11,9 +11,9 @@ defineSuite([ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/ it('produces an absolute URL for a module', function() { - var url = buildModuleUrl('Core/buildModuleUrl.js'); + var url = buildModuleUrl('Workers/taskDispatcher.js'); - expect(url).toMatch(/Core\/buildModuleUrl.js$/); + expect(url).toMatch(/Workers\/taskDispatcher.js$/); expect(new Uri(url).isAbsolute()).toBe(true); // make sure it actually exists at that URL From 53a2eff2d9bbbecba3b39ed594943b91b2f35976 Mon Sep 17 00:00:00 2001 From: Scott Hunter Date: Mon, 2 Dec 2013 16:20:31 -0500 Subject: [PATCH 24/33] Override worker loader config in specs, so they work even with the combined Cesium.js. --- Source/Core/TaskProcessor.js | 5 ++++- Specs/Core/TaskProcessorSpec.js | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Source/Core/TaskProcessor.js b/Source/Core/TaskProcessor.js index 1aa92eaa60e9..99b0f50008e0 100644 --- a/Source/Core/TaskProcessor.js +++ b/Source/Core/TaskProcessor.js @@ -79,7 +79,9 @@ define([ workerModule : TaskProcessor._workerModulePrefix + processor._workerName }; - if (defined(require.toUrl)) { + if (defined(TaskProcessor._loaderConfig)) { + bootstrapMessage.loaderConfig = TaskProcessor._loaderConfig; + } else if (defined(require.toUrl)) { var baseUrl = new Uri('..').resolve(new Uri(buildModuleUrl('Workers/cesiumWorkerBootstrapper.js'))).toString(); bootstrapMessage.loaderConfig.baseUrl = baseUrl; } else { @@ -205,6 +207,7 @@ define([ // exposed for testing purposes TaskProcessor._defaultWorkerModulePrefix = 'Workers/'; TaskProcessor._workerModulePrefix = TaskProcessor._defaultWorkerModulePrefix; + TaskProcessor._loaderConfig = undefined; return TaskProcessor; }); diff --git a/Specs/Core/TaskProcessorSpec.js b/Specs/Core/TaskProcessorSpec.js index 3da88540882a..37fb799e097b 100644 --- a/Specs/Core/TaskProcessorSpec.js +++ b/Specs/Core/TaskProcessorSpec.js @@ -1,9 +1,11 @@ /*global defineSuite*/ defineSuite([ 'Core/TaskProcessor', + 'require', 'Specs/waitsForPromise' ], function( TaskProcessor, + require, waitsForPromise) { "use strict"; /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/ @@ -12,10 +14,22 @@ defineSuite([ beforeEach(function() { TaskProcessor._workerModulePrefix = '../Specs/TestWorkers/'; + + function absolutize(url) { + var a = document.createElement('a'); + a.href = url; + a.href = a.href; // IE only absolutizes href on get, not set + return a.href; + } + + TaskProcessor._loaderConfig = { + baseUrl : absolutize(require.toUrl('Specs/../Source')) + }; }); afterEach(function() { TaskProcessor._workerModulePrefix = TaskProcessor._defaultWorkerModulePrefix; + TaskProcessor._loaderConfig = undefined; if (taskProcessor && !taskProcessor.isDestroyed()) { taskProcessor = taskProcessor.destroy(); From 6eaf40b7d50d2beb54b409cd0659dd2fd6460f2d Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 2 Dec 2013 20:23:05 -0500 Subject: [PATCH 25/33] Update links on index page and the links generated by jasmine. --- ThirdParty/jasmine-1.3.1/jasmine-html.js | 57 ++++++++++++++++++++---- index.html | 5 ++- 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/ThirdParty/jasmine-1.3.1/jasmine-html.js b/ThirdParty/jasmine-1.3.1/jasmine-html.js index 469b79775041..0808373bad2b 100644 --- a/ThirdParty/jasmine-1.3.1/jasmine-html.js +++ b/ThirdParty/jasmine-1.3.1/jasmine-html.js @@ -1,3 +1,12 @@ +function getQueryParameter(name) { + var match = new RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search); + + if (match) { + return decodeURIComponent(match[1].replace(/\+/g, ' ')); + } + return null; +} + jasmine.HtmlReporterHelpers = {}; jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) { @@ -175,6 +184,14 @@ jasmine.HtmlReporter = function(_doc) { doc.body.appendChild(dom.reporter); setExceptionHandling(); + var params = ''; + if (getQueryParameter('built')) { + params += '&built=true'; + } + if (getQueryParameter('release')) { + params += '&release=true'; + } + var runButton = document.getElementById('runButton'); runButton.onclick = function() { if (document.getElementById('no_try_catch').checked) { @@ -184,10 +201,10 @@ jasmine.HtmlReporter = function(_doc) { var select = document.getElementById('categorySelect'); if (document.getElementById('categoryException').checked) { - top.location.href = '?category=All¬=' + encodeURIComponent(select.options[select.selectedIndex].value); + top.location.href = '?category=All¬=' + encodeURIComponent(select.options[select.selectedIndex].value) + params; return false; } - top.location.href = '?category=' + encodeURIComponent(select.options[select.selectedIndex].value); + top.location.href = '?category=' + encodeURIComponent(select.options[select.selectedIndex].value) + params; return false; } @@ -198,10 +215,10 @@ jasmine.HtmlReporter = function(_doc) { var select = document.getElementById('categorySelect'); if (document.getElementById('categoryException').checked) { - top.location.href = baseInstrumentUrl + window.encodeURIComponent('&category=All¬=' + select.options[select.selectedIndex].value); + top.location.href = baseInstrumentUrl + window.encodeURIComponent('&category=All¬=' + select.options[select.selectedIndex].value) + params; return false; } - top.location.href = baseInstrumentUrl + window.encodeURIComponent('&category=' + select.options[select.selectedIndex].value); + top.location.href = baseInstrumentUrl + window.encodeURIComponent('&category=' + select.options[select.selectedIndex].value) + params; return false; } @@ -444,6 +461,12 @@ jasmine.HtmlReporter.sectionLink = function(sectionName) { if (!jasmine.CATCH_EXCEPTIONS) { params.push("catch=false"); } + if (getQueryParameter('built')) { + params.push('built=true'); + } + if (getQueryParameter('release')) { + params.push('release=true'); + } if (params.length > 0) { link += params.join("&"); } @@ -589,11 +612,19 @@ jasmine.HtmlReporter.ReporterView = function(dom) { specView.summary.className += " specSkipped"; } + var params = ''; + if (getQueryParameter('built')) { + params += '&built=true'; + } + if (getQueryParameter('release')) { + params += '&release=true'; + } + specView.summary.appendChild(this.createDom('span', {className: 'specTime'}, - this.createDom('a', {className: 'run_spec', href: '?spec=' + name, target: '_top'}, 'run'), + this.createDom('a', {className: 'run_spec', href: '?spec=' + name + params, target: '_top'}, 'run'), this.createDom('a', {className: 'run_spec', href: '../Instrumented/jscoverage.html?../Specs/SpecRunner.html' + - window.encodeURIComponent('?baseUrl=../Instrumented&spec=' + name), target: '_top' }, "coverage"), - this.createDom('a', {className: 'run_spec', href: '?spec=' + name + '&debug=' + name, target: '_top'}, 'debug'), + window.encodeURIComponent('?baseUrl=../Instrumented&spec=' + name) + params, target: '_top' }, "coverage"), + this.createDom('a', {className: 'run_spec', href: '?spec=' + name + '&debug=' + name + params, target: '_top'}, 'debug'), runTime)); switch (status) { @@ -631,11 +662,19 @@ jasmine.HtmlReporter.ReporterView = function(dom) { runTime = ' (' + (suite.runTime / 1000) + 's)'; } + var params = ''; + if (getQueryParameter('built')) { + params += '&built=true'; + } + if (getQueryParameter('release')) { + params += '&release=true'; + } + var name = encodeURIComponent(suite.getFullName()); suiteView.element.insertBefore(this.createDom('span', {className: 'suiteTime'}, - this.createDom('a', {className: 'run_spec', href: '?spec=' + name, target: '_top'}, 'run'), + this.createDom('a', {className: 'run_spec', href: '?spec=' + name + params, target: '_top'}, 'run'), this.createDom('a', {className: 'run_spec', href: '../Instrumented/jscoverage.html?../Specs/SpecRunner.html' + - window.encodeURIComponent('?baseUrl=../Instrumented&spec=' + name), target: '_top' }, "coverage"), + window.encodeURIComponent('?baseUrl=../Instrumented&spec=' + name) + params, target: '_top' }, "coverage"), runTime), suiteView.element.getElementsByTagName('a')[2].nextSibling); if (suite.beforeSpec_ && !suite.beforeSpec_.results().passed()) { diff --git a/index.html b/index.html index 7ee518eac032..d57d24fa3306 100644 --- a/index.html +++ b/index.html @@ -40,7 +40,10 @@ Tests
  • - Run all tests (Run with WebGL validation) + Run all tests(Run with WebGL validation) +
  • +
  • + Run all built version tests(Run all release built version tests)
  • Select a test to run From 3670d6536e835122866c74b95898396a5e193957 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 3 Dec 2013 16:22:38 -0500 Subject: [PATCH 26/33] Reuse targets by passing parameters. Add debug option to combined/minified workers. --- build.xml | 47 +++++++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/build.xml b/build.xml index 9e549d666503..cbff2cea14ee 100644 --- a/build.xml +++ b/build.xml @@ -22,9 +22,7 @@ - - - + @@ -45,36 +43,23 @@ - - - - - - - - + + - - - - - - - - - - - - - + + - + + + + + @@ -363,11 +348,15 @@ + + + + - + @@ -378,11 +367,16 @@ + + + + + @@ -397,6 +391,7 @@ + From 162611f8243bb987a51fccacbdc210aa8bdef20c Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 3 Dec 2013 17:07:13 -0500 Subject: [PATCH 27/33] Generate debug unminified Cesium and release minified Cesium. --- build.xml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/build.xml b/build.xml index cbff2cea14ee..60429210df50 100644 --- a/build.xml +++ b/build.xml @@ -56,7 +56,10 @@ - + + + + @@ -431,7 +434,16 @@ - + + + + + + + + + + From da88547a4dba1e613d1bc7a50ca2e849de8326de Mon Sep 17 00:00:00 2001 From: Scott Hunter Date: Wed, 18 Dec 2013 11:52:05 -0500 Subject: [PATCH 28/33] toThrowDeveloperError didn't work at all. Also correct some specs that were marked toThrowDeveloperError but the code didn't actually throw DeveloperErrors. --- Specs/Core/Matrix4Spec.js | 2 +- Specs/Core/TransformsSpec.js | 4 ++-- Specs/addDefaultMatchers.js | 34 +++++++++++++++++++++++++++++----- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/Specs/Core/Matrix4Spec.js b/Specs/Core/Matrix4Spec.js index a3298772a9f2..60ec82c02c99 100644 --- a/Specs/Core/Matrix4Spec.js +++ b/Specs/Core/Matrix4Spec.js @@ -1490,7 +1490,7 @@ defineSuite([ var matrix = new Matrix4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); expect(function() { Matrix4.inverse(matrix); - }).toThrowDeveloperError(); + }).toThrow(); }); it('static inverseTransformation throws without matrix parameter', function() { diff --git a/Specs/Core/TransformsSpec.js b/Specs/Core/TransformsSpec.js index ce6cbe7839ae..c958d75bceb5 100644 --- a/Specs/Core/TransformsSpec.js +++ b/Specs/Core/TransformsSpec.js @@ -469,7 +469,7 @@ defineSuite([ runs(function() { expect(function() { return Transforms.computeIcrfToFixedMatrix(time); - }).toThrowDeveloperError(); + }).toThrow(); }); }); @@ -484,7 +484,7 @@ defineSuite([ runs(function() { expect(function() { return Transforms.computeIcrfToFixedMatrix(time); - }).toThrowDeveloperError(); + }).toThrow(); }); }); diff --git a/Specs/addDefaultMatchers.js b/Specs/addDefaultMatchers.js index de57cc48b4c4..a54706086f67 100644 --- a/Specs/addDefaultMatchers.js +++ b/Specs/addDefaultMatchers.js @@ -1,9 +1,11 @@ /*global define*/ define([ 'Core/defined', + 'Core/DeveloperError', './equals' ], function( defined, + DeveloperError, equals) { "use strict"; @@ -101,14 +103,36 @@ define([ toThrowDeveloperError : (function() { if (debug) { - return function(func) { - var threw = false; + return function(expected) { + // based on the built-in Jasmine toThrow matcher + var result = false; + var exception; + + if (typeof this.actual !== 'function') { + throw new Error('Actual is not a function'); + } + try { - func(); + this.actual(); } catch (e) { - threw = true; + exception = e; + } + + if (exception) { + result = exception instanceof DeveloperError; } - return threw; + + var not = this.isNot ? "not " : ""; + + this.message = function() { + if (result) { + return ["Expected function " + not + "to throw DeveloperError, but it threw", exception.message || exception].join(' '); + } else { + return "Expected function to throw DeveloperError."; + } + }; + + return result; }; } From 65c371dbac1afc7476197ae8f94425d91f8b9f28 Mon Sep 17 00:00:00 2001 From: Scott Hunter Date: Wed, 18 Dec 2013 12:03:46 -0500 Subject: [PATCH 29/33] Reword text about running tests against combined/release files. --- index.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index d57d24fa3306..fd4ee74b437b 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ body { font-family: sans-serif; } li { margin-top: 5px; } .outer > li { margin-top: 1.4em; } - .smallFont { font-size: 50%; } + .smallFont { font-size: 60%; } @@ -40,10 +40,8 @@ Tests - + \ No newline at end of file From b7c4257099c25108059c2259486a7ab0defc3211 Mon Sep 17 00:00:00 2001 From: Scott Hunter Date: Wed, 18 Dec 2013 16:00:44 -0500 Subject: [PATCH 30/33] Fix debug option so it's omitted correctly when pragmas.debug is not set. --- build.xml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/build.xml b/build.xml index a1e1058c5cf9..30826e15d77d 100644 --- a/build.xml +++ b/build.xml @@ -21,9 +21,7 @@ - - - + @@ -351,7 +349,7 @@ - + @@ -359,7 +357,7 @@ - + @@ -370,7 +368,7 @@ - + @@ -379,7 +377,7 @@ - + @@ -394,7 +392,7 @@ - + From 2e9866d83bc08ff07e3c44916dac2225e32ee74a Mon Sep 17 00:00:00 2001 From: Scott Hunter Date: Wed, 18 Dec 2013 16:35:18 -0500 Subject: [PATCH 31/33] Be more selective about files in Build to put in the zip file. --- build.xml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/build.xml b/build.xml index 30826e15d77d..c9417b60781e 100644 --- a/build.xml +++ b/build.xml @@ -22,7 +22,7 @@ - + @@ -30,8 +30,8 @@ - - + + @@ -72,11 +72,10 @@ - + - - + @@ -85,7 +84,14 @@ - + + + + + + + + From 213ec645114ca3b692ae79294f4d95b99e491c1a Mon Sep 17 00:00:00 2001 From: Scott Hunter Date: Wed, 18 Dec 2013 17:11:29 -0500 Subject: [PATCH 32/33] Add info about the lack of DeveloperErrors to CHANGES --- CHANGES.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 1210ec89370b..c7349758ff47 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,7 +9,7 @@ Beta Releases * Breaking changes: * Added `allowTextureFilterAnisotropic` (default: `true`) and `failIfMajorPerformanceCaveat` (default: `true`) properties to the `contextOption` property passed to `Viewer`, `CesiumWidget`, and `Scene` constructors and moved the existing properties to a new `webgl` sub-property. For example, code that looked like: - var viewer = new Viewer('cesiumContainer', { + var viewer = new Viewer('cesiumContainer', { alpha : true }); @@ -23,6 +23,7 @@ Beta Releases * The CSS files for individual widgets, e.g. `BaseLayerPicker.css`, no longer import other CSS files. Most applications should import `widgets.css` (and optionally `lighter.css`). * `SvgPath` has been replaced by a Knockout binding: `cesiumSvgPath`. * `DynamicObject.availability` is now a `TimeIntervalCollection` instead of a `TimeInterval`. +* The minified, combined `Cesium.js` file now omits certain `DeveloperError` checks, to increase performance and reduce file size. When developing your application, we recommend using the unminified version locally for early error detection, then deploying the minified version to production. * Added `CentralBody.maximumScreenSpaceError`. * Added `translateEventTypes`, `zoomEventTypes`, `rotateEventTypes`, `tiltEventTypes`, and `lookEventTypes` properties to `ScreenSpaceCameraController` to change the default mouse inputs. * Added `Billboard.setPixelOffsetScaleByDistance`, `Label.setPixelOffsetScaleByDistance`, `DynamicBillboard.pixelOffsetScaleByDistance`, and `DynamicLabel.pixelOffsetScaleByDistance` to control minimum/maximum pixelOffset scaling based on camera distance. From 79903c083be3ecfe60b5c9b286cee4e4b57db095 Mon Sep 17 00:00:00 2001 From: Scott Hunter Date: Wed, 18 Dec 2013 17:27:54 -0500 Subject: [PATCH 33/33] Fix some path problems when building the zip file. Set pragmas.debug=false for CesiumViewer. --- build.xml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/build.xml b/build.xml index c9417b60781e..8b8fd4c1138d 100644 --- a/build.xml +++ b/build.xml @@ -30,8 +30,8 @@ - - + + @@ -84,14 +84,14 @@ - + - + @@ -535,10 +535,6 @@ - - - - @@ -554,6 +550,7 @@ +