xoreos  0.0.5
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Graphics::Shader::MaterialManager Class Reference

The material manager. More...

#include <materialman.h>

Inheritance diagram for Graphics::Shader::MaterialManager:
Inheritance graph
[legend]
Collaboration diagram for Graphics::Shader::MaterialManager:
Collaboration graph
[legend]

Public Member Functions

 MaterialManager ()
 
 ~MaterialManager ()
 
void init ()
 Initialise material management, including default material creation. More...
 
void deinit ()
 Deinitialise material management subsystem. More...
 
void cleanup ()
 Remove any resource that has a usage count of zero. More...
 
void addMaterial (ShaderMaterial *material)
 Adds a material to be managed. More...
 
void delMaterial (ShaderMaterial *material)
 Forcibly remove the material from the map. More...
 
ShaderMaterialgetMaterial (const Common::UString &name)
 Returns a material with the given name, or zero if it does not exist. More...
 

Private Member Functions

std::map< Common::UString, ShaderMaterial * >::iterator delResource (std::map< Common::UString, ShaderMaterial *>::iterator iter)
 

Private Attributes

std::map< Common::UString, ShaderMaterial * > _resourceMap
 

Additional Inherited Members

- Static Public Member Functions inherited from Common::Singleton< MaterialManager >
static MaterialManager & instance ()
 
static void destroy ()
 
- Protected Types inherited from Common::Singleton< MaterialManager >
typedef MaterialManager SingletonBaseType
 
- Protected Member Functions inherited from Common::Singleton< MaterialManager >
 Singleton ()
 
virtual ~Singleton ()
 

Detailed Description

The material manager.

Definition at line 41 of file materialman.h.

Constructor & Destructor Documentation

◆ MaterialManager()

Graphics::Shader::MaterialManager::MaterialManager ( )

Definition at line 35 of file materialman.cpp.

◆ ~MaterialManager()

Graphics::Shader::MaterialManager::~MaterialManager ( )

Definition at line 38 of file materialman.cpp.

References deinit().

Here is the call graph for this function:

Member Function Documentation

◆ addMaterial()

void Graphics::Shader::MaterialManager::addMaterial ( ShaderMaterial material)

Adds a material to be managed.

Cleanup will delete the material if usage count is zero.

Definition at line 85 of file materialman.cpp.

References _resourceMap, and Graphics::Shader::ShaderMaterial::getName().

Here is the call graph for this function:

◆ cleanup()

void Graphics::Shader::MaterialManager::cleanup ( )

Remove any resource that has a usage count of zero.

Definition at line 73 of file materialman.cpp.

References _resourceMap, delResource(), and Graphics::Shader::ShaderMaterial::useCount().

Here is the call graph for this function:

◆ deinit()

void Graphics::Shader::MaterialManager::deinit ( )

Deinitialise material management subsystem.

Definition at line 66 of file materialman.cpp.

References _resourceMap.

Referenced by ~MaterialManager().

Here is the caller graph for this function:

◆ delMaterial()

void Graphics::Shader::MaterialManager::delMaterial ( ShaderMaterial material)

Forcibly remove the material from the map.

Consider using cleanup instead.

Definition at line 96 of file materialman.cpp.

References _resourceMap, delResource(), and Graphics::Shader::ShaderMaterial::getName().

Here is the call graph for this function:

◆ delResource()

std::map< Common::UString, ShaderMaterial * >::iterator Graphics::Shader::MaterialManager::delResource ( std::map< Common::UString, ShaderMaterial *>::iterator  iter)
private

Definition at line 116 of file materialman.cpp.

References _resourceMap.

Referenced by cleanup(), and delMaterial().

Here is the caller graph for this function:

◆ getMaterial()

ShaderMaterial * Graphics::Shader::MaterialManager::getMaterial ( const Common::UString name)

Returns a material with the given name, or zero if it does not exist.

Definition at line 107 of file materialman.cpp.

References _resourceMap.

◆ init()

void Graphics::Shader::MaterialManager::init ( )

Initialise material management, including default material creation.

Definition at line 42 of file materialman.cpp.

References _resourceMap, Graphics::Shader::ShaderMaterial::getName(), Graphics::Shader::ShaderMaterial::getVariableData(), Graphics::Shader::SHADER_FRAGMENT, ShaderMan, and status().

Here is the call graph for this function:

Member Data Documentation

◆ _resourceMap

std::map<Common::UString, ShaderMaterial *> Graphics::Shader::MaterialManager::_resourceMap
private

Definition at line 64 of file materialman.h.

Referenced by addMaterial(), cleanup(), deinit(), delMaterial(), delResource(), getMaterial(), and init().


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