Fixed Aspect Ratios

- fixed aspect ratios in special post.fx shader for artwork support
This commit is contained in:
ImJezze 2015-10-19 19:03:56 +02:00
parent 7eb83c31a5
commit cd7de43b13

View file

@ -216,7 +216,9 @@ float GetSpotAddend(float2 coord, float amount)
// normalized screen canvas ratio
float2 CanvasRatio = PrepareVector
? float2(1.0f, QuadDims.y / QuadDims.x)
: 1.0f / float2(1.0f, SourceRect.y / SourceRect.x);
: float2(1.0f, xor(OrientationSwapXY, RotationSwapXY)
? QuadDims.x / QuadDims.y
: QuadDims.y / QuadDims.x);
// upper right quadrant
float2 spotOffset = OrientationSwapXY
@ -251,16 +253,16 @@ float GetRoundCornerFactor(float2 coord, float radiusAmount, float smoothAmount)
float2 CanvasDims = PrepareVector
? ScreenDims
: SourceDims;
: xor(OrientationSwapXY, RotationSwapXY)
? QuadDims.yx / SourceRect
: QuadDims.xy / SourceRect;
// hack: alignment correction
// raster graphics
if (!PrepareVector)
{
float2 SourceArea = 1.0f / SourceRect;
float2 SourceTexelDims = 1.0f / CanvasDims;
coord -= SourceTexelDims * SourceArea * 0.75;
coord *= SourceTexelDims * SourceArea * 0.25 + 1.0f;
// alignment correction
float2 SourceTexelDims = 1.0f / SourceDims;
coord -= SourceTexelDims;
}
float range = min(CanvasDims.x, CanvasDims.y) * 0.5;
@ -330,7 +332,6 @@ float2 GetCoords(float2 coord, float2 centerOffset, float distortionAmount)
float4 ps_main(PS_INPUT Input) : COLOR
{
float2 ScreenTexelDims = 1.0f / ScreenDims;
float2 SourceTexelDims = 1.0f / SourceDims;
float2 HalfSourceRect = PrepareVector
? float2(0.5f, 0.5f)