]> git.tdb.fi Git - r2c2.git/blobdiff - source/3d/track.h
Emit various signals from Train when it's loaded
[r2c2.git] / source / 3d / track.h
index f38593ec08e2ee3e169e534c7243d19f2c02770f..94865cfdf4afcf96837d84a552cebd2471cf26af 100644 (file)
@@ -1,39 +1,48 @@
+/* $Id$
+
+This file is part of the MSP Märklin suite
+Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
 #ifndef MARKLIN3D_TRACK_H_
 #define MARKLIN3D_TRACK_H_
 
 #include <list>
+#include <msp/gl/renderable.h>
 #include <msp/gl/vertexarray.h>
+#include <msp/gl/vertexarraybuilder.h>
 #include "libmarklin/track.h"
-#include "misc.h"
+#include "libmarklin/trackpart.h"
+#include "object.h"
 
 namespace Marklin {
 
-class Track3D
+class Endpoint3D;
+class Layout3D;
+class TrackType3D;
+
+class Track3D: public Object3D, public Msp::GL::Renderable
 {
+private:
+       Layout3D &layout;
+       Track &track;
+       const TrackType3D &type;
+       std::vector<Endpoint3D *> endpoints;
+
 public:
-       Track3D(Track &, unsigned);
-       void set_color(const Color &c)  { color=c; }
-       void set_quality(unsigned);
-       void get_bounds(float, Point &, Point &) const;
+       Track3D(Layout3D &, Track &);
+       ~Track3D();
+
+       Layout3D &get_layout() const { return layout; }
        Track &get_track() const { return track; }
-       void render();
-       void render_endpoints();
-       void render_route(int);
-private:
-       Track        &track;
-       Color        color;
-       std::vector<Point> border;
-       Msp::GL::VertexArray varray;
-       std::vector<unsigned> base_seq;
-       std::vector<unsigned> rail_seq;
-       std::vector<std::vector<unsigned> > route_seq;
-       unsigned quality;
-
-       void prepare_render();
-       void build_object();
-       void build_part(const Track::Part &, Msp::GL::VertexArrayBuilder &, unsigned &);
+       const TrackType3D &get_type() const { return type; }
+       void get_bounds(float, Point &, Point &) const;
+
+       virtual Point get_node() const;
+
+       virtual void render(const Msp::GL::Tag &) const;
 };
-typedef std::list<Track3D *> Track3DSeq;
 
 } // namespace Marklin