|
@@ -11,18 +11,26 @@
|
|
|
|
|
|
|
|
uniform sampler2D font;
|
|
uniform sampler2D font;
|
|
|
uniform float time;
|
|
uniform float time;
|
|
|
|
|
+uniform vec2 resolution;
|
|
|
|
|
|
|
|
flat in int glyph_c;
|
|
flat in int glyph_c;
|
|
|
in vec4 glyph_fg_color;
|
|
in vec4 glyph_fg_color;
|
|
|
in vec4 glyph_bg_color;
|
|
in vec4 glyph_bg_color;
|
|
|
in vec2 uv;
|
|
in vec2 uv;
|
|
|
|
|
|
|
|
-float
|
|
|
|
|
-map01(float x)
|
|
|
|
|
|
|
+float map01(float x)
|
|
|
{
|
|
{
|
|
|
return (x + 1) / 2;
|
|
return (x + 1) / 2;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+vec3 hsl2rgb( in vec3 c )
|
|
|
|
|
+{
|
|
|
|
|
+ vec3 rgb = clamp( abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0,
|
|
|
|
|
+ 0.0, 1.0 );
|
|
|
|
|
+
|
|
|
|
|
+ return c.z + c.y * (rgb-0.5)*(1.0-abs(2.0*c.z-1.0));
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void main() {
|
|
void main() {
|
|
|
int c = glyph_c;
|
|
int c = glyph_c;
|
|
|
if ( ! (c >= 32 && c <= 126) ) {
|
|
if ( ! (c >= 32 && c <= 126) ) {
|
|
@@ -38,9 +46,12 @@ void main() {
|
|
|
vec2 uv_ = vec2(uv.x, uv.y);
|
|
vec2 uv_ = vec2(uv.x, uv.y);
|
|
|
|
|
|
|
|
vec4 t = texture(font, pos + ch_size * uv_);
|
|
vec4 t = texture(font, pos + ch_size * uv_);
|
|
|
- gl_FragColor = glyph_bg_color * (1.0 - t.x) + t.x * glyph_fg_color
|
|
|
|
|
- * vec4(map01(sin(time)),
|
|
|
|
|
- map01(cos(time)),
|
|
|
|
|
- map01(sin(time)),
|
|
|
|
|
- 1);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ vec2 frag_uv = gl_FragCoord.xy / resolution;
|
|
|
|
|
+ vec4 rainbow = vec4(hsl2rgb(vec3((time + frag_uv.x + frag_uv.y) * 0.5,
|
|
|
|
|
+ 0.5,
|
|
|
|
|
+ 0.5)),
|
|
|
|
|
+ 1);
|
|
|
|
|
+
|
|
|
|
|
+ gl_FragColor = glyph_bg_color * (1.0 - t.x) + t.x * glyph_fg_color * rainbow;
|
|
|
}
|
|
}
|