OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
resourcesystem.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_COMPONENTS_RESOURCE_RESOURCESYSTEM_H
2 #define OPENMW_COMPONENTS_RESOURCE_RESOURCESYSTEM_H
3 
4 #include <memory>
5 #include <vector>
6 
7 namespace VFS
8 {
9  class Manager;
10 }
11 
12 namespace osg
13 {
14  class Stats;
15  class State;
16 }
17 
18 namespace Resource
19 {
20 
21  class SceneManager;
22  class ImageManager;
23  class NifFileManager;
24  class KeyframeManager;
25  class ResourceManager;
26 
31  {
32  public:
33  ResourceSystem(const VFS::Manager* vfs);
35 
40 
43  void updateCache(double referenceTime);
44 
47  void clearCache();
48 
51  void addResourceManager(ResourceManager* resourceMgr);
54  void removeResourceManager(ResourceManager* resourceMgr);
55 
57  void setExpiryDelay(double expiryDelay);
58 
60  const VFS::Manager* getVFS() const;
61 
62  void reportStats(unsigned int frameNumber, osg::Stats* stats) const;
63 
65  void releaseGLObjects(osg::State* state);
66 
67  private:
68  std::unique_ptr<SceneManager> mSceneManager;
69  std::unique_ptr<ImageManager> mImageManager;
70  std::unique_ptr<NifFileManager> mNifFileManager;
71  std::unique_ptr<KeyframeManager> mKeyframeManager;
72 
73  // Store the base classes separately to get convenient access to the common interface
74  // Here users can register their own resourcemanager as well
75  std::vector<ResourceManager*> mResourceManagers;
76 
78 
80  void operator = (const ResourceSystem&);
81  };
82 
83 }
84 
85 #endif
Wrapper class that constructs and provides access to the most commonly used resource subsystems...
Definition: resourcesystem.hpp:30
void updateCache(double referenceTime)
Definition: resourcesystem.cpp:65
Handles loading and caching of scenes, e.g. .nif files or .osg files.
Definition: scenemanager.hpp:44
KeyframeManager * getKeyframeManager()
Definition: resourcesystem.cpp:50
~ResourceSystem()
Definition: resourcesystem.cpp:28
ImageManager * getImageManager()
Definition: resourcesystem.cpp:40
Managing of keyframe resources.
Definition: keyframemanager.hpp:16
ResourceSystem(const VFS::Manager *vfs)
Definition: resourcesystem.cpp:13
Handles loading/caching of Images.
Definition: imagemanager.hpp:23
const VFS::Manager * mVFS
Definition: resourcesystem.hpp:77
void reportStats(unsigned int frameNumber, osg::Stats *stats) const
Definition: resourcesystem.cpp:94
void removeResourceManager(ResourceManager *resourceMgr)
Definition: resourcesystem.cpp:82
std::vector< ResourceManager * > mResourceManagers
Definition: resourcesystem.hpp:75
void addResourceManager(ResourceManager *resourceMgr)
Definition: resourcesystem.cpp:77
const VFS::Manager * getVFS() const
Definition: resourcesystem.cpp:89
SceneManager * getSceneManager()
Definition: resourcesystem.cpp:35
void operator=(const ResourceSystem &)
Handles caching of NIFFiles.
Definition: niffilemanager.hpp:15
State
Definition: state.hpp:6
std::unique_ptr< KeyframeManager > mKeyframeManager
Definition: resourcesystem.hpp:71
std::unique_ptr< NifFileManager > mNifFileManager
Definition: resourcesystem.hpp:70
std::unique_ptr< ImageManager > mImageManager
Definition: resourcesystem.hpp:69
void releaseGLObjects(osg::State *state)
Call releaseGLObjects for each resource manager.
Definition: resourcesystem.cpp:100
The main class responsible for loading files from a virtual file system.
Definition: manager.hpp:20
Base class for managers that require a virtual file system and object cache.
Definition: resourcemanager.hpp:23
void clearCache()
Definition: resourcesystem.cpp:71
void setExpiryDelay(double expiryDelay)
How long to keep objects in cache after no longer being referenced.
Definition: resourcesystem.cpp:55
std::unique_ptr< SceneManager > mSceneManager
Definition: resourcesystem.hpp:68
NifFileManager * getNifFileManager()
Definition: resourcesystem.cpp:45