]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/tracktype.cpp
Use raycasting instead of OpenGL selection mode to pick tracks
[r2c2.git] / source / libr2c2 / tracktype.cpp
index 35d220821500e1621dbb19bc732587398154507b..5b41e1f5f26f58ade0d2f13eb197d9adae5b6987 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of R²C²
-Copyright © 2006-2010  Mikkosoft Productions, Mikko Rasa
+Copyright © 2006-2011  Mikkosoft Productions, Mikko Rasa
 Distributed under the GPL
 */
 
@@ -120,6 +120,15 @@ TrackPoint TrackType::get_point(unsigned epi, unsigned path, float d) const
        }
 }
 
+bool TrackType::collide_ray(const Vector &start, const Vector &dir, float width) const
+{
+       for(vector<TrackPart>::const_iterator i=parts.begin(); i!=parts.end(); ++i)
+               if(i->collide_ray(start, dir, width))
+                       return true;
+
+       return false;
+}
+
 void TrackType::collect_endpoints()
 {
        endpoints.clear();