]> git.tdb.fi Git - r2c2.git/blobdiff - source/engineer/trainview.h
Add TrainView for viewing the layout from the train's perspective
[r2c2.git] / source / engineer / trainview.h
diff --git a/source/engineer/trainview.h b/source/engineer/trainview.h
new file mode 100644 (file)
index 0000000..16a1ef9
--- /dev/null
@@ -0,0 +1,51 @@
+/* $Id$
+
+This file is part of the MSP Märklin suite
+Copyright © 2010  Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
+#ifndef TRAINVIEW_H_
+#define TRAINVIEW_H_
+
+#include <msp/gl/renderbuffer.h>
+#include <msp/gl/framebuffer.h>
+#include <msp/gl/texture2d.h>
+#include <msp/gltk/panel.h>
+#include "libmarklin/train.h"
+
+class Engineer;
+
+class TrainView: public Msp::GLtk::Panel
+{
+public:
+       enum Mode
+       {
+               ROOF,
+               SIDE,
+               HEAD
+       };
+
+private:
+       Engineer &engineer;
+       const Marklin::Train &train;
+       Mode mode;
+       Msp::GL::Framebuffer fbo;
+       Msp::GL::Texture2D tex;
+       Msp::GL::Renderbuffer depth;
+       Msp::GL::Camera camera;
+       Msp::GL::Pipeline pipeline;
+       bool stale;
+
+public:
+       TrainView(Engineer &, const Marklin::Train &);
+       ~TrainView();
+
+       void set_mode(Mode);
+       void prepare();
+private:
+       virtual void button_release(int, int, unsigned);
+       void close_clicked();
+};
+
+#endif