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