2022-03-08 03:13:53 -05:00
|
|
|
package funkin.shaderslmfao;
|
2021-09-11 14:08:34 -04:00
|
|
|
|
|
|
|
import flixel.system.FlxAssets.FlxShader;
|
|
|
|
|
|
|
|
class ScreenWipeShader extends FlxShader
|
|
|
|
{
|
2023-01-22 22:25:45 -05:00
|
|
|
public var daAlphaShit(default, set):Float = 0;
|
2021-09-11 14:08:34 -04:00
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
function set_daAlphaShit(alpha:Float):Float
|
|
|
|
{
|
|
|
|
alphaShit.value[0] = alpha;
|
2021-09-11 14:08:34 -04:00
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
return alpha;
|
|
|
|
}
|
2021-09-11 14:08:34 -04:00
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
@:glFragmentSource('
|
2021-09-11 14:08:34 -04:00
|
|
|
#pragma header
|
|
|
|
|
|
|
|
uniform float alphaShit;
|
|
|
|
uniform float yPos;
|
|
|
|
uniform float xPos;
|
|
|
|
|
|
|
|
uniform sampler2D funnyShit;
|
|
|
|
|
|
|
|
|
|
|
|
vec3 rgb2hsv(vec3 c)
|
|
|
|
{
|
|
|
|
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
|
|
|
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
|
|
|
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
|
|
|
|
|
|
|
float d = q.x - min(q.w, q.y);
|
|
|
|
float e = 1.0e-10;
|
|
|
|
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
|
|
|
}
|
|
|
|
|
|
|
|
vec3 hsv2rgb(vec3 c)
|
|
|
|
{
|
|
|
|
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
|
|
|
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
|
|
|
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
vec2 funnyUv = openfl_TextureCoordv;
|
|
|
|
vec4 color = flixel_texture2D(bitmap, funnyUv);
|
2023-06-08 16:30:45 -04:00
|
|
|
|
2021-09-11 14:08:34 -04:00
|
|
|
vec2 reallyFunnyUv = vec2(vec2(0.0, 0.0) - gl_FragCoord.xy / openfl_TextureSize.xy);
|
|
|
|
|
|
|
|
vec4 gf = flixel_texture2D(funnyShit, openfl_TextureCoordv);
|
|
|
|
|
|
|
|
|
|
|
|
vec3 hsvTypeBeat = rgb2hsv(vec3(gf.r, gf.g, gf.b));
|
|
|
|
|
|
|
|
vec4 output = color;
|
|
|
|
|
|
|
|
// .b here actually means value?
|
|
|
|
if (hsvTypeBeat.b <= alphaShit)
|
|
|
|
color = vec4(0.0, 0.0, 0.0, 0.0);
|
|
|
|
|
|
|
|
|
|
|
|
gl_FragColor = color;
|
|
|
|
}
|
|
|
|
')
|
2023-01-22 22:25:45 -05:00
|
|
|
public function new()
|
|
|
|
{
|
|
|
|
super();
|
2021-09-11 14:08:34 -04:00
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
alphaShit.value = [0];
|
|
|
|
}
|
2021-09-11 14:08:34 -04:00
|
|
|
}
|