]> git.tdb.fi Git - r2c2.git/blob - source/3d/overlay.h
Store zone blocks in order and use add_tracks to load them
[r2c2.git] / source / 3d / overlay.h
1 #ifndef R2C2_3D_OVERLAY_H_
2 #define R2C2_3D_OVERLAY_H_
3
4 #include <msp/gl/camera.h>
5 #include <msp/gl/font.h>
6 #include <msp/gl/mesh.h>
7 #include <msp/gl/renderable.h>
8
9 namespace R2C2 {
10
11 class Object3D;
12
13 class Overlay3D: public Msp::GL::Renderable
14 {
15 private:        
16         struct Icon
17         {
18                 std::vector<const Msp::GL::Mesh *> graphics;
19                 std::string label;
20                 float width;
21                 Msp::GL::Mesh background;
22                 Msp::GL::Mesh text;
23
24                 Icon();
25         };
26
27         const Msp::GL::Font &font;
28         std::map<std::string, Msp::GL::Mesh *> graphics;
29         std::map<const Object3D *, Icon *> icons;
30
31 public:
32         Overlay3D(const Msp::GL::Font &);
33         ~Overlay3D();
34
35         void set_label(const Object3D &, const std::string &);
36         void add_graphic(const Object3D &, const std::string &);
37         void remove_graphic(const Object3D &, const std::string &);
38         void clear_graphics(const Object3D &);
39         void clear(const Object3D &);
40
41         virtual void render(Msp::GL::Renderer &, const Msp::GL::Tag &) const;
42
43 private:
44         Icon &get_icon(const Object3D &);
45         const Msp::GL::Mesh *get_graphic(const std::string &);
46         void update_icon(Icon &);
47 };
48
49 } // namespace R2C2
50
51 #endif