Created
December 4, 2018 02:41
-
-
Save 01010111/69e935f400154a3e751ecfe417424886 to your computer and use it in GitHub Desktop.
Color replacement shader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package; | |
import flixel.system.FlxAssets; | |
import flixel.util.FlxColor; | |
class Shader extends FlxShader | |
{ | |
@:glFragmentSource(' | |
#pragma header | |
uniform float uMix; | |
uniform vec4 color; | |
void main() | |
{ | |
vec4 sample = flixel_texture2D(bitmap, openfl_TextureCoordv); | |
gl_FragColor = mix(sample, color, uMix * sample.a); | |
}' | |
) | |
public function new(color:FlxColor = 0xFFFFFFFF) | |
{ | |
super(); | |
this.color.value = [color.redFloat, color.greenFloat, color.blueFloat, color.alphaFloat]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment