Horizon
grid.hpp
1 #pragma once
2 #include "common/common.hpp"
3 #include <epoxy/gl.h>
4 
5 namespace horizon {
6 class Grid {
7  friend class CanvasGL;
8 
9 public:
10  Grid(const class CanvasGL &c);
11  void realize();
12  void render();
13  void render_cursor(Coord<int64_t> &coord);
14  enum class Style { CROSS, DOT, GRID };
15 
16 private:
17  const CanvasGL &ca;
18  Coordi spacing;
19  Coordi origin;
20  unsigned int major = 0;
21  float mark_size;
22  unsigned int mul = 0;
23 
24  GLuint program;
25  GLuint vao;
26  GLuint vbo;
27 
28  GLuint screenmat_loc;
29  GLuint viewmat_loc;
30  GLuint scale_loc;
31  GLuint grid_size_loc;
32  GLuint grid_0_loc;
33  GLuint grid_mod_loc;
34  GLuint mark_size_loc;
35  GLuint color_loc;
36 };
37 } // namespace horizon