Pioneer
ModelCache.h
Go to the documentation of this file.
1 // Copyright © 2008-2023 Pioneer Developers. See AUTHORS.txt for details
2 // Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
3 
4 #ifndef _MODELCACHE_H
5 #define _MODELCACHE_H
6 /*
7  * This class is a quick thoughtless hack
8  * Also it only deals in New Models
9  */
10 #include "libs.h"
11 #include <stdexcept>
12 
13 namespace Graphics {
14  class Renderer;
15 }
16 namespace SceneGraph {
17  class Model;
18 }
19 
20 class ModelCache {
21 public:
22  struct ModelNotFoundException : public std::runtime_error {
24  std::runtime_error("Could not find model") {}
25  };
27  ~ModelCache();
28  SceneGraph::Model *FindModel(const std::string &);
29  void Flush();
30 
31 private:
32  typedef std::map<std::string, SceneGraph::Model *> ModelMap;
33  ModelMap m_models;
34  Graphics::Renderer *m_renderer;
35 };
36 
37 #endif
Definition: Renderer.h:44
Definition: ModelCache.h:20
~ModelCache()
Definition: ModelCache.cpp:13
ModelCache(Graphics::Renderer *)
Definition: ModelCache.cpp:8
SceneGraph::Model * FindModel(const std::string &)
Definition: ModelCache.cpp:18
void Flush()
Definition: ModelCache.cpp:36
Definition: Model.h:88
Definition: Background.h:14
Definition: CityOnPlanet.h:31
Definition: ModelCache.h:22
ModelNotFoundException()
Definition: ModelCache.h:23