add vertex shader (frost helper my beloved)

This commit is contained in:
micycle 2023-05-25 00:37:14 -04:00 committed by yosh
parent 58df89a5af
commit ebe0dda6b6
2 changed files with 26 additions and 2 deletions

View File

@ -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();
}
}

View File

@ -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"];
}