]> git.tdb.fi Git - r2c2.git/commitdiff
Do not show path on new tracks
authorMikko Rasa <tdb@tdb.fi>
Tue, 26 Oct 2010 08:39:37 +0000 (08:39 +0000)
committerMikko Rasa <tdb@tdb.fi>
Tue, 26 Oct 2010 08:39:37 +0000 (08:39 +0000)
Display errors from add_tracks_to_route in status bar
Adjust rendering pipeline to better support semi-transparent base objects

source/designer/designer.cpp
source/designer/designer.h

index 5fd0f4468797793301db6fb919377f1fd92d0b08..c2c26da8332e3cc9d016a5af2eb3a48d731f6e12 100644 (file)
@@ -68,6 +68,8 @@ Designer::Designer(int argc, char **argv):
        layout = new Layout(catalogue);
        layout_3d = new Layout3D(*layout);
 
+       layout->signal_track_added.connect(sigc::mem_fun(this, &Designer::track_added));
+
        if(argc>1)
        {
                filename = argv[1];
@@ -87,7 +89,7 @@ Designer::Designer(int argc, char **argv):
        pipeline->set_camera(&camera);
        pipeline->add_renderable_for_pass(layout_3d->get_scene(), 0);
        if(base_object)
-               pipeline->add_renderable_for_pass(*base_object, 0);
+               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");
@@ -103,6 +105,11 @@ Designer::Designer(int argc, char **argv):
        pass->depth_test = &GL::DepthTest::lequal();
        pass->blend = &GL::Blend::alpha();
 
+       pass = &pipeline->add_pass("blended");
+       pass->lighting = &lighting;
+       pass->depth_test = &GL::DepthTest::lequal();
+       pass->blend = &GL::Blend::alpha();
+
        camera.set_up_direction(GL::Vector3(0, 0, 1));
        view_all();
 
@@ -133,8 +140,6 @@ Designer::Designer(int argc, char **argv):
        const list<Track3D *> &tracks = layout_3d->get_tracks();
        for(list<Track3D *>::const_iterator i=tracks.begin(); i!=tracks.end(); ++i)
                update_track_icon(**i);
-
-       edit_route(0);
 }
 
 Designer::~Designer()
@@ -234,7 +239,7 @@ void Designer::add_selection_to_route()
        }
        catch(const Exception &e)
        {
-               IO::print("%s\n", e.what());
+               lbl_status->set_text(e.what());
        }
 
        show_route(cur_route);
@@ -256,6 +261,10 @@ void Designer::tick()
        float dt = (t-last_tick)/Msp::Time::sec;
        last_tick = t;
 
+       for(list<Track *>::iterator i=new_tracks.begin(); i!=new_tracks.end(); ++i)
+               layout_3d->get_track(**i).get_path().set_mask(0);
+       new_tracks.clear();
+
        window.get_display().tick();
        root->tick();
        camera_ctl.tick(dt);
@@ -463,6 +472,11 @@ void Designer::render()
        GL::Texture::unbind();
 }
 
+void Designer::track_added(Track &trk)
+{
+       new_tracks.push_back(&trk);
+}
+
 Track3D *Designer::pick_track(int x, int y)
 {
        Layout3D *l = layout_3d;
index e9ba62ae06ffbd4e25a598ca385a38a5d1a31dd2..d229324fb8ccc23a7d65a85d2b2a3937268984f1 100644 (file)
@@ -60,6 +60,7 @@ private:
        Marklin::Overlay3D *overlay;
        Msp::GL::Object *base_object;
        Marklin::Route *cur_route;
+       std::list<Marklin::Track *> new_tracks;
        Msp::GL::Pipeline *pipeline;
        Msp::GL::Camera camera;
        Msp::GL::Lighting lighting;
@@ -107,6 +108,7 @@ private:
        void pointer_motion(int, int);
        void apply_camera();
        void render();
+       void track_added(Marklin::Track &);
        Marklin::Track3D *pick_track(int, int);
        void update_track_icon(Marklin::Track3D &);
        void selection_changed();