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

Picking fixes #4806

Merged
merged 4 commits into from
Jan 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Change Log
### 1.30 - 2017-02-01

* Updated the morph so the default view in Columbus View is now angled. [#3878](https://github.com/AnalyticalGraphicsInc/cesium/issues/3878)
* Fixed sky atmosphere from causing incorrect picking and hanging drill picking. [#4783](https://github.com/AnalyticalGraphicsInc/cesium/issues/4783) and [#4784](https://github.com/AnalyticalGraphicsInc/cesium/issues/4784)

### 1.29 - 2017-01-02

Expand Down
61 changes: 32 additions & 29 deletions Source/Scene/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,7 @@ define([
var scratchPerspectiveOffCenterFrustum = new PerspectiveOffCenterFrustum();
var scratchOrthographicFrustum = new OrthographicFrustum();

function executeCommands(scene, passState) {
function executeCommands(scene, passState, picking) {
var camera = scene._camera;
var context = scene.context;
var us = context.uniformState;
Expand All @@ -1648,37 +1648,40 @@ define([
us.updateFrustum(frustum);
us.updatePass(Pass.ENVIRONMENT);

var useWebVR = scene._useWebVR && scene.mode !== SceneMode.SCENE2D;
var environmentState = scene._environmentState;
var skyBoxCommand = environmentState.skyBoxCommand;
if (defined(skyBoxCommand)) {
executeCommand(skyBoxCommand, scene, context, passState);
}

if (environmentState.isSkyAtmosphereVisible) {
executeCommand(environmentState.skyAtmosphereCommand, scene, context, passState);
}
// Do not render environment primitives during a pick pass since they do not generate picking commands.
if (!picking) {
var skyBoxCommand = environmentState.skyBoxCommand;
if (defined(skyBoxCommand)) {
executeCommand(skyBoxCommand, scene, context, passState);
}

var useWebVR = scene._useWebVR && scene.mode !== SceneMode.SCENE2D;
if (environmentState.isSkyAtmosphereVisible) {
executeCommand(environmentState.skyAtmosphereCommand, scene, context, passState);
}

if (environmentState.isSunVisible) {
environmentState.sunDrawCommand.execute(context, passState);
if (scene.sunBloom && !useWebVR) {
var framebuffer;
if (environmentState.useGlobeDepthFramebuffer) {
framebuffer = scene._globeDepth.framebuffer;
} else if (environmentState.useFXAA) {
framebuffer = scene._fxaa.getColorFramebuffer();
} else {
framebuffer = environmentState.originalFramebuffer;
if (environmentState.isSunVisible) {
environmentState.sunDrawCommand.execute(context, passState);
if (scene.sunBloom && !useWebVR) {
var framebuffer;
if (environmentState.useGlobeDepthFramebuffer) {
framebuffer = scene._globeDepth.framebuffer;
} else if (environmentState.useFXAA) {
framebuffer = scene._fxaa.getColorFramebuffer();
} else {
framebuffer = environmentState.originalFramebuffer;
}
scene._sunPostProcess.execute(context, framebuffer);
passState.framebuffer = framebuffer;
}
scene._sunPostProcess.execute(context, framebuffer);
passState.framebuffer = framebuffer;
}
}

// Moon can be seen through the atmosphere, since the sun is rendered after the atmosphere.
if (environmentState.isMoonVisible) {
environmentState.moonCommand.execute(context, passState);
// Moon can be seen through the atmosphere, since the sun is rendered after the atmosphere.
if (environmentState.isMoonVisible) {
environmentState.moonCommand.execute(context, passState);
}
}

// Determine how translucent surfaces will be handled.
Expand Down Expand Up @@ -1954,14 +1957,14 @@ define([
Cartesian3.add(savedCamera.position, eyeTranslation, camera.position);
camera.frustum.xOffset = offset;

executeCommands(scene, passState);
executeCommands(scene, passState, picking);

viewport.x = passState.viewport.width;

Cartesian3.subtract(savedCamera.position, eyeTranslation, camera.position);
camera.frustum.xOffset = -offset;

executeCommands(scene, passState);
executeCommands(scene, passState, picking);

Camera.clone(savedCamera, camera);
} else {
Expand Down Expand Up @@ -2112,7 +2115,7 @@ define([
executeShadowMapCastCommands(scene);
}

executeCommands(scene, passState);
executeCommands(scene, passState, picking);
}

function updateEnvironment(scene) {
Expand Down Expand Up @@ -2341,7 +2344,7 @@ define([
if (defined(this._deviceOrientationCameraController)) {
this._deviceOrientationCameraController.update();
}

this._camera.update(this._mode);
this._camera._updateCameraChanged();
};
Expand Down