mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-08 11:29:47 +00:00
19 lines
688 B
Plaintext
19 lines
688 B
Plaintext
|
// Authored by Variable (6 May 2022)
|
||
|
shader_type canvas_item;
|
||
|
render_mode unshaded;
|
||
|
|
||
|
uniform sampler2D map_texture : filter_nearest; // The map texture
|
||
|
|
||
|
// (begin DESCRIPTION)
|
||
|
// The Red and Green values (0-255) of tool color will be treated as an x and y position
|
||
|
// respectively instead of color components.
|
||
|
// When you draw, color will be taken from the x-y position in the "Map Texture".
|
||
|
// (end DESCRIPTION)
|
||
|
void fragment(){
|
||
|
vec4 col = texture(TEXTURE, UV);
|
||
|
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));
|
||
|
vec4 index_color = texture(map_texture, lookup_uv);
|
||
|
COLOR = index_color;
|
||
|
}
|