blob: 009094ccc8496a648c118a531d6a0baa6b09e72b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// Cell coords.
attribute vec2 cellCoords;
// Glyph coords.
attribute vec2 glyphCoords;
// uv mapping.
attribute vec2 uv;
// Text foreground rgb packed together with cell flags. textColor.a
// are the bitflags; consult RenderingGlyphFlags in renderer/mod.rs
// for the possible values.
attribute vec4 textColor;
// Background color.
attribute vec4 backgroundColor;
varying vec2 TexCoords;
varying vec3 fg;
varying float colored;
varying vec4 bg;
uniform highp int renderingPass;
uniform vec4 projection;
void main() {
vec2 projectionOffset = projection.xy;
vec2 projectionScale = projection.zw;
vec2 position;
if (renderingPass == 0) {
TexCoords = vec2(0, 0);
position = cellCoords;
} else {
TexCoords = uv;
position = glyphCoords;
}
fg = vec3(float(textColor.r), float(textColor.g), float(textColor.b)) / 255.;
colored = float(textColor.a);
bg = vec4(float(backgroundColor.r), float(backgroundColor.g), float(backgroundColor.b),
float(backgroundColor.a)) / 255.;
vec2 finalPosition = projectionOffset + position * projectionScale;
gl_Position = vec4(finalPosition, 0., 1.);
}
|