Fix code style

This commit is contained in:
Wojtek Figat
2020-12-30 22:56:17 +01:00
parent 5e469a0ae3
commit 05790ab9a1
62 changed files with 300 additions and 456 deletions

View File

@@ -9,24 +9,16 @@ Texture2D Distortion : register(t1);
META_PS(true, FEATURE_LEVEL_ES2)
float4 PS_ApplyDistortion(Quad_VS2PS input) : SV_Target
{
// Sample accumulated distortion offset
half4 accumDist = Distortion.Sample(SamplerPointClamp, input.TexCoord);
// Offset = [R-B,G-A]
half2 distOffset = (accumDist.rg - accumDist.ba);
static const half InvDistortionScaleBias = 1 / 4.0f;
distOffset *= InvDistortionScaleBias;
float4 accumDist = Distortion.Sample(SamplerPointClamp, input.TexCoord);
float2 distOffset = (accumDist.rg - accumDist.ba) / 4.0f;
float2 newTexCoord = input.TexCoord + distOffset;
// If we're about to sample outside the valid area, set to 0 distortion
// Clamp around screen
FLATTEN
if (newTexCoord.x < 0 || newTexCoord.x > 1 || newTexCoord.y < 0 || newTexCoord.y > 1)
{
newTexCoord = input.TexCoord;
}
// Sample screen using offset coords
return Input.SampleLevel(SamplerPointClamp, newTexCoord, 0);
}