Sceneview
 All Classes Functions Variables Enumerations Enumerator Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
sv::ResourceManager Class Reference

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
 

Detailed Description

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:

Member Function Documentation

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.

Exceptions
std::invalid_argumentIf 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.

Parameters
shaderthe shader for the material to use.
Exceptions
std::invalid_argumentIf a resource with the same name already exists.
Scene::Ptr sv::ResourceManager::MakeScene ( const QString &  name = kAutoName)

Create a new scene graph.

Exceptions
std::invalid_argumentIf a resource with the same name already exists.
ShaderResource::Ptr sv::ResourceManager::MakeShader ( const QString &  name = kAutoName)

Create a new shader.

Exceptions
std::invalid_argumentIf a resource with the same name already exists.

The documentation for this class was generated from the following file: