first and last commit
This commit is contained in:
commit
c9e78fd810
381 changed files with 37141 additions and 0 deletions
35
shaders/text.fsh
Normal file
35
shaders/text.fsh
Normal file
|
@ -0,0 +1,35 @@
|
|||
out vec4 FragColor;
|
||||
|
||||
in vec2 tex_coord;
|
||||
|
||||
uniform vec2 font_size;
|
||||
uniform vec4 pad;
|
||||
uniform vec4 glyph;
|
||||
uniform vec4 color;
|
||||
uniform vec4 back;
|
||||
uniform sampler2D tex;
|
||||
uniform int flags;
|
||||
uniform int ch_index;
|
||||
uniform float time;
|
||||
|
||||
#define FLAG_UL 0x01
|
||||
#define FLAG_CL 0x02
|
||||
#define FLAG_BL 0x04
|
||||
#define FLAG_FD 0x08
|
||||
|
||||
void main() {
|
||||
vec2 tex_pos = glyph.st - pad.st + tex_coord * ((glyph.pq + pad.pq) - (glyph.st - pad.st));
|
||||
if((flags & FLAG_CL) != 0 && tex_pos.y >= floor(font_size.y / 2.0) && tex_pos.y < (floor(font_size.y / 2.0) + 1.0))
|
||||
FragColor = vec4(0.25, 0.25, 0.25, color.a);
|
||||
else if((flags & FLAG_UL) != 0 && tex_pos.y >= (font_size.y - 2.0) && tex_pos.y < (font_size.y - 1.0))
|
||||
FragColor = vec4(0.95, 0.1, 0.1, color.a);
|
||||
else if(tex_pos.x < glyph.s || tex_pos.x > glyph.p || tex_pos.y < glyph.t || tex_pos.y > glyph.q)
|
||||
FragColor = vec4(0.0);
|
||||
else
|
||||
FragColor = texture(tex, (vec2(float(ch_index & 15), float((ch_index >> 4) & 15)) + (tex_pos / font_size)) / 16.0) * color;
|
||||
if((flags & FLAG_BL) != 0 && fract(time) >= 0.5)
|
||||
FragColor = vec4(0.0, 1.0, 0.0, FragColor.a);
|
||||
if((flags & FLAG_FD) != 0)
|
||||
FragColor = mix(FragColor, vec4(1.0, 1.0, 1.0, FragColor.a), sin(radians(fract(time + tex_coord.y) * 360.0)) * 0.5 + 0.5);
|
||||
FragColor = mix(back, FragColor, FragColor.a);
|
||||
}
|
Reference in a new issue