]> git.tdb.fi Git - r2c2.git/blobdiff - source/3d/tracktype.cpp
Replace various map lookups with functions from maputils.h
[r2c2.git] / source / 3d / tracktype.cpp
index 47c85ab4dea6f85562346380ccaf86085358f1f7..cf33d054345f362dc393d20f1ddf09b39a647f9a 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of R²C²
-Copyright © 2010-2011  Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
 #include <algorithm>
 #include <cmath>
 #include <msp/gl/technique.h>
@@ -95,7 +88,17 @@ TrackType3D::TrackType3D(Catalogue3D &cat3d, const TrackType &tt):
        if(!obj_name.empty())
        {
                object = catalogue.get<GL::Object>(obj_name);
-               // XXX border
+               const GL::Mesh *m = object->get_mesh();
+               const GL::VertexArray &vertices = m->get_vertices();
+               int vertex_offs = vertices.get_format().offset(GL::VERTEX2);
+               if(vertex_offs>=0)
+               {
+                       for(unsigned i=0; i<vertices.size(); ++i)
+                       {
+                               const float *v = vertices[i]+vertex_offs;
+                               border.push_back(Vector(v[0], v[1]));
+                       }
+               }
        }
        else
        {