diff --git a/Effects/AvaliRecolor.fx b/Effects/AvaliRecolor.fx index 18addbc..3ff8951 100644 --- a/Effects/AvaliRecolor.fx +++ b/Effects/AvaliRecolor.fx @@ -48,6 +48,19 @@ uniform float4 rehue2_hsv_from; uniform float4 rehue2_hsv_to; static const float rehue2_threshold_norm = rehue2_threshold * length(rehue2_threshold_mul); +// Thank you frost helper my beloved +uniform float4x4 TransformMatrix; +uniform float4x4 ViewMatrix; + + +void vs_gameplay_transform( + inout float4 color: COLOR0, inout float2 texCoord : TEXCOORD0, + inout float4 position : SV_Position +) { + position = mul(position, ViewMatrix); + position = mul(position, TransformMatrix); +} + float4 hueshift( float4 hsv_color, float4 hsv_from, float4 hsv_to @@ -64,7 +77,7 @@ float4 multiplya(float4 color) { float4 ps_main( float4 pos: SV_Position, float4 sprite_color: COLOR0, float2 uv: TEXCOORD0 -): COLOR { +): COLOR0 { float4 tex_rgb = SAMPLE_TEXTURE(sprite, uv); float4 tex_hsv = rgb2hsv(tex_rgb); @@ -92,6 +105,7 @@ float4 ps_main( technique Recolor { pass { - PixelShader = compile ps_2_0 ps_main(); + VertexShader = compile vs_3_0 vs_gameplay_transform(); + PixelShader = compile ps_3_0 ps_main(); } } diff --git a/SourceCode/AvaliSkinModule.cs b/SourceCode/AvaliSkinModule.cs index 3dc6e41..a32e53e 100644 --- a/SourceCode/AvaliSkinModule.cs +++ b/SourceCode/AvaliSkinModule.cs @@ -222,6 +222,16 @@ namespace Celeste.Mod.AvaliSkin { darkColor2.ToHSV() ); + Viewport viewport = Engine.Graphics.GraphicsDevice.Viewport; + Camera camera = (Engine.Scene as Level).Camera; + + Matrix projection = Matrix.CreateOrthographicOffCenter( + 0, viewport.Width, viewport.Height, 0, 0, 1 + ); + + FxRecolor.Parameters["TransformMatrix"].SetValue(projection); + FxRecolor.Parameters["ViewMatrix"].SetValue(camera?.Matrix ?? Matrix.Identity); + FxRecolor.CurrentTechnique = FxRecolor.Techniques["Recolor"]; }