|
0.45.0
|
#include <iResourceManager.h>
Inherits igor::iModule< iResourceManager >.
Public Member Functions | |
| void | addSearchPath (const iaString &searchPath) |
| void | removeSearchPath (const iaString &searchPath) |
| void | clearSearchPaths () |
| const iaString | resolvePath (const iaString &filepath) |
| const iaString | getFilename (const iResourceID &id) |
| const iaString | getAlias (const iResourceID &id) |
| void | setAlias (const iResourceID &id, const iaString &alias) |
| iaString | getRelativePath (const iaString &filename) |
| bool | fileExists (const iaString &filename) |
| iResourcePtr | requestResource (const iParameters ¶meters) |
| iResourcePtr | loadResource (const iParameters ¶meters) |
| iResourcePtr | createResource (const iParameters ¶meters) |
| template<typename T > | |
| std::shared_ptr< T > | requestResource (const iParameters ¶meters) |
| template<typename T > | |
| std::shared_ptr< T > | loadResource (const iParameters ¶meters) |
| template<typename T > | |
| std::shared_ptr< T > | createResource () |
| template<typename T > | |
| std::shared_ptr< T > | requestResource (const iaString &alias, iResourceCacheMode cacheMode=iResourceCacheMode::Cache) |
| template<typename T > | |
| std::shared_ptr< T > | loadResource (const iaString &alias, iResourceCacheMode cacheMode=iResourceCacheMode::Cache) |
| template<typename T > | |
| std::shared_ptr< T > | requestResource (const iResourceID &resourceID, iResourceCacheMode cacheMode=iResourceCacheMode::Cache) |
| template<typename T > | |
| std::shared_ptr< T > | loadResource (const iResourceID &resourceID, iResourceCacheMode cacheMode=iResourceCacheMode::Cache) |
| iResourcePtr | getResource (const iResourceID &id) |
| template<typename T > | |
| std::shared_ptr< T > | getResource (const iResourceID &id) |
| template<typename T > | |
| std::shared_ptr< T > | getResource (const iaString &alias) |
| void | getMaterials (std::vector< iShaderPtr > &materials) |
| void | flush (iResourceCacheMode cacheModeLevel=iResourceCacheMode::Free) |
| void | interruptFlush () |
| void | registerFactory (iFactoryPtr factory) |
| void | unregisterFactory (iFactoryPtr factory) |
| void | setLoadMode (iResourceManagerLoadMode loadMode) |
| iResourceManagerLoadMode | getLoadMode () const |
| void | loadResourceDictionary (const iaString &filename) |
| void | saveResourceDictionary (const iaString &filename) |
| void | clearResourceDictionary () |
| const iResourceID | getResourceID (const iaString &aliasOrFilename) const |
| void | addToDictionary (const iaString &filename, const iaString &alias="", const iaUUID &uuid=iaUUID::getInvalid()) |
| void | removeFromDictionary (const iResourceID &resourceID) |
| const iaString | getType (const iaString &filename) const |
| const iaString | getType (const iResourceID &resourceID) const |
| bool | saveResource (iResourcePtr resource, const iaString &filename="") |
| bool | saveResource (iResourceID resourceID, const iaString &filename="") |
| iResourceProcessedEvent & | getResourceProcessedEvent () |
| template<> | |
| iTexturePtr | requestResource (const iaString &alias, iResourceCacheMode cacheMode) |
| template<> | |
| iTexturePtr | loadResource (const iaString &alias, iResourceCacheMode cacheMode) |
| template<> | |
| iTexturePtr | requestResource (const iResourceID &resourceID, iResourceCacheMode cacheMode) |
| template<> | |
| iTexturePtr | loadResource (const iResourceID &resourceID, iResourceCacheMode cacheMode) |
| template<> | |
| iTexturePtr | requestResource (const iParameters ¶m) |
| template<> | |
| iTexturePtr | loadResource (const iParameters ¶m) |
| template<> | |
| iTexturePtr | createResource () |
| template<> | |
| iTexturePtr | getResource (const iResourceID &id) |
| template<> | |
| iTexturePtr | getResource (const iaString &alias) |
| template<> | |
| iSoundPtr | requestResource (const iaString &alias, iResourceCacheMode cacheMode) |
| template<> | |
| iSoundPtr | loadResource (const iaString &alias, iResourceCacheMode cacheMode) |
| template<> | |
| iSoundPtr | requestResource (const iResourceID &resourceID, iResourceCacheMode cacheMode) |
| template<> | |
| iSoundPtr | loadResource (const iResourceID &resourceID, iResourceCacheMode cacheMode) |
| template<> | |
| iSoundPtr | requestResource (const iParameters ¶m) |
| template<> | |
| iSoundPtr | loadResource (const iParameters ¶m) |
| template<> | |
| iSoundPtr | createResource () |
| template<> | |
| iSoundPtr | getResource (const iResourceID &id) |
| template<> | |
| iSoundPtr | getResource (const iaString &alias) |
| template<> | |
| iSpritePtr | requestResource (const iaString &alias, iResourceCacheMode cacheMode) |
| template<> | |
| iSpritePtr | loadResource (const iaString &alias, iResourceCacheMode cacheMode) |
| template<> | |
| iSpritePtr | requestResource (const iResourceID &resourceID, iResourceCacheMode cacheMode) |
| template<> | |
| iSpritePtr | loadResource (const iResourceID &resourceID, iResourceCacheMode cacheMode) |
| template<> | |
| iSpritePtr | requestResource (const iParameters ¶m) |
| template<> | |
| iSpritePtr | loadResource (const iParameters ¶m) |
| template<> | |
| iSpritePtr | createResource () |
| template<> | |
| iSpritePtr | getResource (const iResourceID &id) |
| template<> | |
| iSpritePtr | getResource (const iaString &alias) |
| template<> | |
| iAnimationPtr | requestResource (const iaString &alias, iResourceCacheMode cacheMode) |
| template<> | |
| iAnimationPtr | loadResource (const iaString &alias, iResourceCacheMode cacheMode) |
| template<> | |
| iAnimationPtr | requestResource (const iResourceID &resourceID, iResourceCacheMode cacheMode) |
| template<> | |
| iAnimationPtr | loadResource (const iResourceID &resourceID, iResourceCacheMode cacheMode) |
| template<> | |
| iAnimationPtr | requestResource (const iParameters ¶m) |
| template<> | |
| iAnimationPtr | loadResource (const iParameters ¶m) |
| template<> | |
| iAnimationPtr | createResource () |
| template<> | |
| iAnimationPtr | getResource (const iResourceID &id) |
| template<> | |
| iAnimationPtr | getResource (const iaString &alias) |
| template<> | |
| iModelPtr | requestResource (const iaString &alias, iResourceCacheMode cacheMode) |
| template<> | |
| iModelPtr | loadResource (const iaString &alias, iResourceCacheMode cacheMode) |
| template<> | |
| iModelPtr | requestResource (const iResourceID &resourceID, iResourceCacheMode cacheMode) |
| template<> | |
| iModelPtr | loadResource (const iResourceID &resourceID, iResourceCacheMode cacheMode) |
| template<> | |
| iModelPtr | requestResource (const iParameters ¶m) |
| template<> | |
| iModelPtr | loadResource (const iParameters ¶m) |
| template<> | |
| iModelPtr | createResource () |
| template<> | |
| iModelPtr | getResource (const iResourceID &id) |
| template<> | |
| iModelPtr | getResource (const iaString &alias) |
| template<> | |
| iShaderPtr | requestResource (const iaString &alias, iResourceCacheMode cacheMode) |
| template<> | |
| iShaderPtr | loadResource (const iaString &alias, iResourceCacheMode cacheMode) |
| template<> | |
| iShaderPtr | requestResource (const iResourceID &resourceID, iResourceCacheMode cacheMode) |
| template<> | |
| iShaderPtr | loadResource (const iResourceID &resourceID, iResourceCacheMode cacheMode) |
| template<> | |
| iShaderPtr | requestResource (const iParameters ¶m) |
| template<> | |
| iShaderPtr | loadResource (const iParameters ¶m) |
| template<> | |
| iShaderPtr | createResource () |
| template<> | |
| iShaderPtr | getResource (const iResourceID &id) |
| template<> | |
| iShaderPtr | getResource (const iaString &alias) |
| template<> | |
| iMaterialPtr | requestResource (const iaString &alias, iResourceCacheMode cacheMode) |
| template<> | |
| iMaterialPtr | loadResource (const iaString &alias, iResourceCacheMode cacheMode) |
| template<> | |
| iMaterialPtr | requestResource (const iResourceID &resourceID, iResourceCacheMode cacheMode) |
| template<> | |
| iMaterialPtr | loadResource (const iResourceID &resourceID, iResourceCacheMode cacheMode) |
| template<> | |
| iMaterialPtr | requestResource (const iParameters ¶m) |
| template<> | |
| iMaterialPtr | loadResource (const iParameters ¶m) |
| template<> | |
| iMaterialPtr | createResource () |
| template<> | |
| iMaterialPtr | getResource (const iResourceID &id) |
| template<> | |
| iMaterialPtr | getResource (const iaString &alias) |
| template<> | |
| iPrefabPtr | requestResource (const iaString &alias, iResourceCacheMode cacheMode) |
| template<> | |
| iPrefabPtr | loadResource (const iaString &alias, iResourceCacheMode cacheMode) |
| template<> | |
| iPrefabPtr | requestResource (const iResourceID &resourceID, iResourceCacheMode cacheMode) |
| template<> | |
| iPrefabPtr | loadResource (const iResourceID &resourceID, iResourceCacheMode cacheMode) |
| template<> | |
| iPrefabPtr | requestResource (const iParameters ¶m) |
| template<> | |
| iPrefabPtr | loadResource (const iParameters ¶m) |
| template<> | |
| iPrefabPtr | createResource () |
| template<> | |
| iPrefabPtr | getResource (const iResourceID &id) |
| template<> | |
| iPrefabPtr | getResource (const iaString &alias) |
Friends | |
| class | iModule< iResourceManager > |
Additional Inherited Members | |
Static Public Member Functions inherited from igor::iModule< iResourceManager > | |
| static IGOR_INLINE iResourceManager & | getInstance () |
| static IGOR_INLINE bool | isInstantiated () |
| static void | createInstance () |
| static void | destroyInstance () |
Protected Member Functions inherited from igor::iModule< iResourceManager > | |
| iModule ()=default | |
| virtual | ~iModule ()=default |
manages resources and their factories
| void igor::iResourceManager::addSearchPath | ( | const iaString & | searchPath | ) |
adds search path to list
| searchPath | search path to add |
| void igor::iResourceManager::addToDictionary | ( | const iaString & | filename, |
| const iaString & | alias = "", |
||
| const iaUUID & | uuid = iaUUID::getInvalid() |
||
| ) |
adds new resource to dictionary
| filename | path to resource (must be relative to search paths) |
| alias | optional alias |
| void igor::iResourceManager::clearResourceDictionary | ( | ) |
clear resource dictionary
(means it will only contain igor internal resources)
| void igor::iResourceManager::clearSearchPaths | ( | ) |
clears search path list
| std::shared_ptr< T > igor::iResourceManager::createResource | ( | ) |
creates a new resource of given type
template version for more convenience
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| iResourcePtr igor::iResourceManager::createResource | ( | const iParameters & | parameters | ) |
creates a new resource
| param | parameters for creating resource |
| bool igor::iResourceManager::fileExists | ( | const iaString & | filename | ) |
| filename | the file we are looking for |
| void igor::iResourceManager::flush | ( | iResourceCacheMode | cacheModeLevel = iResourceCacheMode::Free | ) |
works like a garbage collector.
Iterates through all resources and checks how many references every resource has. If reference count goes down to 1 then the resource will be released. If reference count is greater 1 and the resource was not loaded yet then the resource will be loaded.
| cacheModeLevel | level of cache mode to be released |
| const iaString igor::iResourceManager::getAlias | ( | const iResourceID & | id | ) |
| id | the given resource id |
| const iaString igor::iResourceManager::getFilename | ( | const iResourceID & | id | ) |
| id | the given resource id |
| iResourceManagerLoadMode igor::iResourceManager::getLoadMode | ( | ) | const |
| void igor::iResourceManager::getMaterials | ( | std::vector< iShaderPtr > & | materials | ) |
returns all materials
| [out] | materials | the materials |
TODO how about a more general interface?
| filename | full path to file |
| std::shared_ptr< T > igor::iResourceManager::getResource | ( | const iaString & | alias | ) |
typed version
| name | the name of the resource |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| iResourcePtr igor::iResourceManager::getResource | ( | const iResourceID & | id | ) |
| id | the id of the resource |
| std::shared_ptr< T > igor::iResourceManager::getResource | ( | const iResourceID & | id | ) |
typed version
| id | the id of the resource |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| const iResourceID igor::iResourceManager::getResourceID | ( | const iaString & | aliasOrFilename | ) | const |
If it does not exist yet but it represents a valid file path within one of the search path. We add a new resource.
| aliasOrFilename | the given alias or filename |
| iResourceProcessedEvent & igor::iResourceManager::getResourceProcessedEvent | ( | ) |
this is purely based on file extension
| filename | the file name to guess the type of |
| const iaString igor::iResourceManager::getType | ( | const iResourceID & | resourceID | ) | const |
this is purely based on file extension
| resourceID | the given resource id |
| void igor::iResourceManager::interruptFlush | ( | ) |
if a flush in a different thread is currently running. this will prevent loading new data from disk and in consequence make it stop earlier
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| std::shared_ptr< T > igor::iResourceManager::loadResource | ( | const iaString & | alias, |
| iResourceCacheMode | cacheMode = iResourceCacheMode::Cache |
||
| ) |
loads a resource synchronously
template version for more convenience
| alias | the name of the resource (this can also be a filename) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| iResourcePtr igor::iResourceManager::loadResource | ( | const iParameters & | parameters | ) |
loads a resource synchronously.
| param | parameters for loading resource |
| std::shared_ptr< T > igor::iResourceManager::loadResource | ( | const iParameters & | parameters | ) |
loads a resource synchronously.
template version for more convenience
| param | parameters for loading resource |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| std::shared_ptr< T > igor::iResourceManager::loadResource | ( | const iResourceID & | resourceID, |
| iResourceCacheMode | cacheMode = iResourceCacheMode::Cache |
||
| ) |
loads a resource synchronously by id
template version for more convenience
| resourceID | the id of the resource |
| void igor::iResourceManager::loadResourceDictionary | ( | const iaString & | filename | ) |
loads resource dictionary
this will append resources to existing dictionary
| filename | filename to resource dictionary |
| void igor::iResourceManager::registerFactory | ( | iFactoryPtr | factory | ) |
registers factory to resource manager
| factory | the given factory |
| void igor::iResourceManager::removeFromDictionary | ( | const iResourceID & | resourceID | ) |
removes given resource from dictionary
| resourceID | the given resource id |
| void igor::iResourceManager::removeSearchPath | ( | const iaString & | searchPath | ) |
removes search path from list
| searchPath | search path to remove |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| std::shared_ptr< T > igor::iResourceManager::requestResource | ( | const iaString & | alias, |
| iResourceCacheMode | cacheMode = iResourceCacheMode::Cache |
||
| ) |
requests a resource to be loaded asynchronously
template version for more convenience
| alias | the name of the resource (this can also be a filename) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| iResourcePtr igor::iResourceManager::requestResource | ( | const iParameters & | parameters | ) |
requests a resource to be loaded asynchronously.
| param | parameters for loading resource |
| std::shared_ptr< T > igor::iResourceManager::requestResource | ( | const iParameters & | parameters | ) |
requests a resource to be loaded asynchronously.
template version for more convenience
| param | parameters for loading resource |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| std::shared_ptr< T > igor::iResourceManager::requestResource | ( | const iResourceID & | resourceID, |
| iResourceCacheMode | cacheMode = iResourceCacheMode::Cache |
||
| ) |
requests a resource to be loaded asynchronously by id
template version for more convenience
| resourceID | the id of the resource |
If the file does not exist it returns an empty string
It only resolves for files that are within one of the given search paths
| filepath | relative or absolute path to file |
| bool igor::iResourceManager::saveResource | ( | iResourceID | resourceID, |
| const iaString & | filename = "" |
||
| ) |
saves a resource to the filesystem
| resourceID | the given resource ID to save (must be valid and have a valid source/filename) |
| filename | optional filename if resource is to be saved in a new location |
| bool igor::iResourceManager::saveResource | ( | iResourcePtr | resource, |
| const iaString & | filename = "" |
||
| ) |
saves a resource to the filesystem
| resource | the given resource to save (must be valid and have a valid source/filename) |
| filename | optional filename if resource is to be saved in a new location |
| void igor::iResourceManager::saveResourceDictionary | ( | const iaString & | filename | ) |
write resource dictionary to given filename
| filename | the file to write the dictionary to |
| void igor::iResourceManager::setAlias | ( | const iResourceID & | id, |
| const iaString & | alias | ||
| ) |
sets alias for given resource id
| id | the given resource id |
| alias | the given alias |
| void igor::iResourceManager::setLoadMode | ( | iResourceManagerLoadMode | loadMode | ) |
sets the load mode
Does not effect load requests that are already in queue
| loadMode | the load mode to set |
| void igor::iResourceManager::unregisterFactory | ( | iFactoryPtr | factory | ) |
unregisters factory from resource manager
| factory | the given factory |
|
friend |