X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2F3d%2Ftrack.h;h=7b8c23565f3024ecb1c954f6839a7f3c48fd8925;hb=7e27b311e33beda1746eb63e0945633f262427f6;hp=a9154b7c6bbb628fb486d7d934601224a03a37ce;hpb=52cbe8d99669f843f8f75c51128e2748584dd03a;p=r2c2.git diff --git a/source/3d/track.h b/source/3d/track.h index a9154b7..7b8c235 100644 --- a/source/3d/track.h +++ b/source/3d/track.h @@ -1,42 +1,54 @@ -#ifndef MARKLIN3D_TRACK_H_ -#define MARKLIN3D_TRACK_H_ +/* $Id$ + +This file is part of R²C² +Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa +Distributed under the GPL +*/ + +#ifndef R2C2_3D_TRACK_H_ +#define R2C2_3D_TRACK_H_ #include +#include #include #include -#include "libmarklin/track.h" -#include "libmarklin/trackpart.h" -#include "misc.h" +#include "libr2c2/track.h" +#include "libr2c2/trackpart.h" +#include "object.h" + +namespace R2C2 { -namespace Marklin { +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; + std::vector endpoints; + Path3D *path; + 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 border; - Msp::GL::VertexArray varray; - std::vector base_seq; - std::vector rail_seq; - std::vector > route_seq; - unsigned quality; - - void prepare_render(); - void build_object(); - void build_part(const TrackPart &, Msp::GL::VertexArrayBuilder &, unsigned &); + const TrackType3D &get_type() const { return type; } + void get_bounds(float, Point &, Point &) 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; }; -typedef std::list Track3DSeq; -} // namespace Marklin +} // namespace R2C2 #endif