diff --git a/CHANGES.md b/CHANGES.md index 518d3b3fc407..ea8256f390ef 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,10 @@ ### 1.69.0 - 2020-05-01 +##### Breaking Changes :mega: + +- The property `Scene.sunColor` has been removed. Use `scene.light.color` and `scene.light.intensity` instead. [#8774](https://github.com/CesiumGS/cesium/pull/8774) + ##### Additions :tada: - Added `Scene.cameraUnderground` for checking whether the camera is underneath the globe. [#8765](https://github.com/CesiumGS/cesium/pull/8765) diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 3e3e6784888e..47bc258c55db 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -2,7 +2,6 @@ import BoundingRectangle from "../Core/BoundingRectangle.js"; import BoundingSphere from "../Core/BoundingSphere.js"; import BoxGeometry from "../Core/BoxGeometry.js"; import Cartesian3 from "../Core/Cartesian3.js"; -import Cartesian4 from "../Core/Cartesian4.js"; import Cartographic from "../Core/Cartographic.js"; import clone from "../Core/clone.js"; import Color from "../Core/Color.js"; @@ -11,7 +10,6 @@ import createGuid from "../Core/createGuid.js"; import CullingVolume from "../Core/CullingVolume.js"; import defaultValue from "../Core/defaultValue.js"; import defined from "../Core/defined.js"; -import deprecationWarning from "../Core/deprecationWarning.js"; import destroyObject from "../Core/destroyObject.js"; import DeveloperError from "../Core/DeveloperError.js"; import EllipsoidGeometry from "../Core/EllipsoidGeometry.js"; @@ -782,8 +780,6 @@ function updateGlobeListeners(scene, globe) { scene._removeGlobeCallbacks = removeGlobeCallbacks; } -var scratchSunColor = new Cartesian4(); - Object.defineProperties(Scene.prototype, { /** * Gets the canvas element to which this scene is bound. @@ -1625,44 +1621,6 @@ Object.defineProperties(Scene.prototype, { }, }, - /** - * Gets or sets the color of the light emitted by the sun. - * - * @memberof Scene.prototype - * @type {Cartesian3} - * @default Cartesian3(1.8, 1.85, 2.0) - */ - sunColor: { - get: function () { - deprecationWarning( - "sun-color-removed", - "scene.sunColor will be removed in Cesium 1.69. Use scene.light.color and scene.light.intensity instead." - ); - return this.light.color; - }, - set: function (value) { - deprecationWarning( - "sun-color-removed", - "scene.sunColor will be removed in Cesium 1.69. Use scene.light.color and scene.light.intensity instead." - ); - var maximumComponent = Cartesian3.maximumComponent(value); - var sunColor = Cartesian4.fromElements( - value.x, - value.y, - value.z, - 1.0, - scratchSunColor - ); - var intensity = 1.0; - if (maximumComponent > 1.0) { - Cartesian3.divideByScalar(sunColor, maximumComponent, sunColor); // Don't divide alpha channel - intensity = maximumComponent; - } - this.light.color = Color.fromCartesian4(sunColor, this.light.color); - this.light.intensity = intensity; - }, - }, - /** * Ratio between a pixel and a density-independent pixel. Provides a standard unit of * measure for real pixel measurements appropriate to a particular device. diff --git a/Source/Scene/SunLight.js b/Source/Scene/SunLight.js index 261380fa596a..f4d738238d46 100644 --- a/Source/Scene/SunLight.js +++ b/Source/Scene/SunLight.js @@ -1,6 +1,5 @@ import Color from "../Core/Color.js"; import defaultValue from "../Core/defaultValue.js"; -import defined from "../Core/defined.js"; /** * A directional light source that originates from the Sun. @@ -19,9 +18,7 @@ function SunLight(options) { * @type {Color} * @default Color.WHITE */ - this.color = defined(options.color) - ? Color.clone(options.color) - : Color.WHITE; + this.color = Color.clone(defaultValue(options.color, Color.WHITE)); /** * The intensity of the light.