2022-03-08 08:13:53 +00:00
|
|
|
package funkin.shaderslmfao;
|
2021-10-22 03:08:48 +00:00
|
|
|
|
|
|
|
import flixel.system.FlxAssets.FlxShader;
|
|
|
|
|
|
|
|
class AngleMask extends FlxShader
|
|
|
|
{
|
2023-01-23 03:25:45 +00:00
|
|
|
@:glFragmentSource('
|
2021-10-22 03:08:48 +00:00
|
|
|
#pragma header
|
|
|
|
uniform vec2 endPosition;
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
vec4 base = texture2D(bitmap, openfl_TextureCoordv);
|
|
|
|
|
|
|
|
vec2 uv = openfl_TextureCoordv.xy;
|
|
|
|
|
2023-06-08 20:30:45 +00:00
|
|
|
|
2021-10-22 03:08:48 +00:00
|
|
|
|
|
|
|
vec2 start = vec2(0.0, 0.0);
|
|
|
|
vec2 end = vec2(endPosition.x / openfl_TextureSize.x, 1.0);
|
|
|
|
|
|
|
|
float dx = end.x - start.x;
|
|
|
|
float dy = end.y - start.y;
|
|
|
|
|
|
|
|
float angle = atan(dy, dx);
|
|
|
|
|
|
|
|
uv.x -= start.x;
|
|
|
|
uv.y -= start.y;
|
|
|
|
|
|
|
|
float uvA = atan(uv.y, uv.x);
|
|
|
|
|
|
|
|
if (uvA < angle)
|
|
|
|
gl_FragColor = base;
|
|
|
|
else
|
|
|
|
gl_FragColor = vec4(0.0);
|
|
|
|
|
|
|
|
}')
|
2023-01-23 03:25:45 +00:00
|
|
|
public function new()
|
|
|
|
{
|
|
|
|
super();
|
2021-10-22 03:08:48 +00:00
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
endPosition.value = [90, 100]; // 100 AS DEFAULT WORKS NICELY FOR FREEPLAY?
|
|
|
|
}
|
2021-10-22 03:08:48 +00:00
|
|
|
}
|