Central repository for resources. More...
#include <sceneview/resource_manager.hpp>
Public Types | |
typedef std::shared_ptr < ResourceManager > | Ptr |
Public Member Functions | |
MaterialResource::Ptr | MakeMaterial (const ShaderResource::Ptr &shader, const QString &name=kAutoName) |
Create a new material. More... | |
ShaderResource::Ptr | MakeShader (const QString &name=kAutoName) |
Create a new shader. More... | |
GeometryResource::Ptr | MakeGeometry (const QString &name=kAutoName) |
Create a new geometry. More... | |
Scene::Ptr | MakeScene (const QString &name=kAutoName) |
Create a new scene graph. More... | |
FontResource::Ptr | Font (const QFont &qfont) |
Retrieves a FontResource, creating one if needed. | |
MaterialResource::Ptr | GetMaterial (const QString &name) |
Retrieve the specified material. More... | |
ShaderResource::Ptr | GetShader (const QString &name) |
Retrieve the specified shader. More... | |
GeometryResource::Ptr | GetGeometry (const QString &name) |
Retrieve the specified geometry. More... | |
void | PrintStats () |
Debugging. | |
Static Public Member Functions | |
static Ptr | Create () |
Static Public Attributes | |
static const QString | kAutoName |
Central repository for resources.
The ResourceManager maintains a repository of all resources (materials, shaders, geometries) and is the only class able to create new resources. The main purpose of the ResourceManager is to act as a point of coordination for sharing resources.
Some notes on memory management:
GeometryResource::Ptr sv::ResourceManager::GetGeometry | ( | const QString & | name | ) |
Retrieve the specified geometry.
If the geometry isn't found, then an empty pointer is returned.
MaterialResource::Ptr sv::ResourceManager::GetMaterial | ( | const QString & | name | ) |
Retrieve the specified material.
If the material isn't found, then an empty pointer is returned.
ShaderResource::Ptr sv::ResourceManager::GetShader | ( | const QString & | name | ) |
Retrieve the specified shader.
If the shader isn't found, then an empty pointer is returned.
GeometryResource::Ptr sv::ResourceManager::MakeGeometry | ( | const QString & | name = kAutoName | ) |
Create a new geometry.
std::invalid_argument | If a resource with the same name already exists. |
MaterialResource::Ptr sv::ResourceManager::MakeMaterial | ( | const ShaderResource::Ptr & | shader, |
const QString & | name = kAutoName |
||
) |
Create a new material.
shader | the shader for the material to use. |
std::invalid_argument | If a resource with the same name already exists. |
Scene::Ptr sv::ResourceManager::MakeScene | ( | const QString & | name = kAutoName | ) |
Create a new scene graph.
std::invalid_argument | If a resource with the same name already exists. |
ShaderResource::Ptr sv::ResourceManager::MakeShader | ( | const QString & | name = kAutoName | ) |
Create a new shader.
std::invalid_argument | If a resource with the same name already exists. |