diff --git a/Apps/Sandcastle/gallery/Star Burst.html b/Apps/Sandcastle/gallery/Star Burst.html index ba67dfb41de..539b432f3e2 100644 --- a/Apps/Sandcastle/gallery/Star Burst.html +++ b/Apps/Sandcastle/gallery/Star Burst.html @@ -320,7 +320,7 @@ // Remove the star burst if the mouse exits the screen space circle. // If the mouse is inside the circle, show the label of the billboard the mouse is hovering over. - const screenPosition = Cesium.SceneTransforms.wgs84ToWindowCoordinates( + const screenPosition = Cesium.SceneTransforms.worldToWindowCoordinates( scene, starBurstState.center ); diff --git a/CHANGES.md b/CHANGES.md index c1987653cb5..f25962e4bed 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -23,6 +23,9 @@ ##### Breaking Changes :mega: +- `SceneTransforms.wgs84ToWindowCoordinates` has been removed. Use `SceneTransforms.worldToWindowCoordinates` instead. +- `SceneTransforms.wgs84ToDrawingBufferCoordinates` has been removed. Use `SceneTransforms.worldToDrawingBufferCoordinates` instead. + - Removed `jitter` option from `VoxelPrimitive.js`, `VoxelRenderResources.js`, and related test code in `VoxelPrimitiveSpec.js`. [#11913](https://github.com/CesiumGS/cesium/issues/11913) - Custom specular environment maps in `ImageBasedLighting` now require either a WebGL2 context or a WebGL1 context that supports the [`EXT_shader_texture_lod` extension](https://registry.khronos.org/webgl/extensions/EXT_shader_texture_lod/). diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 473b80fe3d0..d38bd04d9ac 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -406,3 +406,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu - [Levi Montgomery](https://github.com/Levi-Montgomery) - [Brandon Berisford](https://github.com/BeyondBelief96) - [Adam Wirth](https://https://github.com/adamwirth) +- [Javier Sanchez](https://github.com/jvrjsanchez) diff --git a/packages/engine/Source/Scene/SceneTransforms.js b/packages/engine/Source/Scene/SceneTransforms.js index df0954df213..84ae7a032b5 100644 --- a/packages/engine/Source/Scene/SceneTransforms.js +++ b/packages/engine/Source/Scene/SceneTransforms.js @@ -4,7 +4,6 @@ import Cartesian3 from "../Core/Cartesian3.js"; import Cartesian4 from "../Core/Cartesian4.js"; import Cartographic from "../Core/Cartographic.js"; import defined from "../Core/defined.js"; -import deprecationWarning from "../Core/deprecationWarning.js"; import DeveloperError from "../Core/DeveloperError.js"; import CesiumMath from "../Core/Math.js"; import Matrix4 from "../Core/Matrix4.js"; @@ -53,33 +52,6 @@ SceneTransforms.worldToWindowCoordinates = function (scene, position, result) { ); }; -/** - * Transforms a position in WGS84 coordinates to window coordinates. This is commonly used to place an - * HTML element at the same screen position as an object in the scene. - * - * @param {Scene} scene The scene. - * @param {Cartesian3} position The position in WGS84 (world) coordinates. - * @param {Cartesian2} [result] An optional object to return the input position transformed to window coordinates. - * @returns {Cartesian2|undefined} The modified result parameter or a new Cartesian2 instance if one was not provided. This may be undefined if the input position is near the center of the ellipsoid. - * - * @example - * // Output the window position of longitude/latitude (0, 0) every time the mouse moves. - * const scene = widget.scene; - * const ellipsoid = scene.ellipsoid; - * const position = Cesium.Cartesian3.fromDegrees(0.0, 0.0); - * const handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); - * handler.setInputAction(function(movement) { - * console.log(Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position)); - * }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); - */ -SceneTransforms.wgs84ToWindowCoordinates = function (scene, position, result) { - deprecationWarning( - "SceneTransforms.wgs84ToWindowCoordinates", - "SceneTransforms.wgs84ToWindowCoordinates has been deprecated. It will be removed in 1.21. Use SceneTransforms.worldToWindowCoordinates instead." - ); - return SceneTransforms.worldToWindowCoordinates(scene, position, result); -}; - const scratchCartesian4 = new Cartesian4(); const scratchEyeOffset = new Cartesian3(); @@ -320,40 +292,6 @@ SceneTransforms.worldToDrawingBufferCoordinates = function ( return SceneTransforms.transformWindowToDrawingBuffer(scene, result, result); }; -/** - * Transforms a position in world coordinates to drawing buffer coordinates. This may produce different - * results from SceneTransforms.wgs84ToWindowCoordinates when the browser zoom is not 100%, or on high-DPI displays. - * - * @param {Scene} scene The scene. - * @param {Cartesian3} position The position in world (WGS84 or alternative ellipsoid) coordinates. - * @param {Cartesian2} [result] An optional object to return the input position transformed to window coordinates. - * @returns {Cartesian2|undefined} The modified result parameter or a new Cartesian2 instance if one was not provided. This may be undefined if the input position is near the center of the ellipsoid. - * - * @example - * // Output the window position of longitude/latitude (0, 0) every time the mouse moves. - * const position = Cesium.Cartesian3.fromDegrees(0.0, 0.0); - * const handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); - * handler.setInputAction(function(movement) { - * console.log(Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position)); - * }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); - */ -SceneTransforms.wgs84ToDrawingBufferCoordinates = function ( - scene, - position, - result -) { - deprecationWarning( - "SceneTransforms.wgs84ToDrawingBufferCoordinates", - "SceneTransforms.wgs84ToDrawingBufferCoordinates has been deprecated. It will be removed in 1.21. Use SceneTransforms.worldToDrawingBufferCoordinates instead." - ); - - return SceneTransforms.worldToDrawingBufferCoordinates( - scene, - position, - result - ); -}; - const projectedPosition = new Cartesian3(); const positionInCartographic = new Cartographic(); diff --git a/packages/engine/Specs/Scene/SceneTransformsSpec.js b/packages/engine/Specs/Scene/SceneTransformsSpec.js index 0839423d89e..180a57ed445 100644 --- a/packages/engine/Specs/Scene/SceneTransformsSpec.js +++ b/packages/engine/Specs/Scene/SceneTransformsSpec.js @@ -40,13 +40,13 @@ describe( it("throws an exception without scene", function () { const position = Cartesian3.fromDegrees(0.0, 0.0); expect(function () { - SceneTransforms.wgs84ToWindowCoordinates(undefined, position); + SceneTransforms.worldToWindowCoordinates(undefined, position); }).toThrowDeveloperError(); }); it("throws an exception without position", function () { expect(function () { - SceneTransforms.wgs84ToWindowCoordinates(scene); + SceneTransforms.worldToWindowCoordinates(scene); }).toThrowDeveloperError(); }); @@ -61,7 +61,7 @@ describe( // Update scene state scene.renderForSpecs(); - const windowCoordinates = SceneTransforms.wgs84ToWindowCoordinates( + const windowCoordinates = SceneTransforms.worldToWindowCoordinates( scene, position ); @@ -80,7 +80,7 @@ describe( // Update scene state scene.renderForSpecs(); - const drawingBufferCoordinates = SceneTransforms.wgs84ToDrawingBufferCoordinates( + const drawingBufferCoordinates = SceneTransforms.worldToDrawingBufferCoordinates( scene, position ); @@ -105,7 +105,7 @@ describe( // Update scene state scene.renderForSpecs(); - const windowCoordinates = SceneTransforms.wgs84ToWindowCoordinates( + const windowCoordinates = SceneTransforms.worldToWindowCoordinates( scene, position ); @@ -123,7 +123,7 @@ describe( // Update scene state scene.renderForSpecs(); - const drawingBufferCoordinates = SceneTransforms.wgs84ToDrawingBufferCoordinates( + const drawingBufferCoordinates = SceneTransforms.worldToDrawingBufferCoordinates( scene, position ); @@ -138,7 +138,7 @@ describe( const actualWindowCoordinates = new Cartesian2(0.5, 0.5); const position = scene.camera.pickEllipsoid(actualWindowCoordinates); - const windowCoordinates = SceneTransforms.wgs84ToWindowCoordinates( + const windowCoordinates = SceneTransforms.worldToWindowCoordinates( scene, position ); @@ -158,7 +158,7 @@ describe( actualDrawingBufferCoordinates ); - const drawingBufferCoordinates = SceneTransforms.wgs84ToDrawingBufferCoordinates( + const drawingBufferCoordinates = SceneTransforms.worldToDrawingBufferCoordinates( scene, position ); @@ -182,7 +182,7 @@ describe( scene.camera.direction ); - const windowCoordinates = SceneTransforms.wgs84ToWindowCoordinates( + const windowCoordinates = SceneTransforms.worldToWindowCoordinates( scene, position ); @@ -203,7 +203,7 @@ describe( scene.camera.direction ); - const drawingBufferCoordinates = SceneTransforms.wgs84ToDrawingBufferCoordinates( + const drawingBufferCoordinates = SceneTransforms.worldToDrawingBufferCoordinates( scene, position ); @@ -225,7 +225,7 @@ describe( scene.renderForSpecs(); const position = Cartesian3.fromDegrees(0, 0); - const windowCoordinates = SceneTransforms.wgs84ToWindowCoordinates( + const windowCoordinates = SceneTransforms.worldToWindowCoordinates( scene, position ); @@ -256,7 +256,7 @@ describe( }); const position = Cartesian3.fromDegrees(0, 0); - const windowCoordinates = SceneTransforms.wgs84ToWindowCoordinates( + const windowCoordinates = SceneTransforms.worldToWindowCoordinates( scene, position ); @@ -283,7 +283,7 @@ describe( scene.renderForSpecs(); const position = Cartesian3.fromDegrees(0, 0); - const drawingBufferCoordinates = SceneTransforms.wgs84ToDrawingBufferCoordinates( + const drawingBufferCoordinates = SceneTransforms.worldToDrawingBufferCoordinates( scene, position ); @@ -306,7 +306,7 @@ describe( scene.renderForSpecs(); const position = Cartesian3.fromDegrees(-80, 25); - const windowCoordinates = SceneTransforms.wgs84ToWindowCoordinates( + const windowCoordinates = SceneTransforms.worldToWindowCoordinates( scene, position );