]> git.tdb.fi Git - r2c2.git/blob - source/3d/tracktype.h
Use GL::Renderables and a Pipeline for rendering
[r2c2.git] / source / 3d / tracktype.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef MARKLIN3D_TRACKTYPE_H_
9 #define MARKLIN3D_TRACKTYPE_H_
10
11 #include <msp/gl/mesh.h>
12 #include <msp/gl/meshbuilder.h>
13 #include <msp/gl/renderable.h>
14 #include "libmarklin/profile.h"
15 #include "libmarklin/tracktype.h"
16
17 namespace Marklin {
18
19 class Catalogue3D;
20
21 class TrackType3D: public Msp::GL::Renderable
22 {
23 private:
24         const Catalogue3D &catalogue;
25         Msp::GL::Mesh ballast_mesh;
26         Msp::GL::Mesh rail_mesh;
27         std::vector<Point> border;
28         float min_z;
29         float max_z;
30
31 public:
32         TrackType3D(const Catalogue3D &, const TrackType &);
33
34         void get_bounds(float, Point &, Point &) const;
35
36         virtual void render(const Msp::GL::Tag &) const;
37
38 private:
39         void build_part(const TrackPart &, const Profile &, const Point &, Msp::GL::MeshBuilder &, unsigned &);
40         //void optimize_border();
41 };
42
43 } // namespace Marklin
44
45 #endif