free_font.vert 832 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #version 330 core
  2. #define FONT_WIDTH 128
  3. #define FONT_HEIGHT 64
  4. #define FONT_COLS 18
  5. #define FONT_ROWS 7
  6. #define FONT_CH_W (FONT_WIDTH / FONT_COLS)
  7. #define FONT_CH_H (FONT_HEIGHT / FONT_ROWS)
  8. uniform float scale;
  9. uniform vec2 resolution;
  10. uniform float time;
  11. uniform vec2 camera;
  12. layout(location = 0) in ivec2 pos;
  13. layout(location = 1) in ivec2 size;
  14. layout(location = 2) in int c;
  15. layout(location = 3) in vec4 fg_color;
  16. layout(location = 4) in vec4 bg_color;
  17. out vec2 uv;
  18. flat out int glyph_c;
  19. out vec4 glyph_fg_color;
  20. out vec4 glyph_bg_color;
  21. vec2 project_point(vec2 point)
  22. {
  23. return (2.0 * (point - camera)) / resolution;
  24. }
  25. void main()
  26. {
  27. uv = vec2(float(gl_VertexID & 1),
  28. float((gl_VertexID >> 1) & 1));
  29. gl_Position = vec4(uv- 0.5, 0.0, 1.0);
  30. glyph_c = c;
  31. glyph_fg_color = fg_color;
  32. glyph_bg_color = bg_color;
  33. }