]> git.tdb.fi Git - r2c2.git/blobdiff - source/3d/track.cpp
Emit various signals from Train when it's loaded
[r2c2.git] / source / 3d / track.cpp
index 3241852f1ed32c606ad8c0dd07ea6a97e34684db..a5c5dbf62a166904a5e3203d28b53af8a637284c 100644 (file)
@@ -63,6 +63,20 @@ void Track3D::get_bounds(float angle, Point &minp, Point &maxp) const
                minp.z += slope;
 }
 
+Point Track3D::get_node() const
+{
+       const Point &pos = track.get_position();
+       Point minp;
+       Point maxp;
+       type.get_bounds(0, minp, maxp);
+       float rot = track.get_rotation();
+       float c = cos(rot);
+       float s = sin(rot);
+
+       Point center((minp.x+maxp.x)/2, (minp.y+maxp.y)/2, 0);
+       return Point(pos.x+c*center.x-s*center.y, pos.y+s*center.x+c*center.y, pos.z+0.02);
+}
+
 void Track3D::render(const GL::Tag &tag) const
 {
        GL::PushMatrix push_mat;