summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl/focus.fx
diff options
context:
space:
mode:
Diffstat (limited to 'hlsl/focus.fx')
-rw-r--r--hlsl/focus.fx18
1 files changed, 5 insertions, 13 deletions
diff --git a/hlsl/focus.fx b/hlsl/focus.fx
index 6da8ab928a2..c5e5262fedd 100644
--- a/hlsl/focus.fx
+++ b/hlsl/focus.fx
@@ -46,15 +46,6 @@ struct PS_INPUT
};
//-----------------------------------------------------------------------------
-// Functions
-//-----------------------------------------------------------------------------
-
-bool xor(bool a, bool b)
-{
- return (a || b) && !(a && b);
-}
-
-//-----------------------------------------------------------------------------
// Defocus Vertex Shader
//-----------------------------------------------------------------------------
@@ -98,18 +89,19 @@ float2 Coord8Offset = float2( 1.00f, -0.25f);
uniform float2 Defocus = float2(0.0f, 0.0f);
-uniform bool OrientationSwapXY = false; // false landscape, true portrait for default screen orientation
-uniform bool RotationSwapXY = false; // swapped default screen orientation due to screen rotation
+uniform bool SwapXY = false;
float4 ps_main(PS_INPUT Input) : COLOR
{
float2 QuadRatio =
- float2(1.0f, xor(OrientationSwapXY, RotationSwapXY)
+ float2(1.0f, SwapXY
? QuadDims.y / QuadDims.x
: QuadDims.x / QuadDims.y);
// imaginary texel dimensions independed from quad dimensions, but dependend on quad ratio
- float2 DefocusTexelDims = (1.0f / 1024.0) * SourceRect * QuadRatio * Defocus;
+ float2 TexelDims = (1.0f / 1024.0) * SourceRect * QuadRatio;
+
+ float2 DefocusTexelDims = Defocus * TexelDims;
float4 d = tex2D(DiffuseSampler, Input.TexCoord);
float3 d1 = tex2D(DiffuseSampler, Input.TexCoord + Coord1Offset * DefocusTexelDims).rgb;