| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- $#include "Animation.h"
- $#include "Font.h"
- $#include "Image.h"
- $#include "Material.h"
- $#include "Model.h"
- $#include "ResourceCache.h"
- $#include "Sound.h"
- $#include "Technique.h"
- $#include "Texture2D.h"
- $#include "TextureCube.h"
- $#include "XMLFile.h"
- /// %Resource cache subsystem. Loads resources on demand and stores them for later access.
- class ResourceCache
- {
- public:
- /// Release all resources.
- void ReleaseAllResources(bool force = false);
- /// Reload a resource. Return false and release it if fails.
- bool ReloadResource(Resource* resource);
- /// Set memory budget for a specific resource type, default 0 is unlimited.
- void SetMemoryBudget(ShortStringHash type, unsigned budget);
- /// Enable or disable automatic reloading of resources as files are modified.
- void SetAutoReloadResources(bool enable);
-
- /// Template version of returning a resource by name.
- // template <class T> T* GetResource(const char* name);
- Animation* GetResource<Animation> @ GetAnimation(const char* name);
- Font* GetResource<Font> @ GetFont(const char* name);
- Image* GetResource<Image> @ GetImage(const char* name);
- Material* GetResource<Material> @ GetMaterial(const char* name);
- Model* GetResource<Model> @ GetModel(const char* name);
- Sound* GetResource<Sound> @ GetSound(const char* name);
- Technique* GetResource<Technique> @ GetTechnique(const char* name);
- Texture2D* GetResource<Texture2D> @ GetTexture2D(const char* name);
- TextureCube* GetResource<TextureCube> @ GetTextureCube(const char* name);
- XMLFile* GetResource<XMLFile> @ GetXMLFile(const char* name);
-
- /// Return whether a file exists by name.
- bool Exists(const String& name) const;
- /// Return whether a file exists by name hash.
- bool Exists(StringHash nameHash) const;
- /// Return memory budget for a resource type.
- unsigned GetMemoryBudget(ShortStringHash type) const;
- /// Return total memory use for a resource type.
- unsigned GetMemoryUse(ShortStringHash type) const;
- /// Return total memory use for all resources.
- unsigned GetTotalMemoryUse() const;
- /// Return resource name from hash, or empty if not found.
- const String& GetResourceName(StringHash nameHash) const;
- /// Return full absolute file name of resource if possible.
- String GetResourceFileName(const String& name) const;
- /// Return whether automatic resource reloading is enabled.
- bool GetAutoReloadResources() const;
- };
|