1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-03-17 08:45:18 +00:00
Pixelorama/src/Shaders/PatternFill.gdshader
Emmanouil Papadeas 3fb2877b73 Fix pattern sampler2D in shaders not repeating
When using the Bucket tool to fill with pattern in "Similar colors" and "Whole selection" modes, the pattern was not being repeated.
2024-03-10 14:59:55 +02:00

17 lines
475 B
Text

shader_type canvas_item;
render_mode unshaded;
uniform sampler2D selection;
uniform sampler2D pattern: repeat_enable;
uniform vec2 size;
uniform vec2 pattern_size;
uniform vec2 pattern_uv_offset;
void fragment() {
vec4 original_color = texture(TEXTURE, UV);
vec4 selection_color = texture(selection, UV);
vec4 col = original_color;
col = textureLod(pattern, UV * (size / pattern_size) + pattern_uv_offset, 0.0);
COLOR = mix(original_color, col, selection_color.a);
}