]> git.tdb.fi Git - r2c2.git/blobdiff - source/3d/tracktype.h
Allow custom objects for tracks
[r2c2.git] / source / 3d / tracktype.h
index ab85d49ce88f1ba30bfe02d2975c917de65ad37d..8a5123b27ba16b6d8566e95221f486733a19295b 100644 (file)
@@ -1,45 +1,46 @@
 /* $Id$
 
-This file is part of the MSP Märklin suite
+This file is part of R²C²
 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 <msp/gl/mesh.h>
 #include <msp/gl/meshbuilder.h>
-#include <msp/gl/renderable.h>
-#include "libmarklin/profile.h"
-#include "libmarklin/tracktype.h"
+#include <msp/gl/object.h>
+#include "libr2c2/profile.h"
+#include "libr2c2/tracktype.h"
 
-namespace Marklin {
+namespace R2C2 {
 
 class Catalogue3D;
 
-class TrackType3D: public Msp::GL::Renderable
+class TrackType3D
 {
 private:
-       const Catalogue3D &catalogue;
-       Msp::GL::Mesh ballast_mesh;
-       Msp::GL::Mesh rail_mesh;
+       Catalogue3D &catalogue;
+       Msp::GL::Mesh *mesh;
+       Msp::GL::Object *object;
+       std::vector<Msp::GL::Mesh *> path_meshes;
        std::vector<Point> border;
        float min_z;
        float max_z;
 
 public:
-       TrackType3D(const Catalogue3D &, const TrackType &);
+       TrackType3D(Catalogue3D &, const TrackType &);
+       ~TrackType3D();
 
        void get_bounds(float, Point &, Point &) const;
-
-       virtual void render(const Msp::GL::Tag &) const;
+       const Msp::GL::Object &get_object() const { return *object; }
+       const Msp::GL::Mesh &get_path_mesh(unsigned) 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 Point &, bool, Msp::GL::MeshBuilder &, unsigned &);
 };
 
-} // namespace Marklin
+} // namespace R2C2
 
 #endif