From 20a54f36f8d13f2d0dff1127d42bc8b5478ff16a Mon Sep 17 00:00:00 2001 From: Jason Beverage Date: Mon, 27 Mar 2017 10:34:59 -0400 Subject: [PATCH 1/2] Made the czm_imagerySplitPosition uniform be in pixel coordinates instead of relative. Fixes #5106 --- Source/Renderer/AutomaticUniforms.js | 2 +- Source/Renderer/UniformState.js | 3 ++- Source/Shaders/GlobeFS.glsl | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/Renderer/AutomaticUniforms.js b/Source/Renderer/AutomaticUniforms.js index 6f6512789715..5b838aa2bf66 100644 --- a/Source/Renderer/AutomaticUniforms.js +++ b/Source/Renderer/AutomaticUniforms.js @@ -1469,7 +1469,7 @@ define([ /** * An automatic GLSL uniform representing the splitter position to use when rendering imagery layers with a splitter. - * This will be in the range 0.0 to 1.0 with 0.0 being the far left of the viewport and 1.0 being the far right of the viewport. + * This will be in pixel coordinates relative to the canvas. * * @alias czm_imagerySplitPosition * @glslUniform diff --git a/Source/Renderer/UniformState.js b/Source/Renderer/UniformState.js index 89eacb030303..e7c405267143 100644 --- a/Source/Renderer/UniformState.js +++ b/Source/Renderer/UniformState.js @@ -951,7 +951,8 @@ define([ this._frameState = frameState; this._temeToPseudoFixed = Transforms.computeTemeToPseudoFixedMatrix(frameState.time, this._temeToPseudoFixed); - this._imagerySplitPosition = frameState.imagerySplitPosition; + // Convert the relative imagerySplitPosition to absolute pixel coordinates + this._imagerySplitPosition = frameState.imagerySplitPosition * canvas.clientWidth; var fov = camera.frustum.fov; var viewport = this._viewport; var pixelSizePerMeter; diff --git a/Source/Shaders/GlobeFS.glsl b/Source/Shaders/GlobeFS.glsl index da6c49e2a9d4..c36fc9737286 100644 --- a/Source/Shaders/GlobeFS.glsl +++ b/Source/Shaders/GlobeFS.glsl @@ -99,7 +99,7 @@ vec4 sampleAndBlend( float alpha = value.a; #ifdef APPLY_SPLIT - float splitPosition = czm_imagerySplitPosition * czm_viewport.z; + float splitPosition = czm_imagerySplitPosition; // Split to the left if (split < 0.0 && gl_FragCoord.x > splitPosition) { alpha = 0.0; From 19d693e6fb9a7149daeb3e21c2d05994093658cd Mon Sep 17 00:00:00 2001 From: Jason Beverage Date: Mon, 27 Mar 2017 10:41:12 -0400 Subject: [PATCH 2/2] Updated CHANGES.md to reference PR #5151 --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 8cd389f02d44..8e7997c156a6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -25,6 +25,7 @@ Change Log * Set `projectionPicker` to `true` in the options when creating a `Viewer` to add a widget that will switch projections. [#5021](https://github.com/AnalyticalGraphicsInc/cesium/pull/5021) * Call `switchToOrthographicFrustum` or `switchToPerspectiveFrustum` on `Camera` to change projections. * Fix billboard, point and label clustering in 2D and Columbus view. [#5136](https://github.com/AnalyticalGraphicsInc/cesium/pull/5136) +* Fixed issues with imagerySplitPosition and the international date line in 2D mode. [#5151](https://github.com/AnalyticalGraphicsInc/cesium/pull/5151) ### 1.31 - 2017-03-01