]> git.tdb.fi Git - r2c2.git/commitdiff
Make TrackWrap take a Layout3D since it doesn't really need Designer
authorMikko Rasa <tdb@tdb.fi>
Thu, 7 Apr 2011 16:24:21 +0000 (16:24 +0000)
committerMikko Rasa <tdb@tdb.fi>
Thu, 7 Apr 2011 16:24:21 +0000 (16:24 +0000)
source/designer/designer.cpp
source/designer/designer.h
source/designer/trackwrap.cpp
source/designer/trackwrap.h

index fde251cfccd4c8f7afc7da6050b458a25439d159..bfb3d5629b60f2525e12f4c89a0df9b9e47b7b31 100644 (file)
@@ -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");
 
index 49d4283da2bbf9f026362c875f10239b35d8dd05..a50c5b8202c90e3c440046ca7e6e7690de6c31fc 100644 (file)
@@ -73,7 +73,7 @@ private:
        Manipulator manipulator;
        Measure measure;
        CameraController camera_ctl;
-       TrackWrap track_wrap;
+       TrackWrap *track_wrap;
 
        Msp::Time::TimeStamp last_tick;
 
index 45ec19c85a8c1a33ac4b0bdfb1dbaac9c8c1ffe3..47225e3904af04c39f6ae2afcd49efce68083b4a 100644 (file)
@@ -8,7 +8,6 @@ Distributed under the GPL
 #include <msp/gl/matrix.h>
 #include <msp/gl/meshbuilder.h>
 #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;
index 36285150dc58b619946f74efb597d3e81ee6f196..8a72892e66c5a0467402b63098a56b3559a61641 100644 (file)
@@ -11,6 +11,7 @@ Distributed under the GPL
 #include <msp/gl/mesh.h>
 #include <msp/gl/renderable.h>
 #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<const R2C2::TrackType *, Msp::GL::Mesh *> meshes;
        std::list<Wrap> wraps;
 
 public:
-       TrackWrap(Designer &, Selection &);
+       TrackWrap(R2C2::Layout3D &, Selection &);
        ~TrackWrap();
 
        virtual void render(const Msp::GL::Tag &) const;