From: Mikko Rasa Date: Tue, 26 Oct 2010 08:39:37 +0000 (+0000) Subject: Do not show path on new tracks X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=a78b546b0a1ff9fb073742a267fb49b6f2560a31;p=r2c2.git Do not show path on new tracks Display errors from add_tracks_to_route in status bar Adjust rendering pipeline to better support semi-transparent base objects --- diff --git a/source/designer/designer.cpp b/source/designer/designer.cpp index 5fd0f44..c2c26da 100644 --- a/source/designer/designer.cpp +++ b/source/designer/designer.cpp @@ -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 &tracks = layout_3d->get_tracks(); for(list::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::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; diff --git a/source/designer/designer.h b/source/designer/designer.h index e9ba62a..d229324 100644 --- a/source/designer/designer.h +++ b/source/designer/designer.h @@ -60,6 +60,7 @@ private: Marklin::Overlay3D *overlay; Msp::GL::Object *base_object; Marklin::Route *cur_route; + std::list 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();