From: Mikko Rasa Date: Thu, 7 Apr 2011 16:24:21 +0000 (+0000) Subject: Make TrackWrap take a Layout3D since it doesn't really need Designer X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=6c2b29fb45402ee86b010f05367dad20972d25ed;p=r2c2.git Make TrackWrap take a Layout3D since it doesn't really need Designer --- diff --git a/source/designer/designer.cpp b/source/designer/designer.cpp index fde251c..bfb3d56 100644 --- a/source/designer/designer.cpp +++ b/source/designer/designer.cpp @@ -57,8 +57,7 @@ Designer::Designer(int argc, char **argv): mode(SELECT), manipulator(*this, root, selection), measure(*this), - camera_ctl(*this, root, camera), - track_wrap(*this, selection) + camera_ctl(*this, root, camera) { window.set_title("Railway Designer"); window.signal_close.connect(sigc::bind(sigc::mem_fun(this, &Designer::exit), 0)); @@ -98,7 +97,6 @@ Designer::Designer(int argc, char **argv): pipeline->add_renderable_for_pass(layout_3d->get_scene(), 0); if(base_object) pipeline->add_renderable(*base_object); - pipeline->add_renderable_for_pass(track_wrap, "unlit"); pipeline->add_renderable_for_pass(layout_3d->get_path_scene(), "unlit"); pipeline->add_renderable_for_pass(layout_3d->get_endpoint_scene(), "unlit"); @@ -152,6 +150,8 @@ Designer::Designer(int argc, char **argv): statusbar->add(*lbl_status); lbl_status->set_geometry(GLtk::Geometry(20, 2, 300, 16)); + track_wrap = new TrackWrap(*layout_3d, selection); + pipeline->add_renderable_for_pass(*track_wrap, "unlit"); overlay = new Overlay3D(ui_res.get_default_font()); pipeline->add_renderable_for_pass(*overlay, "overlay"); diff --git a/source/designer/designer.h b/source/designer/designer.h index 49d4283..a50c5b8 100644 --- a/source/designer/designer.h +++ b/source/designer/designer.h @@ -73,7 +73,7 @@ private: Manipulator manipulator; Measure measure; CameraController camera_ctl; - TrackWrap track_wrap; + TrackWrap *track_wrap; Msp::Time::TimeStamp last_tick; diff --git a/source/designer/trackwrap.cpp b/source/designer/trackwrap.cpp index 45ec19c..47225e3 100644 --- a/source/designer/trackwrap.cpp +++ b/source/designer/trackwrap.cpp @@ -8,7 +8,6 @@ Distributed under the GPL #include #include #include "3d/tracktype.h" -#include "designer.h" #include "selection.h" #include "trackwrap.h" @@ -16,8 +15,8 @@ using namespace std; using namespace Msp; using namespace R2C2; -TrackWrap::TrackWrap(Designer &d, Selection &s): - designer(d), +TrackWrap::TrackWrap(Layout3D &l, Selection &s): + layout(l), selection(s) { selection.signal_changed.connect(sigc::mem_fun(this, &TrackWrap::selection_changed)); @@ -60,7 +59,7 @@ GL::Mesh &TrackWrap::get_mesh(const TrackType &type) if(j!=meshes.end()) return *j->second; - const TrackType3D &type3d = designer.get_layout_3d().get_catalogue().get_track(type); + const TrackType3D &type3d = layout.get_catalogue().get_track(type); float min_area = -1; float angle = 0; diff --git a/source/designer/trackwrap.h b/source/designer/trackwrap.h index 3628515..8a72892 100644 --- a/source/designer/trackwrap.h +++ b/source/designer/trackwrap.h @@ -11,6 +11,7 @@ Distributed under the GPL #include #include #include "libr2c2/track.h" +#include "3d/layout.h" class Designer; class Selection; @@ -24,13 +25,13 @@ private: Msp::GL::Mesh *mesh; }; - Designer &designer; + R2C2::Layout3D &layout; Selection &selection; std::map meshes; std::list wraps; public: - TrackWrap(Designer &, Selection &); + TrackWrap(R2C2::Layout3D &, Selection &); ~TrackWrap(); virtual void render(const Msp::GL::Tag &) const;