-/* $Id$
-
-This file is part of the MSP Märklin suite
-Copyright © 2010 Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
-#ifndef MARKLIN3D_TRACKTYPE_H_
-#define MARKLIN3D_TRACKTYPE_H_
+#ifndef R2C2_3D_TRACKTYPE_H_
+#define R2C2_3D_TRACKTYPE_H_
+#include <map>
#include <msp/gl/mesh.h>
#include <msp/gl/meshbuilder.h>
-#include "libmarklin/profile.h"
-#include "libmarklin/tracktype.h"
+#include <msp/gl/object.h>
+#include "libr2c2/profile.h"
+#include "libr2c2/tracktype.h"
+#include "objecttype.h"
-namespace Marklin {
+namespace R2C2 {
-class Catalogue3D;
-
-class TrackType3D
+class TrackType3D: public ObjectType3D
{
private:
- Msp::GL::Mesh ballast_mesh;
- Msp::GL::Mesh rail_mesh;
- std::vector<Point> border;
- float min_z;
- float max_z;
+ Msp::GL::Mesh *mesh;
+ Msp::GL::Object *object;
+ bool own_data;
+ std::map<unsigned, Msp::GL::Mesh *> path_meshes;
public:
- TrackType3D(const Catalogue3D &, const TrackType &);
-
- void get_bounds(float, Point &, Point &) const;
+ TrackType3D(Catalogue3D &, const TrackType &);
+ ~TrackType3D();
- void render() const;
+ const Msp::GL::Object &get_object() const { return *object; }
+ const Msp::GL::Mesh &get_path_mesh(int, int) const;
private:
- void build_part(const TrackPart &, const Profile &, const Point &, Msp::GL::MeshBuilder &, unsigned &);
- //void optimize_border();
+ void build_part(const TrackPart &, const Profile &, const Vector &, bool, Msp::GL::MeshBuilder &, unsigned &);
+ void build_ties(const TrackPart &, const Profile &, float, float, const Vector &, Msp::GL::MeshBuilder &, unsigned &);
};
-} // namespace Marklin
+} // namespace R2C2
#endif