/* $Id$
-This file is part of the MSP Märklin suite
+This file is part of R²C²
Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa
Distributed under the GPL
*/
-#ifndef MARKLIN3D_TRACK_H_
-#define MARKLIN3D_TRACK_H_
+#ifndef R2C2_3D_TRACK_H_
+#define R2C2_3D_TRACK_H_
#include <list>
-#include <msp/gl/color.h>
+#include <msp/gl/renderable.h>
#include <msp/gl/vertexarray.h>
#include <msp/gl/vertexarraybuilder.h>
-#include "libmarklin/track.h"
-#include "libmarklin/trackpart.h"
+#include "libr2c2/track.h"
+#include "libr2c2/trackpart.h"
+#include "object.h"
-namespace Marklin {
+namespace R2C2 {
+class Endpoint3D;
class Layout3D;
+class Path3D;
class TrackType3D;
-class Track3D
+class Track3D: public Object3D, public Msp::GL::Renderable
{
private:
Layout3D &layout;
Track &track;
const TrackType3D &type;
- Msp::GL::Color color;
+ std::vector<Endpoint3D *> endpoints;
+ Path3D *path;
public:
Track3D(Layout3D &, Track &);
+ ~Track3D();
+ Layout3D &get_layout() const { return layout; }
Track &get_track() const { return track; }
- void set_color(const Msp::GL::Color &);
+ const TrackType3D &get_type() const { return type; }
void get_bounds(float, Point &, Point &) const;
- void render() const;
- void render_endpoints() const;
- void render_path(int) const;
-private:
- void prepare_render(bool) const;
+ Path3D &get_path() { return *path; }
+
+ virtual Point get_node() const;
+ virtual bool is_visible() const { return true; }
+
+ void apply_matrix() const;
+ virtual void render(const Msp::GL::Tag &) const;
};
-} // namespace Marklin
+} // namespace R2C2
#endif