mirror of
https://github.com/holub/mame
synced 2025-10-04 08:28:39 +03:00
Fixed Aspect Ratios
- fixed aspect ratios in special post.fx shader for artwork support
This commit is contained in:
parent
7eb83c31a5
commit
cd7de43b13
@ -216,7 +216,9 @@ float GetSpotAddend(float2 coord, float amount)
|
|||||||
// normalized screen canvas ratio
|
// normalized screen canvas ratio
|
||||||
float2 CanvasRatio = PrepareVector
|
float2 CanvasRatio = PrepareVector
|
||||||
? float2(1.0f, QuadDims.y / QuadDims.x)
|
? 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
|
// upper right quadrant
|
||||||
float2 spotOffset = OrientationSwapXY
|
float2 spotOffset = OrientationSwapXY
|
||||||
@ -251,16 +253,16 @@ float GetRoundCornerFactor(float2 coord, float radiusAmount, float smoothAmount)
|
|||||||
|
|
||||||
float2 CanvasDims = PrepareVector
|
float2 CanvasDims = PrepareVector
|
||||||
? ScreenDims
|
? ScreenDims
|
||||||
: SourceDims;
|
: xor(OrientationSwapXY, RotationSwapXY)
|
||||||
|
? QuadDims.yx / SourceRect
|
||||||
// hack: alignment correction
|
: QuadDims.xy / SourceRect;
|
||||||
|
|
||||||
|
// raster graphics
|
||||||
if (!PrepareVector)
|
if (!PrepareVector)
|
||||||
{
|
{
|
||||||
float2 SourceArea = 1.0f / SourceRect;
|
// alignment correction
|
||||||
float2 SourceTexelDims = 1.0f / CanvasDims;
|
float2 SourceTexelDims = 1.0f / SourceDims;
|
||||||
|
coord -= SourceTexelDims;
|
||||||
coord -= SourceTexelDims * SourceArea * 0.75;
|
|
||||||
coord *= SourceTexelDims * SourceArea * 0.25 + 1.0f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float range = min(CanvasDims.x, CanvasDims.y) * 0.5;
|
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
|
float4 ps_main(PS_INPUT Input) : COLOR
|
||||||
{
|
{
|
||||||
float2 ScreenTexelDims = 1.0f / ScreenDims;
|
float2 ScreenTexelDims = 1.0f / ScreenDims;
|
||||||
float2 SourceTexelDims = 1.0f / SourceDims;
|
|
||||||
|
|
||||||
float2 HalfSourceRect = PrepareVector
|
float2 HalfSourceRect = PrepareVector
|
||||||
? float2(0.5f, 0.5f)
|
? float2(0.5f, 0.5f)
|
||||||
|
Loading…
Reference in New Issue
Block a user