1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-23 22:13:14 +00:00
Pixelorama/src/Shaders/Effects/Invert.gdshader

28 lines
675 B
Text
Raw Normal View History

shader_type canvas_item;
render_mode unshaded;
Implement layer effects (#940) * Basic logic for layer effects * Add an FX button and the ability to add effects, no way to remove or change properties of effects yet * Basic and ugly UI for adding and removing effects, no property changing yet * Swap effects * Fix preload shader paths * Change parameters for layer effects * Change gradient parameter in layer effect shaders, and other fixes * Use CollapsibleContainers for the shader properties * Set the correct gradient interpolation mode and color space in the UI * Make effects of group layers apply to children * Change `apply_fx` to `apply_effects`, formatting, some extra doc comments * Apply effects to other canvases, when merging layers and when exporting * Display humanized names of the shader unifrms * Some UI improvements to the LayerEffectsSettings * Add an Enabled button in the layer effects window, and change checkboxes to checkbuttons * Change BaseLayer.apply_effects() to take a cel as a parameter instead * Make layer effect buttons be affected by the modulate icon color * Add option in the View menu whether layer effects are displayed in the canvas or not * Rename `apply_effects()` to `display_effects()` * Add translation strings * Add nearest filter to the gradient map * Don't change Main.tscn * Fix more translations * Change the default cursor shape of the generated UI elements of the layer effects * Add undo/redo and effect application (apply effect destructively) There are some errors due to the usage of anonymous lambda methods in undo/redo, but it seems to be working well regardless. * Make layer effect application work on all cels
2023-11-22 01:06:25 +02:00
uniform bool red = true;
uniform bool blue = true;
uniform bool green = true;
uniform bool alpha = false;
uniform sampler2D selection : filter_nearest;
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 = 1.0 - col.r;
if (green)
col.g = 1.0 - col.g;
if (blue)
col.b = 1.0 - col.b;
if (alpha)
col.a = 1.0 - col.a;
vec4 output = mix(original_color.rgba, col, selection_color.a);
COLOR = output;
}