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