]> git.tdb.fi Git - r2c2.git/blob - source/engineer/trainview.h
Add TrainView for viewing the layout from the train's perspective
[r2c2.git] / source / engineer / trainview.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2010  Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef TRAINVIEW_H_
9 #define TRAINVIEW_H_
10
11 #include <msp/gl/renderbuffer.h>
12 #include <msp/gl/framebuffer.h>
13 #include <msp/gl/texture2d.h>
14 #include <msp/gltk/panel.h>
15 #include "libmarklin/train.h"
16
17 class Engineer;
18
19 class TrainView: public Msp::GLtk::Panel
20 {
21 public:
22         enum Mode
23         {
24                 ROOF,
25                 SIDE,
26                 HEAD
27         };
28
29 private:
30         Engineer &engineer;
31         const Marklin::Train &train;
32         Mode mode;
33         Msp::GL::Framebuffer fbo;
34         Msp::GL::Texture2D tex;
35         Msp::GL::Renderbuffer depth;
36         Msp::GL::Camera camera;
37         Msp::GL::Pipeline pipeline;
38         bool stale;
39
40 public:
41         TrainView(Engineer &, const Marklin::Train &);
42         ~TrainView();
43
44         void set_mode(Mode);
45         void prepare();
46 private:
47         virtual void button_release(int, int, unsigned);
48         void close_clicked();
49 };
50
51 #endif