From 53e20c168ff568f618efa3aa5b1e58e5a8457031 Mon Sep 17 00:00:00 2001 From: Ryan Holtz Date: Sun, 22 May 2011 02:27:31 +0000 Subject: Fixing multiscreen games, nwn --- hlsl/color.fx | 2 +- hlsl/deconverge.fx | 3 ++- hlsl/focus.fx | 8 ++++---- hlsl/yiq_decode.fx | 18 ++++++++++++++++-- 4 files changed, 23 insertions(+), 8 deletions(-) (limited to 'hlsl') diff --git a/hlsl/color.fx b/hlsl/color.fx index 50083c048a5..3aa8c99e4ca 100644 --- a/hlsl/color.fx +++ b/hlsl/color.fx @@ -136,7 +136,7 @@ float4 ps_main(PS_INPUT Input) : COLOR // -- Color Compression (increasing the floor of the signal without affecting the ceiling) -- OutRGB = float3(RedFloor + (1.0f - RedFloor) * OutRGB.r, GrnFloor + (1.0f - GrnFloor) * OutRGB.g, BluFloor + (1.0f - BluFloor) * OutRGB.b); - return float4(OutRGB, 1.0f); + return float4(OutRGB, BaseTexel.a); } //----------------------------------------------------------------------------- diff --git a/hlsl/deconverge.fx b/hlsl/deconverge.fx index 2315ab5f89f..178fbef578e 100644 --- a/hlsl/deconverge.fx +++ b/hlsl/deconverge.fx @@ -113,11 +113,12 @@ float4 ps_main(PS_INPUT Input) : COLOR float MagnetDistance = length((MagnetCenter - Input.TexCoord) * float2(WidthRatio, HeightRatio)); float Deconverge = 1.0f - MagnetDistance / MagnetCenter; Deconverge = clamp(Deconverge, 0.0f, 1.0f); + float Alpha = tex2D(DiffuseSampler, Input.TexCoord).a; float RedTexel = tex2D(DiffuseSampler, lerp(Input.TexCoord, Input.RedCoord, Deconverge)).r; float GrnTexel = tex2D(DiffuseSampler, lerp(Input.TexCoord, Input.GrnCoord, Deconverge)).g; float BluTexel = tex2D(DiffuseSampler, lerp(Input.TexCoord, Input.BluCoord, Deconverge)).b; - return float4(RedTexel, GrnTexel, BluTexel, 1.0f); + return float4(RedTexel, GrnTexel, BluTexel, Alpha); } //----------------------------------------------------------------------------- diff --git a/hlsl/focus.fx b/hlsl/focus.fx index b31dcf06968..d5bd17971f1 100644 --- a/hlsl/focus.fx +++ b/hlsl/focus.fx @@ -111,7 +111,7 @@ VS_OUTPUT vs_main(VS_INPUT Input) float4 ps_main(PS_INPUT Input) : COLOR { - float3 d0 = tex2D(DiffuseSampler, Input.TexCoord0).rgb; + float4 d0 = tex2D(DiffuseSampler, Input.TexCoord0); float3 d1 = tex2D(DiffuseSampler, Input.TexCoord1).rgb; float3 d2 = tex2D(DiffuseSampler, Input.TexCoord2).rgb; float3 d3 = tex2D(DiffuseSampler, Input.TexCoord3).rgb; @@ -120,10 +120,10 @@ float4 ps_main(PS_INPUT Input) : COLOR float3 d6 = tex2D(DiffuseSampler, Input.TexCoord6).rgb; float3 d7 = tex2D(DiffuseSampler, Input.TexCoord7).rgb; - float3 blurred = (d0 + d1 + d2 + d3 + d4 + d5 + d6 + d7) / 8.0f; + float3 blurred = (d0.rgb + d1 + d2 + d3 + d4 + d5 + d6 + d7) / 8.0f; - blurred = lerp(d0, blurred, 1.0f); - return float4(blurred, 1.0f); + blurred = lerp(d0.rgb, blurred, 1.0f); + return float4(blurred, d0.a); } //----------------------------------------------------------------------------- diff --git a/hlsl/yiq_decode.fx b/hlsl/yiq_decode.fx index a446698884a..4948250ebf8 100644 --- a/hlsl/yiq_decode.fx +++ b/hlsl/yiq_decode.fx @@ -2,9 +2,22 @@ // YIQ Decode Effect //----------------------------------------------------------------------------- -texture Diffuse; +texture Composite; sampler CompositeSampler = sampler_state +{ + Texture = ; + MipFilter = POINT; + MinFilter = POINT; + MagFilter = POINT; + AddressU = CLAMP; + AddressV = CLAMP; + AddressW = CLAMP; +}; + +texture Diffuse; + +sampler DiffuseSampler = sampler_state { Texture = ; MipFilter = POINT; @@ -110,6 +123,7 @@ uniform float BValue; float4 ps_main(PS_INPUT Input) : COLOR { float2 RawDims = float2(RawWidth, RawHeight); + float4 BaseTexel = tex2D(DiffuseSampler, Input.Coord0.xy); float4 OrigC = tex2D(CompositeSampler, Input.Coord0.xy); float4 OrigC2 = tex2D(CompositeSampler, Input.Coord4.xy); float4 C = OrigC; @@ -176,7 +190,7 @@ float4 ps_main(PS_INPUT Input) : COLOR float3 OutRGB = float3(dot(YIQ, float3(1.0f, 0.9563f, 0.6210f)), dot(YIQ, float3(1.0f, -0.2721f, -0.6474f)), dot(YIQ, float3(1.0f, -1.1070f, 1.7046f))); - return float4(OutRGB, 1.0f); + return float4(OutRGB, BaseTexel.a); } //----------------------------------------------------------------------------- -- cgit v1.2.3