-/* $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>
string obj_name = tt.get_object();
if(!obj_name.empty())
{
- object = catalogue.get<GL::Object>(obj_name);
- // XXX border
+ object = &catalogue.get<GL::Object>(obj_name);
+ 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
{
object = new GL::Object;
object->set_mesh(mesh);
- object->set_technique(catalogue.get<GL::Technique>(cat.get_track_technique()));
+ object->set_technique(&catalogue.get<GL::Technique>(cat.get_track_technique()));
}
unsigned paths = tt.get_paths();
const GL::Mesh &TrackType3D::get_path_mesh(unsigned p) const
{
- if(p>=path_meshes.size() || !path_meshes[p])
- throw InvalidParameterValue("Invalid path");
+ if(p>=path_meshes.size())
+ throw out_of_range("TrackType3D::get_path_mesh");
+ if(!path_meshes[p])
+ throw invalid_argument("TrackType3D::get_path_mesh");
return *path_meshes[p];
}