Last active
June 30, 2020 18:23
-
-
Save kennygoff/19ee4d646edb5f0eec44bbdc5a7808f6 to your computer and use it in GitHub Desktop.
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
uniform sampler2D swapTexture; | |
uniform bool shaderIsActive; | |
void main() | |
{ | |
vec4 pixel = texture2D(bitmap, openfl_TextureCoordv); | |
if (!shaderIsActive) | |
{ | |
gl_FragColor = pixel; | |
return; | |
} | |
vec2 index = vec2(pixel.r, pixel.g); | |
vec4 swapPixel = texture2D(swapTexture, index); | |
if(pixel.a != 0.0 && swapPixel.a != 0.0) { | |
pixel = swapPixel; | |
} | |
gl_FragColor = pixel; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment