summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl
diff options
context:
space:
mode:
author Jezze <jezze@gmx.net>2016-09-29 15:19:44 +0200
committer Jezze <jezze@gmx.net>2016-09-29 15:19:44 +0200
commit68036515bae237abd7edd58497528f1473fab2ac (patch)
tree3f7d3db41a3f2655d7dfc04428a5714d53e293c6 /hlsl
parent2e362cfd6b59e0abf58ba3def2ab7cd2b8f67633 (diff)
Fixed aspect ratio of rounded corners (nw)
Diffstat (limited to 'hlsl')
-rw-r--r--hlsl/distortion.fx23
1 files changed, 12 insertions, 11 deletions
diff --git a/hlsl/distortion.fx b/hlsl/distortion.fx
index c7128bccfef..7624d962a58 100644
--- a/hlsl/distortion.fx
+++ b/hlsl/distortion.fx
@@ -232,20 +232,13 @@ float2 GetTextureCoords(float2 coord, float distortionAmount, float cubicDistort
return coord;
}
-float2 GetQuadCoords(float2 coord, float distortionAmount, float cubicDistortionAmount)
+float2 GetQuadCoords(float2 coord, float2 scale, float distortionAmount, float cubicDistortionAmount)
{
// center coordinates
coord -= 0.5f;
- // keep coords inside of the quad bounds of a single screen
- if (ScreenCount == 1)
- {
- // base-target dimensions (without oversampling)
- float2 BaseTargetDims = TargetDims / TargetScale;
-
- // apply base-target/quad difference
- coord *= BaseTargetDims / (SwapXY ? QuadDims.yx : QuadDims.xy);
- }
+ // apply scale
+ coord *= scale;
// distort coordinates
coord = GetDistortedCoords(coord, distortionAmount, cubicDistortionAmount);
@@ -271,12 +264,20 @@ float4 ps_main(PS_INPUT Input) : COLOR
// base-target dimensions (without oversampling)
float2 BaseTargetDims = TargetDims / TargetScale;
+ BaseTargetDims = SwapXY
+ ? BaseTargetDims.yx
+ : BaseTargetDims.xy;
+
+ // base-target/quad difference scale
+ float2 BaseTargetQuadScale = ScreenCount == 1
+ ? BaseTargetDims / QuadDims // keeps the coords inside of the quad bounds of a single screen
+ : 1.0f;
// Screen Texture Curvature
float2 BaseCoord = GetTextureCoords(Input.TexCoord, distortionAmount, cubicDistortionAmount);
// Screen Quad Curvature
- float2 QuadCoord = GetQuadCoords(Input.TexCoord, distortCornerAmount, 0.0f);
+ float2 QuadCoord = GetQuadCoords(Input.TexCoord, BaseTargetQuadScale, distortCornerAmount, 0.0f);
// clip border
clip(BaseCoord < 0.0f - TexelDims || BaseCoord > 1.0f + TexelDims ? -1 : 1);