From b1a392a45ff0dc6876622d00962aef9270ca5e81 Mon Sep 17 00:00:00 2001 From: ImJezze Date: Sat, 12 Mar 2016 19:17:57 +0100 Subject: [PATCH] Fixed mask orientation for vector screen --- hlsl/post.fx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/hlsl/post.fx b/hlsl/post.fx index 77344113d0b..0bf2fcdc7f5 100644 --- a/hlsl/post.fx +++ b/hlsl/post.fx @@ -132,7 +132,7 @@ uniform float ScanlineHeight = 1.0f; uniform float3 BackColor = float3(0.0f, 0.0f, 0.0f); -uniform int ShadowTileMode = 0; // 0 based on screen dimension, 1 based on source dimension +uniform int ShadowTileMode = 0; // 0 based on screen (quad) dimension, 1 based on source dimension uniform float ShadowAlpha = 0.0f; uniform float2 ShadowCount = float2(6.0f, 6.0f); uniform float2 ShadowUV = float2(0.25f, 0.25f); @@ -174,17 +174,26 @@ float2 GetShadowCoord(float2 QuadCoord, float2 SourceCoord) float2 shadowUV = ShadowUV; float2 shadowCount = ShadowCount; - canvasCoord = !VectorScreen && ShadowTileMode == 0 && SwapXY + // swap x/y vector and raster in screen mode (not source mode) + canvasCoord = ShadowTileMode == 0 && SwapXY ? canvasCoord.yx : canvasCoord.xy; - shadowCount = !VectorScreen && ShadowTileMode == 0 && SwapXY + // swap x/y vector and raster in screen mode (not source mode) + shadowCount = ShadowTileMode == 0 && SwapXY ? shadowCount.yx : shadowCount.xy; float2 shadowTile = canvasTexelDims * shadowCount; + // swap x/y vector in screen mode (not raster and not source mode) + shadowTile = VectorScreen && ShadowTileMode == 0 && SwapXY + ? shadowTile.yx + : shadowTile.xy; + float2 shadowFrac = frac(canvasCoord / shadowTile); + + // swap x/y raster in screen mode (not vector and not source mode) shadowFrac = !VectorScreen && ShadowTileMode == 0 && SwapXY ? shadowFrac.yx : shadowFrac.xy;