From: Mikko Rasa Date: Fri, 9 Aug 2013 17:41:04 +0000 (+0300) Subject: Remove the now-unused async picking code from Engineer X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=3bd82be700904d2c1428e6ba35642426c76beeaa;p=r2c2.git Remove the now-unused async picking code from Engineer --- diff --git a/arrow.mesh b/arrow.mesh deleted file mode 100644 index 8433feb..0000000 --- a/arrow.mesh +++ /dev/null @@ -1,15 +0,0 @@ -vertices COLOR4_UBYTE VERTEX2 -{ - color4 1.0 1.0 1.0 1.0; - vertex2 0.08 0.00; - vertex2 0.05 0.03; - vertex2 0.05 0.01; - vertex2 0.00 0.01; - vertex2 0.00 -0.01; - vertex2 0.05 -0.01; - vertex2 0.05 -0.03; -}; -batch TRIANGLE_FAN -{ - indices 0 1 2 3 4 5 6; -}; diff --git a/source/engineer/engineer.cpp b/source/engineer/engineer.cpp index f89fbd1..9b49c84 100644 --- a/source/engineer/engineer.cpp +++ b/source/engineer/engineer.cpp @@ -42,12 +42,7 @@ Engineer::Engineer(int argc, char **argv): layout(catalogue, (options.driver.empty() ? 0 : Driver::create(options.driver))), layout_3d(layout), server(0), - main_view(layout_3d, window.get_width(), window.get_height()), - picking(false), - picking_track(0), - picking_entry(0), - picking_path(0), - pointer_moved(false) + main_view(layout_3d, window.get_width(), window.get_height()) { // Setup GUI window.set_title("Railroad Engineer"); @@ -93,8 +88,6 @@ Engineer::Engineer(int argc, char **argv): } // Setup 3D view - DataFile::load(arrow_mesh, "arrow.mesh"); - GL::Pipeline &pipeline = main_view.get_pipeline(); GL::Pipeline::Pass *pass = &pipeline.add_pass("unlit"); @@ -151,13 +144,6 @@ void Engineer::remove_train_view(TrainView &tv) train_views.erase(remove(train_views.begin(), train_views.end(), &tv), train_views.end()); } -void Engineer::pick(bool with_ep) -{ - picking = true; - picking_track = 0; - picking_entry = (with_ep ? 0 : -1); -} - int Engineer::main() { window.show(); @@ -189,40 +175,6 @@ void Engineer::tick() main_view.render(); - if(pointer_moved) - { - pointer_moved = false; - - if(picking) - { - Track *track = dynamic_cast(pick_object(pointer)); - if(track && track!=picking_track) - { - picking_track = track; - if(picking_entry>=0) - picking_entry = 0; - - delete picking_path; - picking_path = new Path3D(layout_3d.get(*track)); - picking_path->set_color(GL::Color(0)); - picking_path->set_layer(2); - } - } - } - - if(picking && picking_track && picking_entry>=0) - { - main_view.get_camera().apply(); - GL::MatrixStack::Push push_mat(GL::MatrixStack::modelview()); - - Snap sn = picking_track->get_snap_node(picking_entry); - - GL::MatrixStack::modelview() *= GL::Matrix::translation(sn.position+GL::Vector3(0, 0, 0.03)); - GL::MatrixStack::modelview() *= GL::Matrix::rotation(sn.rotation+Angle::half_turn(), 0, 0, 1); - - arrow_mesh.draw(); - } - root->render(); window.swap_buffers(); @@ -230,21 +182,7 @@ void Engineer::tick() void Engineer::button_press(unsigned btn) { - if(picking) - { - if(btn==1 && picking_track) - { - picking = false; - delete picking_path; - picking_path = 0; - signal_pick_done.emit(picking_track, picking_entry); - } - else if(btn==3 && picking_entry>=0) - { - picking_entry = (picking_entry+1)%picking_track->get_type().get_endpoints().size(); - } - } - else + if(btn==1) { Object *obj = pick_object(pointer); if(Track *track = dynamic_cast(obj)) @@ -291,7 +229,6 @@ void Engineer::axis_motion(unsigned axis, float value, float) pointer.x = value; if(axis==1) pointer.y = value; - pointer_moved = true; } void Engineer::view_all() diff --git a/source/engineer/engineer.h b/source/engineer/engineer.h index 612fe66..c4ee605 100644 --- a/source/engineer/engineer.h +++ b/source/engineer/engineer.h @@ -23,9 +23,6 @@ class TrainView; class Engineer: public Msp::RegisteredApplication { -public: - sigc::signal signal_pick_done; - private: Options options; @@ -44,18 +41,12 @@ private: std::map train_colors; R2C2::View3D main_view; - Msp::GL::Mesh arrow_mesh; MainWindow *main_wnd; std::list new_trains; std::list train_views; Msp::Time::TimeStamp status_timeout; - bool picking; - R2C2::Track *picking_track; - int picking_entry; - R2C2::Path3D *picking_path; R2C2::Vector pointer; - bool pointer_moved; public: Engineer(int argc, char **argv); @@ -70,7 +61,6 @@ public: void set_status(const std::string &); void add_train_view(TrainView &); void remove_train_view(TrainView &); - void pick(bool); int main(); void quit() { exit(0); } private: