]> git.tdb.fi Git - r2c2.git/commitdiff
Adapt to changes in vector slicing and composing API
authorMikko Rasa <tdb@tdb.fi>
Wed, 28 Jan 2015 18:47:28 +0000 (20:47 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 28 Jan 2015 18:47:28 +0000 (20:47 +0200)
source/3d/layout.cpp
source/3d/view.cpp
source/designer/designer.cpp
source/engineer/engineer.cpp
source/libr2c2/vehicleplacement.cpp

index f30e427db65d21a81287406c534748f13d46af85..19b59eee6bbf300cc63382749b13e0f564bf6b6f 100644 (file)
@@ -196,9 +196,9 @@ void Layout3D::tick()
                Transform::rotation(Angle::half_turn()-time_of_day, Vector(0, 0, 1))*
                Transform::rotation(axial_tilt, Vector(-1, 0, 0));
        Vector sun_dir = trans.transform_linear(Vector(0, -1, 0));
-       Vector diff = Vector(sun.get_position())-sun_dir;
+       Vector diff = sun.get_position().slice<3>(0)-sun_dir;
        if(diff.norm()>0.0025f)
-               sun.set_position(GL::Vector4(sun_dir, 0.0f));
+               sun.set_position(compose(sun_dir, 0.0f));
 
        double T = 5777;
        double h = 6.62606957e-34;  // Planck constant
index 8c35245b4d97dd1b6d6c27147fc9494d6827ebd8..2050f587ec08eebc143bfe6eae38204bb1cfe13c 100644 (file)
@@ -60,7 +60,7 @@ Ray View3D::create_ray(float x, float y) const
 {
        const GL::Vector3 &start = camera.get_position();
        GL::Vector4 ray = camera.unproject(GL::Vector4(x, y, 0, 0));
-       return Ray(start, Vector(ray));
+       return Ray(start, ray.slice<3>(0));
 }
 
 void View3D::compute_bounds(Vector &minp, Vector &maxp)
index 5daa16c3a6d0075c68ee9a1a341585679f20da94..511c901b5d5b3c70aa9ef086f775ff4ca72cf302 100644 (file)
@@ -520,7 +520,7 @@ Object *Designer::pick_object(const Vector &pointer)
        const GL::Vector3 &cpos = view.get_camera().get_position();
        GL::Vector4 cray = view.get_camera().unproject(GL::Vector4(pointer.x, pointer.y, 0, 0));
 
-       return view.get_layout().get_layout().pick<Object>(Ray(cpos, Vector(cray)));
+       return view.get_layout().get_layout().pick<Object>(Ray(cpos, cray.slice<3>(0)));
 }
 
 void Designer::update_object_icon(Object &obj)
index dedbf3cc5864e197cce7a77791e84162dc6e35cd..fc93cf66b6076555a76129c745b1900f6dd78eff 100644 (file)
@@ -306,9 +306,9 @@ Object *Engineer::pick_object(const Vector &p)
        GL::Vector4 ray = main_view.get_camera().unproject(GL::Vector4(p.x, p.y, 0, 0));
 
        // XXX Do this better; make this function a template?
-       if(Vehicle *veh = layout.pick<Vehicle>(Ray(start, Vector(ray))))
+       if(Vehicle *veh = layout.pick<Vehicle>(Ray(start, ray.slice<3>(0))))
                return veh;
-       return layout.pick<Track>(Ray(start, Vector(ray)));
+       return layout.pick<Track>(Ray(start, ray.slice<3>(0)));
 }
 
 void Engineer::emergency(Block *block, const string &msg)
index 5bf989927745a827e7686019ba53fe70553491a6..273a9cc32e43091396bb04ab5b7ee3cf2e1a84f5 100644 (file)
@@ -181,7 +181,7 @@ OrientedPoint VehiclePlacement::create_point(const Vector &front, const Vector &
        OrientedPoint result;
        result.position = front*(1-ratio)+back*ratio;
        result.rotation = Geometry::atan2<float>(front.y-back.y, front.x-back.x);
-       result.tilt = Geometry::atan2<float>(front.z-back.z, LinAl::Vector<float, 2>(front-back).norm());
+       result.tilt = Geometry::atan2<float>(front.z-back.z, (front-back).slice<2>(0).norm());
        return result;
 }