Skip to content

Commit

Permalink
Merge pull request #5151 from jasonbeverage/splitidlrelative
Browse files Browse the repository at this point in the history
Made czm_imagerySplitPosition use absolute coordinates.  Fixes #5106.
  • Loading branch information
pjcozzi authored Mar 27, 2017
2 parents 201e3f7 + 19d693e commit c884335
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Source/Renderer/AutomaticUniforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Source/Renderer/UniformState.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Source/Shaders/GlobeFS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c884335

Please sign in to comment.