mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-08 11:29:47 +00:00
Instead of LA8. This should result in slightly less memory usage and is more on par with Godot's BitMap "convert_to_image" method, which will be exposed in Godot 3.5.
34 lines
755 B
GLSL
34 lines
755 B
GLSL
shader_type canvas_item;
|
|
render_mode unshaded;
|
|
|
|
uniform bool red;
|
|
uniform bool blue;
|
|
uniform bool green;
|
|
uniform bool alpha;
|
|
uniform sampler2D selection;
|
|
uniform bool affect_selection;
|
|
uniform bool has_selection;
|
|
|
|
|
|
void fragment() {
|
|
// Get color from the sprite texture at the current pixel we are rendering
|
|
vec4 original_color = texture(TEXTURE, UV);
|
|
vec4 selection_color = texture(selection, UV);
|
|
vec4 col = original_color;
|
|
if (red)
|
|
col.r = 1f - col.r;
|
|
if (green)
|
|
col.g = 1f - col.g;
|
|
if (blue)
|
|
col.b = 1f - col.b;
|
|
if (alpha)
|
|
col.a = 1f - col.a;
|
|
|
|
vec4 output;
|
|
if(affect_selection && has_selection)
|
|
output = mix(original_color.rgba, col, selection_color.r);
|
|
else
|
|
output = col;
|
|
|
|
COLOR = output;
|
|
} |