From 6d7bb5256ee3cb60194634b4c85b0093cdaff0b9 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 13 May 2013 16:17:27 -0400 Subject: [PATCH] Fix sun flickering when picking. --- Source/Scene/SunPostProcess.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/Scene/SunPostProcess.js b/Source/Scene/SunPostProcess.js index 9bc7d5f5df15..c37e508d4738 100644 --- a/Source/Scene/SunPostProcess.js +++ b/Source/Scene/SunPostProcess.js @@ -331,10 +331,10 @@ define([ size.y = sunSize; var scissorRectangle = scissorTestBoundingRectangle; - scissorRectangle.x = sunPositionWC.x - size.x * 0.5; - scissorRectangle.y = sunPositionWC.y - size.y * 0.5; - scissorRectangle.width = size.x; - scissorRectangle.height = size.y; + scissorRectangle.x = Math.max(sunPositionWC.x - size.x * 0.5, 0.0); + scissorRectangle.y = Math.max(sunPositionWC.y - size.y * 0.5, 0.0); + scissorRectangle.width = Math.min(size.x, width); + scissorRectangle.height = Math.min(size.y, height); this._blendCommand.renderState = context.createRenderState({ viewport : viewport, @@ -360,10 +360,10 @@ define([ size.x *= downSampleWidth / width; size.y *= downSampleHeight / height; - scissorRectangle.x = sunPositionWC.x - size.x * 0.5; - scissorRectangle.y = sunPositionWC.y - size.y * 0.5; - scissorRectangle.width = size.x; - scissorRectangle.height = size.y; + scissorRectangle.x = Math.max(sunPositionWC.x - size.x * 0.5, 0.0); + scissorRectangle.y = Math.max(sunPositionWC.y - size.y * 0.5, 0.0); + scissorRectangle.width = Math.min(size.x, width); + scissorRectangle.height = Math.min(size.y, height); var renderState = context.createRenderState({ viewport : viewport,