diff --git a/Apps/Sandcastle/gallery/Star Burst.html b/Apps/Sandcastle/gallery/Star Burst.html index f5c3a0520880..d34571c322d5 100644 --- a/Apps/Sandcastle/gallery/Star Burst.html +++ b/Apps/Sandcastle/gallery/Star Burst.html @@ -93,7 +93,7 @@ var diff = Cesium.Cartesian3.subtract(entityPosition, camera.positionWC, new Cesium.Cartesian3()); var distance = Cesium.Cartesian3.dot(camera.directionWC, diff); - var dimensions = camera.frustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, pixelRatio, distance, new Cesium.Cartesian2()); + var dimensions = camera.frustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, pixelRatio, new Cesium.Cartesian2()); Cesium.Cartesian2.multiplyByScalar(offset, Cesium.Cartesian2.maximumComponent(dimensions), offset); var labelOffset; diff --git a/CHANGES.md b/CHANGES.md index 21846a600943..3d57657e8597 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,8 +3,11 @@ Change Log ### 1.63 - 2019-11-01 +##### Deprecated :hourglass_flowing_sand: +* `OrthographicFrustum.getPixelDimensions`, `OrthographicOffCenterFrustum.getPixelDimensions`, `PerspectiveFrustum.getPixelDimensions`, and `PerspectiveOffCenterFrustum.getPixelDimensions` now take a `pixelRatio` argument before the `result` argument. The previous function definition will no longer work in 1.65. [#8237](https://github.com/AnalyticalGraphicsInc/cesium/pull/8237) + ##### Additions :tada: -* Added `pixelRatio` parameter to `OrthographicFrustum.getPixelDimensions`, `OrthographicOffCenterFrustum.getPixelDimensions`, `PerspectiveFrustum.getPixelDimensions`, and `PerspectiveOffCenterFrustum.getPixelDimensions`. Pass in `scene.pixelRatio` for dimensions in CSS pixel units or `1.0` for dimensions in native device pixel units. +* Added `pixelRatio` parameter to `OrthographicFrustum.getPixelDimensions`, `OrthographicOffCenterFrustum.getPixelDimensions`, `PerspectiveFrustum.getPixelDimensions`, and `PerspectiveOffCenterFrustum.getPixelDimensions`. Pass in `scene.pixelRatio` for dimensions in CSS pixel units or `1.0` for dimensions in native device pixel units. [#8237](https://github.com/AnalyticalGraphicsInc/cesium/pull/8237) ##### Fixes :wrench: * Fixed css pixel usage for polylines, point clouds, models, primitives, and post-processing. [#8113](https://github.com/AnalyticalGraphicsInc/cesium/issues/8113) diff --git a/Source/Core/OrthographicFrustum.js b/Source/Core/OrthographicFrustum.js index 7e3ac0a3a711..5f3cd11f07c2 100644 --- a/Source/Core/OrthographicFrustum.js +++ b/Source/Core/OrthographicFrustum.js @@ -1,3 +1,4 @@ +import Cartesian2 from './Cartesian2.js'; import Check from './Check.js'; import defaultValue from './defaultValue.js'; import defined from './defined.js'; @@ -199,8 +200,8 @@ import OrthographicOffCenterFrustum from './OrthographicOffCenterFrustum.js'; * * @param {Number} drawingBufferWidth The width of the drawing buffer. * @param {Number} drawingBufferHeight The height of the drawing buffer. - * @param {Number} pixelRatio The scaling factor from pixel space to coordinate space. * @param {Number} distance The distance to the near plane in meters. + * @param {Number} pixelRatio The scaling factor from pixel space to coordinate space. * @param {Cartesian2} result The object onto which to store the result. * @returns {Cartesian2} The modified result parameter or a new instance of {@link Cartesian2} with the pixel's width and height in the x and y properties, respectively. * @@ -211,11 +212,17 @@ import OrthographicOffCenterFrustum from './OrthographicOffCenterFrustum.js'; * @example * // Example 1 * // Get the width and height of a pixel. - * var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, scene.pixelRatio, 0.0, new Cesium.Cartesian2()); + * var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 0.0, scene.pixelRatio, new Cesium.Cartesian2()); */ - OrthographicFrustum.prototype.getPixelDimensions = function(drawingBufferWidth, drawingBufferHeight, pixelRatio, distance, result) { + OrthographicFrustum.prototype.getPixelDimensions = function(drawingBufferWidth, drawingBufferHeight, distance, pixelRatio, result) { update(this); - return this._offCenterFrustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, pixelRatio, distance, result); + + if (pixelRatio instanceof Cartesian2) { + result = pixelRatio; + pixelRatio = 1.0; + deprecationWarning('getPixelDimensions-parameter-change', 'getPixelDimensions now takes a pixelRatio argument before the result argument in Cesium 1.63. The previous function definition will no longer work in 1.65.'); + } + return this._offCenterFrustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, pixelRatio, result); }; /** diff --git a/Source/Core/OrthographicOffCenterFrustum.js b/Source/Core/OrthographicOffCenterFrustum.js index 90b8d0789aed..88b09b60df56 100644 --- a/Source/Core/OrthographicOffCenterFrustum.js +++ b/Source/Core/OrthographicOffCenterFrustum.js @@ -1,3 +1,4 @@ +import Cartesian2 from './Cartesian2.js'; import Cartesian3 from './Cartesian3.js'; import Cartesian4 from './Cartesian4.js'; import CullingVolume from './CullingVolume.js'; @@ -271,8 +272,8 @@ import Matrix4 from './Matrix4.js'; * * @param {Number} drawingBufferWidth The width of the drawing buffer. * @param {Number} drawingBufferHeight The height of the drawing buffer. - * @param {Number} pixelRatio The scaling factor from pixel space to coordinate space. * @param {Number} distance The distance to the near plane in meters. + * @param {Number} pixelRatio The scaling factor from pixel space to coordinate space. * @param {Cartesian2} result The object onto which to store the result. * @returns {Cartesian2} The modified result parameter or a new instance of {@link Cartesian2} with the pixel's width and height in the x and y properties, respectively. * @@ -283,11 +284,17 @@ import Matrix4 from './Matrix4.js'; * @example * // Example 1 * // Get the width and height of a pixel. - * var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, scene.pixelRatio, 0.0, new Cesium.Cartesian2()); + * var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 0.0, scene.pixelRatio, new Cesium.Cartesian2()); */ - OrthographicOffCenterFrustum.prototype.getPixelDimensions = function(drawingBufferWidth, drawingBufferHeight, pixelRatio, distance, result) { + OrthographicOffCenterFrustum.prototype.getPixelDimensions = function(drawingBufferWidth, drawingBufferHeight, distance, pixelRatio, result) { update(this); + if (pixelRatio instanceof Cartesian2) { + result = pixelRatio; + pixelRatio = 1.0; + deprecationWarning('getPixelDimensions-parameter-change', 'getPixelDimensions now takes a pixelRatio argument before the result argument in Cesium 1.63. The previous function definition will no longer work in 1.65.'); + } + //>>includeStart('debug', pragmas.debug); if (!defined(drawingBufferWidth) || !defined(drawingBufferHeight)) { throw new DeveloperError('Both drawingBufferWidth and drawingBufferHeight are required.'); @@ -298,15 +305,15 @@ import Matrix4 from './Matrix4.js'; if (drawingBufferHeight <= 0) { throw new DeveloperError('drawingBufferHeight must be greater than zero.'); } + if (!defined(distance)) { + throw new DeveloperError('distance is required.'); + } if (!defined(pixelRatio)) { throw new DeveloperError('pixelRatio is required.'); } if (pixelRatio <= 0) { throw new DeveloperError('pixelRatio must be greater than zero.'); } - if (!defined(distance)) { - throw new DeveloperError('distance is required.'); - } if (!defined(result)) { throw new DeveloperError('A result object is required.'); } diff --git a/Source/Core/PerspectiveFrustum.js b/Source/Core/PerspectiveFrustum.js index 1337ce6d73ad..4f76eb286326 100644 --- a/Source/Core/PerspectiveFrustum.js +++ b/Source/Core/PerspectiveFrustum.js @@ -1,3 +1,4 @@ +import Cartesian2 from './Cartesian2.js'; import Check from './Check.js'; import defaultValue from './defaultValue.js'; import defined from './defined.js'; @@ -283,8 +284,8 @@ import PerspectiveOffCenterFrustum from './PerspectiveOffCenterFrustum.js'; * * @param {Number} drawingBufferWidth The width of the drawing buffer. * @param {Number} drawingBufferHeight The height of the drawing buffer. - * @param {Number} pixelRatio The scaling factor from pixel space to coordinate space. * @param {Number} distance The distance to the near plane in meters. + * @param {Number} pixelRatio The scaling factor from pixel space to coordinate space. * @param {Cartesian2} result The object onto which to store the result. * @returns {Cartesian2} The modified result parameter or a new instance of {@link Cartesian2} with the pixel's width and height in the x and y properties, respectively. * @@ -295,7 +296,7 @@ import PerspectiveOffCenterFrustum from './PerspectiveOffCenterFrustum.js'; * @example * // Example 1 * // Get the width and height of a pixel. - * var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, scene.pixelRatio, 1.0, new Cesium.Cartesian2()); + * var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 1.0, scene.pixelRatio, new Cesium.Cartesian2()); * * @example * // Example 2 @@ -306,11 +307,18 @@ import PerspectiveOffCenterFrustum from './PerspectiveOffCenterFrustum.js'; * var toCenter = Cesium.Cartesian3.subtract(primitive.boundingVolume.center, position, new Cesium.Cartesian3()); // vector from camera to a primitive * var toCenterProj = Cesium.Cartesian3.multiplyByScalar(direction, Cesium.Cartesian3.dot(direction, toCenter), new Cesium.Cartesian3()); // project vector onto camera direction vector * var distance = Cesium.Cartesian3.magnitude(toCenterProj); - * var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, scene.pixelRatio, distance, new Cesium.Cartesian2()); + * var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, scene.pixelRatio, new Cesium.Cartesian2()); */ - PerspectiveFrustum.prototype.getPixelDimensions = function(drawingBufferWidth, drawingBufferHeight, pixelRatio, distance, result) { + PerspectiveFrustum.prototype.getPixelDimensions = function(drawingBufferWidth, drawingBufferHeight, distance, pixelRatio, result) { update(this); - return this._offCenterFrustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, pixelRatio, distance, result); + + if (pixelRatio instanceof Cartesian2) { + result = pixelRatio; + pixelRatio = 1.0; + deprecationWarning('getPixelDimensions-parameter-change', 'getPixelDimensions now takes a pixelRatio argument before the result argument in Cesium 1.63. The previous function definition will no longer work in 1.65.'); + } + + return this._offCenterFrustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, pixelRatio, result); }; /** diff --git a/Source/Core/PerspectiveOffCenterFrustum.js b/Source/Core/PerspectiveOffCenterFrustum.js index 22c0b1758237..5c9cfd35f08d 100644 --- a/Source/Core/PerspectiveOffCenterFrustum.js +++ b/Source/Core/PerspectiveOffCenterFrustum.js @@ -1,3 +1,4 @@ +import Cartesian2 from './Cartesian2.js'; import Cartesian3 from './Cartesian3.js'; import Cartesian4 from './Cartesian4.js'; import CullingVolume from './CullingVolume.js'; @@ -310,8 +311,8 @@ import Matrix4 from './Matrix4.js'; * * @param {Number} drawingBufferWidth The width of the drawing buffer. * @param {Number} drawingBufferHeight The height of the drawing buffer. - * @param {Number} pixelRatio The scaling factor from pixel space to coordinate space. * @param {Number} distance The distance to the near plane in meters. + * @param {Number} pixelRatio The scaling factor from pixel space to coordinate space. * @param {Cartesian2} result The object onto which to store the result. * @returns {Cartesian2} The modified result parameter or a new instance of {@link Cartesian2} with the pixel's width and height in the x and y properties, respectively. * @@ -322,7 +323,7 @@ import Matrix4 from './Matrix4.js'; * @example * // Example 1 * // Get the width and height of a pixel. - * var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, scene.pixelRatio, 1.0, new Cesium.Cartesian2()); + * var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 1.0, scene.pixelRatio, new Cesium.Cartesian2()); * * @example * // Example 2 @@ -333,11 +334,17 @@ import Matrix4 from './Matrix4.js'; * var toCenter = Cesium.Cartesian3.subtract(primitive.boundingVolume.center, position, new Cesium.Cartesian3()); // vector from camera to a primitive * var toCenterProj = Cesium.Cartesian3.multiplyByScalar(direction, Cesium.Cartesian3.dot(direction, toCenter), new Cesium.Cartesian3()); // project vector onto camera direction vector * var distance = Cesium.Cartesian3.magnitude(toCenterProj); - * var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, scene.pixelRatio, distance, new Cesium.Cartesian2()); + * var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, scene.pixelRatio, new Cesium.Cartesian2()); */ - PerspectiveOffCenterFrustum.prototype.getPixelDimensions = function(drawingBufferWidth, drawingBufferHeight, pixelRatio, distance, result) { + PerspectiveOffCenterFrustum.prototype.getPixelDimensions = function(drawingBufferWidth, drawingBufferHeight, distance, pixelRatio, result) { update(this); + if (pixelRatio instanceof Cartesian2) { + result = pixelRatio; + pixelRatio = 1.0; + deprecationWarning('getPixelDimensions-parameter-change', 'getPixelDimensions now takes a pixelRatio argument before the result argument in Cesium 1.63. The previous function definition will no longer work in 1.65.'); + } + //>>includeStart('debug', pragmas.debug); if (!defined(drawingBufferWidth) || !defined(drawingBufferHeight)) { throw new DeveloperError('Both drawingBufferWidth and drawingBufferHeight are required.'); @@ -348,15 +355,15 @@ import Matrix4 from './Matrix4.js'; if (drawingBufferHeight <= 0) { throw new DeveloperError('drawingBufferHeight must be greater than zero.'); } + if (!defined(distance)) { + throw new DeveloperError('distance is required.'); + } if (!defined(pixelRatio)) { throw new DeveloperError('pixelRatio is required'); } if (pixelRatio <= 0) { throw new DeveloperError('pixelRatio must be greater than zero.'); } - if (!defined(distance)) { - throw new DeveloperError('distance is required.'); - } if (!defined(result)) { throw new DeveloperError('A result object is required.'); } diff --git a/Source/Scene/Camera.js b/Source/Scene/Camera.js index 80f0db65faa8..ed43698b6ed0 100644 --- a/Source/Scene/Camera.js +++ b/Source/Scene/Camera.js @@ -2652,7 +2652,7 @@ import SceneMode from './SceneMode.js'; //>>includeEnd('debug'); var distance = this.distanceToBoundingSphere(boundingSphere); - var pixelSize = this.frustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, this._scene.pixelRatio, distance, scratchPixelSize); + var pixelSize = this.frustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, this._scene.pixelRatio, scratchPixelSize); return Math.max(pixelSize.x, pixelSize.y); }; diff --git a/Specs/Core/OrthographicFrustumSpec.js b/Specs/Core/OrthographicFrustumSpec.js index 27fb245a331f..a4bcb6e2d70b 100644 --- a/Specs/Core/OrthographicFrustumSpec.js +++ b/Specs/Core/OrthographicFrustumSpec.js @@ -139,31 +139,31 @@ describe('Core/OrthographicFrustum', function() { it('get pixel dimensions throws without canvas height', function() { expect(function() { - return frustum.getPixelDimensions(1.0, undefined, 1.0, 0.0, new Cartesian2()); + return frustum.getPixelDimensions(1.0, undefined, 0.0, 1.0, new Cartesian2()); }).toThrowDeveloperError(); }); it('get pixel dimensions throws without canvas width', function() { expect(function() { - return frustum.getPixelDimensions(undefined, 1.0, 1.0, 0.0, new Cartesian2()); + return frustum.getPixelDimensions(undefined, 1.0, 0.0, 1.0, new Cartesian2()); }).toThrowDeveloperError(); }); it('get pixel dimensions throws with canvas width less than or equal to zero', function() { expect(function() { - return frustum.getPixelDimensions(0.0, 1.0, 1.0, 0.0, new Cartesian2()); + return frustum.getPixelDimensions(0.0, 1.0, 0.0, 1.0, new Cartesian2()); }).toThrowDeveloperError(); }); it('get pixel dimensions throws with canvas height less than or equal to zero', function() { expect(function() { - return frustum.getPixelDimensions(1.0, 0.0, 1.0, 0.0, new Cartesian2()); + return frustum.getPixelDimensions(1.0, 0.0, 0.0, 1.0, new Cartesian2()); }).toThrowDeveloperError(); }); it('get pixel dimensions throws without pixel ratio', function() { expect(function() { - return frustum.getPixelDimensions(1.0, 1.0, undefined, 0.0, new Cartesian2()); + return frustum.getPixelDimensions(1.0, 1.0, 0.0, undefined, new Cartesian2()); }).toThrowDeveloperError(); }); @@ -177,8 +177,8 @@ describe('Core/OrthographicFrustum', function() { var dimensions = new Cartesian2(1.0, 1.0); var pixelRatio = 1.0; var distance = 1.0; - var pixelSize = frustum.getPixelDimensions(dimensions.x, dimensions.y, pixelRatio, distance, new Cartesian2()); - var expected = frustum._offCenterFrustum.getPixelDimensions(dimensions.x, dimensions.y, pixelRatio, distance, new Cartesian2()); + var pixelSize = frustum.getPixelDimensions(dimensions.x, dimensions.y, distance, pixelRatio, new Cartesian2()); + var expected = frustum._offCenterFrustum.getPixelDimensions(dimensions.x, dimensions.y, distance, pixelRatio, new Cartesian2()); expect(pixelSize.x).toEqual(expected.x); expect(pixelSize.y).toEqual(expected.y); }); @@ -187,8 +187,8 @@ describe('Core/OrthographicFrustum', function() { var dimensions = new Cartesian2(1.0, 1.0); var pixelRatio = 2.0; var distance = 1.0; - var pixelSize = frustum.getPixelDimensions(dimensions.x, dimensions.y, pixelRatio, distance, new Cartesian2()); - var expected = frustum._offCenterFrustum.getPixelDimensions(dimensions.x, dimensions.y, pixelRatio, distance, new Cartesian2()); + var pixelSize = frustum.getPixelDimensions(dimensions.x, dimensions.y, distance, pixelRatio, new Cartesian2()); + var expected = frustum._offCenterFrustum.getPixelDimensions(dimensions.x, dimensions.y, distance, pixelRatio, new Cartesian2()); expect(pixelSize.x).toEqual(expected.x); expect(pixelSize.y).toEqual(expected.y); }); diff --git a/Specs/Core/OrthographicOffCenterFrustumSpec.js b/Specs/Core/OrthographicOffCenterFrustumSpec.js index 2fe8cba0c460..497ea8c5b0d4 100644 --- a/Specs/Core/OrthographicOffCenterFrustumSpec.js +++ b/Specs/Core/OrthographicOffCenterFrustumSpec.js @@ -141,31 +141,31 @@ describe('Core/OrthographicOffCenterFrustum', function() { it('get pixel dimensions throws without canvas height', function() { expect(function() { - return frustum.getPixelDimensions(1.0, undefined, 1.0, 0.0, new Cartesian2()); + return frustum.getPixelDimensions(1.0, undefined, 0.0, 1.0, new Cartesian2()); }).toThrowDeveloperError(); }); it('get pixel dimensions throws without canvas width', function() { expect(function() { - return frustum.getPixelDimensions(undefined, 1.0, 1.0, 0.0, new Cartesian2()); + return frustum.getPixelDimensions(undefined, 1.0, 0.0, 1.0, new Cartesian2()); }).toThrowDeveloperError(); }); it('get pixel dimensions throws with canvas width less than or equal to zero', function() { expect(function() { - return frustum.getPixelDimensions(0.0, 1.0, 1.0, 0.0, new Cartesian2()); + return frustum.getPixelDimensions(0.0, 1.0, 0.0, 1.0, new Cartesian2()); }).toThrowDeveloperError(); }); it('get pixel dimensions throws with canvas height less than or equal to zero', function() { expect(function() { - return frustum.getPixelDimensions(1.0, 0.0, 1.0, 0.0, new Cartesian2()); + return frustum.getPixelDimensions(1.0, 0.0, 0.0, 1.0, new Cartesian2()); }).toThrowDeveloperError(); }); it('get pixel dimensions throws without pixel ratio', function() { expect(function() { - return frustum.getPixelDimensions(1.0, 1.0, undefined, 0.0, new Cartesian2()); + return frustum.getPixelDimensions(1.0, 1.0, 0.0, undefined, new Cartesian2()); }).toThrowDeveloperError(); }); @@ -176,13 +176,13 @@ describe('Core/OrthographicOffCenterFrustum', function() { }); it('get pixel dimensions', function() { - var pixelSize = frustum.getPixelDimensions(1.0, 1.0, 1.0, 0.0, new Cartesian2()); + var pixelSize = frustum.getPixelDimensions(1.0, 1.0, 0.0, 1.0, new Cartesian2()); expect(pixelSize.x).toEqual(2.0); expect(pixelSize.y).toEqual(2.0); }); it('get pixel dimensions with pixel ratio', function() { - var pixelSize = frustum.getPixelDimensions(1.0, 1.0, 2.0, 0.0, new Cartesian2()); + var pixelSize = frustum.getPixelDimensions(1.0, 1.0, 0.0, 2.0, new Cartesian2()); expect(pixelSize.x).toEqual(4.0); expect(pixelSize.y).toEqual(4.0); }); diff --git a/Specs/Core/PerspectiveFrustumSpec.js b/Specs/Core/PerspectiveFrustumSpec.js index 5a89c7edd0ef..11bdafe3963f 100644 --- a/Specs/Core/PerspectiveFrustumSpec.js +++ b/Specs/Core/PerspectiveFrustumSpec.js @@ -181,13 +181,13 @@ describe('Core/PerspectiveFrustum', function() { it('get pixel dimensions throws without pixel ratio', function() { expect(function() { - return frustum.getPixelDimensions(1.0, 1.0, undefined, 1.0, new Cartesian2()); + return frustum.getPixelDimensions(1.0, 1.0, 1.0, undefined, new Cartesian2()); }).toThrowDeveloperError(); }); it('get pixel dimensions throws with pixel ratio less than or equal to zero', function() { expect(function() { - return frustum.getPixelDimensions(1.0, 1.0, 0.0, 1.0, new Cartesian2()); + return frustum.getPixelDimensions(1.0, 1.0, 1.0, 0.0, new Cartesian2()); }).toThrowDeveloperError(); }); @@ -195,8 +195,8 @@ describe('Core/PerspectiveFrustum', function() { var dimensions = new Cartesian2(1.0, 1.0); var pixelRatio = 1.0; var distance = 1.0; - var pixelSize = frustum.getPixelDimensions(dimensions.x, dimensions.y, pixelRatio, distance, new Cartesian2()); - var expected = frustum._offCenterFrustum.getPixelDimensions(dimensions.x, dimensions.y, pixelRatio, distance, new Cartesian2()); + var pixelSize = frustum.getPixelDimensions(dimensions.x, dimensions.y, distance, pixelRatio, new Cartesian2()); + var expected = frustum._offCenterFrustum.getPixelDimensions(dimensions.x, dimensions.y, distance, pixelRatio, new Cartesian2()); expect(pixelSize.x).toEqual(expected.x); expect(pixelSize.y).toEqual(expected.y); }); @@ -205,8 +205,8 @@ describe('Core/PerspectiveFrustum', function() { var dimensions = new Cartesian2(1.0, 1.0); var pixelRatio = 2.0; var distance = 1.0; - var pixelSize = frustum.getPixelDimensions(dimensions.x, dimensions.y, pixelRatio, distance, new Cartesian2()); - var expected = frustum._offCenterFrustum.getPixelDimensions(dimensions.x, dimensions.y, pixelRatio, distance, new Cartesian2()); + var pixelSize = frustum.getPixelDimensions(dimensions.x, dimensions.y, distance, pixelRatio, new Cartesian2()); + var expected = frustum._offCenterFrustum.getPixelDimensions(dimensions.x, dimensions.y, distance, pixelRatio, new Cartesian2()); expect(pixelSize.x).toEqual(expected.x); expect(pixelSize.y).toEqual(expected.y); }); diff --git a/Specs/Core/PerspectiveOffCenterFrustumSpec.js b/Specs/Core/PerspectiveOffCenterFrustumSpec.js index 89da25618e1c..f54c559d0d92 100644 --- a/Specs/Core/PerspectiveOffCenterFrustumSpec.js +++ b/Specs/Core/PerspectiveOffCenterFrustumSpec.js @@ -169,13 +169,13 @@ describe('Core/PerspectiveOffCenterFrustum', function() { it('get pixel dimensions throws without pixel ratio', function() { expect(function() { - return frustum.getPixelDimensions(1.0, 1.0, undefined, 1.0, new Cartesian2()); + return frustum.getPixelDimensions(1.0, 1.0, 1.0, undefined, new Cartesian2()); }).toThrowDeveloperError(); }); it('get pixel dimensions throws with pixel ratio less than or equal to zero', function() { expect(function() { - return frustum.getPixelDimensions(1.0, 1.0, 0.0, 1.0, new Cartesian2()); + return frustum.getPixelDimensions(1.0, 1.0, 1.0, 0.0, new Cartesian2()); }).toThrowDeveloperError(); }); @@ -186,7 +186,7 @@ describe('Core/PerspectiveOffCenterFrustum', function() { }); it('get pixel dimensions with pixel ratio', function() { - var pixelSize = frustum.getPixelDimensions(1.0, 1.0, 2.0, 1.0, new Cartesian2()); + var pixelSize = frustum.getPixelDimensions(1.0, 1.0, 1.0, 2.0, new Cartesian2()); expect(pixelSize.x).toEqual(4.0); expect(pixelSize.y).toEqual(4.0); }); diff --git a/Specs/Scene/BillboardCollectionSpec.js b/Specs/Scene/BillboardCollectionSpec.js index ede11daf1337..01883c67f838 100644 --- a/Specs/Scene/BillboardCollectionSpec.js +++ b/Specs/Scene/BillboardCollectionSpec.js @@ -1451,7 +1451,7 @@ describe('Scene/BillboardCollection', function() { var vectorProjection = Cartesian3.multiplyByScalar(camera.direction, Cartesian3.dot(diff, camera.direction), new Cartesian3()); var distance = Math.max(0.0, Cartesian3.magnitude(vectorProjection) - bs.radius); - var pixelSize = camera.frustum.getPixelDimensions(dimensions.x, dimensions.y, scene.pixelRatio, distance, new Cartesian2()); + var pixelSize = camera.frustum.getPixelDimensions(dimensions.x, dimensions.y, distance, scene.pixelRatio, new Cartesian2()); bs.radius += pixelSize.y * 0.25 * Math.max(greenImage.width, greenImage.height) + pixelSize.y * one.pixelOffset.y; expect(actual.center).toEqual(bs.center); diff --git a/Specs/Scene/CameraSpec.js b/Specs/Scene/CameraSpec.js index 2ab43e478d5a..581363eab74a 100644 --- a/Specs/Scene/CameraSpec.js +++ b/Specs/Scene/CameraSpec.js @@ -2777,7 +2777,7 @@ describe('Scene/Camera', function() { // Compute expected pixel size var distance = camera.distanceToBoundingSphere(sphere); - var pixelDimensions = camera.frustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, scene.pixelRatio, distance, new Cartesian2()); + var pixelDimensions = camera.frustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, scene.pixelRatio, new Cartesian2()); var expectedPixelSize = Math.max(pixelDimensions.x, pixelDimensions.y); var pixelSize = camera.getPixelSize(sphere, drawingBufferWidth, drawingBufferHeight);