2023-11-07 04:04:22 -05:00
|
|
|
package funkin.graphics.shaders;
|
2020-12-26 21:46:22 -05:00
|
|
|
|
|
|
|
import flixel.util.FlxColor;
|
|
|
|
import openfl.display.ShaderParameter;
|
|
|
|
|
|
|
|
typedef BlendModeShader =
|
|
|
|
{
|
2023-01-22 22:25:45 -05:00
|
|
|
var uBlendColor:ShaderParameter<Float>;
|
2020-12-26 21:46:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
class BlendModeEffect
|
|
|
|
{
|
2023-01-22 22:25:45 -05:00
|
|
|
public var shader(default, null):BlendModeShader;
|
2020-12-26 21:46:22 -05:00
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
@:isVar
|
|
|
|
public var color(default, set):FlxColor;
|
2020-12-26 21:46:22 -05:00
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
public function new(shader:BlendModeShader, color:FlxColor):Void
|
|
|
|
{
|
|
|
|
shader.uBlendColor.value = [];
|
|
|
|
this.shader = shader;
|
|
|
|
this.color = color;
|
|
|
|
}
|
2020-12-26 21:46:22 -05:00
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
function set_color(color:FlxColor):FlxColor
|
|
|
|
{
|
|
|
|
shader.uBlendColor.value[0] = color.redFloat;
|
|
|
|
shader.uBlendColor.value[1] = color.greenFloat;
|
|
|
|
shader.uBlendColor.value[2] = color.blueFloat;
|
|
|
|
shader.uBlendColor.value[3] = color.alphaFloat;
|
2020-12-26 21:46:22 -05:00
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
return this.color = color;
|
|
|
|
}
|
2020-12-26 21:46:22 -05:00
|
|
|
}
|