]> git.tdb.fi Git - r2c2.git/blob - source/3d/catalogue.h
Render tracks through GL::Objects
[r2c2.git] / source / 3d / catalogue.h
1 /* $Id$
2
3 This file is part of R²C²
4 Copyright © 2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef R2C2_3D_CATALOGUE_H_
9 #define R2C2_3D_CATALOGUE_H_
10
11 #include <msp/datafile/collection.h>
12 #include <msp/fs/path.h>
13 #include <msp/gl/material.h>
14 #include <msp/gl/mesh.h>
15 #include "libr2c2/catalogue.h"
16
17 namespace R2C2 {
18
19 class TrackType3D;
20 class VehicleType3D;
21
22 class Catalogue3D: public Msp::DataFile::Collection
23 {
24 private:
25         Catalogue &catalogue;
26         std::map<const TrackType *, TrackType3D *> tracks;
27         std::map<const VehicleType *, VehicleType3D *> vehicles;
28         Msp::GL::Mesh endpoint_mesh;
29
30 public:
31         Catalogue3D(Catalogue &);
32         ~Catalogue3D();
33
34         const Catalogue &get_catalogue() const { return catalogue; }
35         const TrackType3D &get_track(const TrackType &) const;
36         const VehicleType3D &get_vehicle(const VehicleType &) const;
37         const Msp::GL::Mesh &get_endpoint_mesh() const { return endpoint_mesh; }
38 private:
39         void track_added(const TrackType &);
40         void vehicle_added(const VehicleType &);
41         void build_endpoint_mesh();
42
43         Msp::FS::Path locate_file(const std::string &);
44
45         template<typename T>
46         T *create(const std::string &);
47
48         template<typename T>
49         T *create2(const std::string &);
50 };
51
52 }
53
54 #endif