OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
Shader::ShaderManager Class Reference

Reads shader template files and turns them into a concrete shader, based on a list of define's. More...

#include <shadermanager.hpp>

Collaboration diagram for Shader::ShaderManager:

Public Types

typedef std::map< std::string,
std::string > 
DefineMap
 

Public Member Functions

void setShaderPath (const std::string &path)
 
osg::ref_ptr< osg::Shader > getShader (const std::string &shaderTemplate, const DefineMap &defines, osg::Shader::Type shaderType)
 
osg::ref_ptr< osg::Program > getProgram (osg::ref_ptr< osg::Shader > vertexShader, osg::ref_ptr< osg::Shader > fragmentShader)
 
void releaseGLObjects (osg::State *state)
 

Private Types

typedef std::map< std::string,
std::string > 
TemplateMap
 
typedef std::pair< std::string,
DefineMap
MapKey
 
typedef std::map< MapKey,
osg::ref_ptr< osg::Shader > > 
ShaderMap
 
typedef std::map< std::pair
< osg::ref_ptr< osg::Shader >
, osg::ref_ptr< osg::Shader >
>, osg::ref_ptr< osg::Program > > 
ProgramMap
 

Private Attributes

std::string mPath
 
TemplateMap mShaderTemplates
 
ShaderMap mShaders
 
ProgramMap mPrograms
 
OpenThreads::Mutex mMutex
 

Detailed Description

Reads shader template files and turns them into a concrete shader, based on a list of define's.

Shader templates can get the value of a define with the syntax .

Member Typedef Documentation

typedef std::map<std::string, std::string> Shader::ShaderManager::DefineMap
typedef std::pair<std::string, DefineMap> Shader::ShaderManager::MapKey
private
typedef std::map<std::pair<osg::ref_ptr<osg::Shader>, osg::ref_ptr<osg::Shader> >, osg::ref_ptr<osg::Program> > Shader::ShaderManager::ProgramMap
private
typedef std::map<MapKey, osg::ref_ptr<osg::Shader> > Shader::ShaderManager::ShaderMap
private
typedef std::map<std::string, std::string> Shader::ShaderManager::TemplateMap
private

Member Function Documentation

osg::ref_ptr< osg::Program > Shader::ShaderManager::getProgram ( osg::ref_ptr< osg::Shader >  vertexShader,
osg::ref_ptr< osg::Shader >  fragmentShader 
)

Here is the caller graph for this function:

osg::ref_ptr< osg::Shader > Shader::ShaderManager::getShader ( const std::string &  shaderTemplate,
const DefineMap defines,
osg::Shader::Type  shaderType 
)

Create or retrieve a shader instance.

Parameters
shaderTemplateThe filename of the shader template.
definesDefine values that can be retrieved by the shader template.
shaderTypeThe type of shader (usually vertex or fragment shader).
Note
May return NULL on failure.
Thread safe.

Here is the call graph for this function:

Here is the caller graph for this function:

void Shader::ShaderManager::releaseGLObjects ( osg::State *  state)
void Shader::ShaderManager::setShaderPath ( const std::string &  path)

Member Data Documentation

OpenThreads::Mutex Shader::ShaderManager::mMutex
private
std::string Shader::ShaderManager::mPath
private
ProgramMap Shader::ShaderManager::mPrograms
private
ShaderMap Shader::ShaderManager::mShaders
private
TemplateMap Shader::ShaderManager::mShaderTemplates
private

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