Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sun-position based atmosphere color #3955

Merged
merged 9 commits into from
May 26, 2016

Conversation

likangning93
Copy link
Contributor

As a partial response to #3439, enabled support for sun position based atmospheric color when drawing with enableLighting.

Also updated CHANGES.md.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 25, 2016

@likangning93 sounds great. When you open up a visual PR like this, we often include a screenshot (just drag and drop or copy and paste into the GitHub comment).

@@ -22,6 +22,7 @@ Change Log
* Added `CullingVolume.fromBoundingSphere`.
* Added `debugShowShadowVolume` to `GroundPrimitive`.
* Fixed issue where `Matrix4.fromCamera` was taking eye/target instead of position/direction. [3927](https://github.com/AnalyticalGraphicsInc/cesium/issues/3927)
* Added `setDayNight` to `SkyAtmosphere` to enable sun position based atmosphere color. Response to request for changeable atmosphere color. [3439](https://github.com/AnalyticalGraphicsInc/cesium/issues/3439)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the line "Response to request for changeable atmosphere color."

@lilleyse
Copy link
Contributor

That's all my comments. Also fix the merge conflict (probably just CHANGES.md related).

@likangning93
Copy link
Contributor Author

capture

@pjcozzi
Copy link
Contributor

pjcozzi commented May 25, 2016

Looks beautiful!

@@ -1876,6 +1876,9 @@ define([
var environmentState = scene._environmentState;
var renderPass = frameState.passes.render;
environmentState.skyBoxCommand = (renderPass && defined(scene.skyBox)) ? scene.skyBox.update(frameState) : undefined;
if (defined(scene.skyAtmosphere) && defined(scene.globe)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are reusing scene.skyAtmosphere a few times here and below, it would be better to write this as

var skyAtmosphere = scene.skyAtmosphere;

(same-ish for scene.globe).

See "Avoid redundant nested property access" here - https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Documentation/Contributors/CodingGuide#basic-code-construction

var innerRadius = ellipsoid.maximumRadius;
var rayleighScaleDepth = 0.25;
// camera height, outer radius, inner radius, dayNight flag
this._camAndRadiiAndDayNight = new Cartesian4();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually we try not to abbreviate names, so name it camera instead. Also as suggested by @pjcozzi there may be a better name for DayNight. Possibly dynamicLighting?

@likangning93
Copy link
Contributor Author

I pushed some changes.

@@ -118,7 +118,7 @@ define([
* @private
*/
SkyAtmosphere.prototype.setDayNight = function(enableLighting) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this name too.

@likangning93
Copy link
Contributor Author

Sorry about that. Updated.

@lilleyse
Copy link
Contributor

I fixed a couple last name changes, otherwise this all looks good to me.

var innerRadius = ellipsoid.maximumRadius;
var rayleighScaleDepth = 0.25;
// camera height, outer radius, inner radius, dynamic atmosphere color flag
this._cameraAndRadiiAndDynamicAtmosphereColor = new Cartesian4();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a style comment: we would generally write:

var cameraAndRadiiAndDynamicAtmosphereColor = new Cartesian4();
cameraAndRadiiAndDynamicAtmosphereColor.w = // ...
// ...
this._cameraAndRadiiAndDynamicAtmosphereColor = cameraAndRadiiAndDynamicAtmosphereColor;

@pjcozzi
Copy link
Contributor

pjcozzi commented May 26, 2016

Just that trivial comment. Look great!

@pjcozzi
Copy link
Contributor

pjcozzi commented May 26, 2016

Merge in master, there is probably a trivial conflict in CHANGES.md

@likangning93
Copy link
Contributor Author

The conflicting code was from my other pull request... I thought it looked familiar. Updated.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 26, 2016

Thanks. @lilleyse merge when ready!

@lilleyse lilleyse merged commit b290fae into CesiumGS:master May 26, 2016
@lilleyse lilleyse deleted the sunBasedAtmosphereColorChange branch May 26, 2016 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants