1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-10 00:34:40 +00:00
Funkin/source/funkin/shaderslmfao/LeftMaskShader.hx

56 lines
952 B
Haxe
Raw Normal View History

2022-12-03 02:37:07 +00:00
package funkin.shaderslmfao;
import flixel.system.FlxAssets.FlxShader;
class LeftMaskShader extends FlxShader
{
public var swagMaskX(default, set):Float = 0;
public var swagSprX(default, set):Float = 0;
function set_swagSprX(x:Float):Float
{
sprX.value[0] = x;
return x;
}
function set_swagMaskX(x:Float):Float
{
maskX.value[0] = x;
return x;
}
@:glFragmentSource('
#pragma header
uniform float sprX;
uniform float maskX;
void main()
{
float cutOff = maskX - sprX;
float sprPos = cutOff / openfl_TextureSize.x;
vec2 uv = openfl_TextureCoordv.xy;
vec4 color = flixel_texture2D(bitmap, uv);
if (uv.x < sprPos)
{
color = vec4(0.0, 0.0, 0.0, 0.0);
}
gl_FragColor = color;
}
')
public function new()
{
super();
sprX.value = [0];
maskX.value = [0];
}
}