mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Add an alpha uniform to the IndexMap shader
In case users don't want the effect to affect the alpha channel
This commit is contained in:
parent
167b0d863c
commit
9cac98c941
|
@ -3,6 +3,7 @@ shader_type canvas_item;
|
||||||
render_mode unshaded;
|
render_mode unshaded;
|
||||||
|
|
||||||
uniform sampler2D map_texture : filter_nearest; // The map texture
|
uniform sampler2D map_texture : filter_nearest; // The map texture
|
||||||
|
uniform bool alpha = false;
|
||||||
|
|
||||||
// (begin DESCRIPTION)
|
// (begin DESCRIPTION)
|
||||||
// The Red and Green values (0-255) of tool color will be treated as an x and y position
|
// The Red and Green values (0-255) of tool color will be treated as an x and y position
|
||||||
|
@ -14,5 +15,8 @@ void fragment(){
|
||||||
vec2 map_size = vec2(textureSize(map_texture, 0));
|
vec2 map_size = vec2(textureSize(map_texture, 0));
|
||||||
vec2 lookup_uv = vec2(round(col.x * 255.0)/(map_size.x), round(col.y * 255.0)/(map_size.y));
|
vec2 lookup_uv = vec2(round(col.x * 255.0)/(map_size.x), round(col.y * 255.0)/(map_size.y));
|
||||||
vec4 index_color = texture(map_texture, lookup_uv);
|
vec4 index_color = texture(map_texture, lookup_uv);
|
||||||
COLOR = index_color;
|
COLOR.rgb = index_color.rgb;
|
||||||
|
if (alpha) {
|
||||||
|
COLOR.a = index_color.a;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue