Skip to content

Commit

Permalink
Made the czm_imagerySplitPosition uniform be in pixel coordinates ins…
Browse files Browse the repository at this point in the history
…tead of relative. Fixes #5106
  • Loading branch information
jasonbeverage committed Mar 27, 2017
1 parent 201e3f7 commit 20a54f3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
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 20a54f3

Please sign in to comment.