]> git.tdb.fi Git - r2c2.git/commitdiff
Remove the now-unused async picking code from Engineer
authorMikko Rasa <tdb@tdb.fi>
Fri, 9 Aug 2013 17:41:04 +0000 (20:41 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 11 Aug 2013 12:25:52 +0000 (15:25 +0300)
arrow.mesh [deleted file]
source/engineer/engineer.cpp
source/engineer/engineer.h

diff --git a/arrow.mesh b/arrow.mesh
deleted file mode 100644 (file)
index 8433feb..0000000
+++ /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;
-};
index f89fbd174d061aad7b5838a885de09976f8390dc..9b49c847ca5a21ff11229f0bb42e5252f622b9fb 100644 (file)
@@ -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<Track *>(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<Track3D>(*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<Track *>(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()
index 612fe6671854854d70cb29affd0854b831e8bdb0..c4ee605a07a54aa89118eed68a82f8587de91497 100644 (file)
@@ -23,9 +23,6 @@ class TrainView;
 
 class Engineer: public Msp::RegisteredApplication<Engineer>
 {
-public:
-       sigc::signal<void, R2C2::Track *, int> signal_pick_done;
-
 private:
        Options options;
 
@@ -44,18 +41,12 @@ private:
        std::map<R2C2::Train *, Msp::GL::Color> train_colors;
 
        R2C2::View3D main_view;
-       Msp::GL::Mesh arrow_mesh;
 
        MainWindow *main_wnd;
        std::list<R2C2::Train *> new_trains;
        std::list<TrainView *> 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: