Skip to content

Commit

Permalink
Merge pull request #8774 from CesiumGS/remove-suncolor
Browse files Browse the repository at this point in the history
Removed Scene.sunColor property
  • Loading branch information
lilleyse authored Apr 20, 2020
2 parents 7a50cb6 + 8e12cc5 commit 1ba02c3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 46 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
42 changes: 0 additions & 42 deletions Source/Scene/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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";
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 1 addition & 4 deletions Source/Scene/SunLight.js
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit 1ba02c3

Please sign in to comment.