Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shader_type canvas_item;
- uniform sampler2D text_left;
- uniform vec4 left_color : hint_color;
- uniform sampler2D text_right;
- uniform vec4 right_color : hint_color;
- bool approx_eq(vec4 c1, vec4 c2) { return all( lessThan( abs( c1 - c2 ), vec4( 0.001, 0.001, 0.001, 0.001) ) ); }
- void fragment(){
- vec4 color2;
- vec4 color = texture(TEXTURE, UV);
- COLOR = texture(TEXTURE, UV); //read from texture
- if (approx_eq(color, right_color))
- {
- color2 = texture(text_right, UV);
- COLOR = color2;
- }
- else if (approx_eq(color, left_color))
- {
- color2 = texture(text_left, UV);
- COLOR = color2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement