Files
room_glitch/games/robotron/title_palette.gdshader

15 lines
590 B
Plaintext

shader_type canvas_item;
render_mode unshaded;
uniform bool animate_title = false;
uniform int palette_step = 0;
void fragment() {
vec4 pixel = texture(TEXTURE, UV) * COLOR;
// Only the supplied title lettering cycles; credits and sprites keep their palette.
if (animate_title && UV.x>0.13 && UV.x<0.86 && UV.y>0.20 && UV.y<0.49 && pixel.r>0.8 && pixel.b<0.1) {
vec3 palette[7] = vec3[7](vec3(1,0,0),vec3(1,0.5,0),vec3(1,1,0),vec3(0,1,0),vec3(0,1,1),vec3(1,0,1),vec3(1,1,1));
int index = (palette_step + (pixel.g>0.8 ? 2 : 0)) % 7;
pixel.rgb = palette[index];
}
COLOR = pixel;
}