diff options
Diffstat (limited to 'res/text.v.glsl')
-rw-r--r-- | res/text.v.glsl | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/res/text.v.glsl b/res/text.v.glsl index 99234775..cca40219 100644 --- a/res/text.v.glsl +++ b/res/text.v.glsl @@ -24,14 +24,16 @@ layout (location = 2) in vec4 glyph; layout (location = 3) in vec4 uv; // text fg color -layout (location = 4) in vec3 textColor; +layout (location = 4) in uvec4 textColor; // Background color -layout (location = 5) in vec3 backgroundColor; +layout (location = 5) in uvec4 backgroundColor; out vec2 TexCoords; out vec3 fg; out vec3 bg; +uniform vec3 colors[18]; + // Terminal properties uniform vec2 termDim; uniform vec2 cellDim; @@ -73,6 +75,33 @@ void main() } background = backgroundPass; - bg = backgroundColor / vec3(255.0, 255.0, 255.0); - fg = textColor / vec3(255.0, 255.0, 255.0); + switch (textColor.x) { + case 0u: + // cell::Color::Rgb + fg = vec3(textColor.yzw) / vec3(255.0, 255.0, 255.0); + break; + case 1u: + // cell::Color::Ansi + fg = vec3(colors[textColor.y]); + break; + default: + // Should never happen; let's make it red + fg = vec3(1.0, 0.0, 0.0); + break; + } + + switch (backgroundColor.x) { + case 0u: + // cell::Color::Rgb + bg = vec3(backgroundColor.yzw) / vec3(255.0, 255.0, 255.0); + break; + case 1u: + // cell::Color::Ansi + bg = vec3(colors[backgroundColor.y]); + break; + default: + // Should never happen; let's make it blue + bg = vec3(0.0, 0.0, 1.0); + break; + } } |