![]() |
An open-source, flexible 3D physical simulation framework
|
This class is responsible for generating the osg::Program for shading operations. More...
#include <ShaderFactory.h>
Public Member Functions | |
void | setShaderProvider (IShaderProvider *provider, ShaderType shader_type) |
Sets a shader provider for given shader type The function takes ownership of the provider pointer by storing it inside of an std::unique_ptr! More... | |
string | generateShaderSource (ShaderType shader_type) |
Generates the complete source code for a shader program of given type TODO: Only generate if not generated before/no changes. More... | |
osg::Program * | generateProgram () |
Generates the entire osg::Program containing all shader types served by a provider. More... | |
Private Attributes | |
map< ShaderType, std::unique_ptr< IShaderProvider > > | providers |
This map contains the current provider for each shader type. More... | |
This class is responsible for generating the osg::Program for shading operations.
The IShaderProvider provide the necessary information to generate a shader for each ShaderType
Definition at line 44 of file ShaderFactory.h.
osg::Program * osg_material_manager::ShaderFactory::generateProgram | ( | ) |
Generates the entire osg::Program containing all shader types served by a provider.
Definition at line 87 of file ShaderFactory.cpp.
string osg_material_manager::ShaderFactory::generateShaderSource | ( | ShaderType | shader_type | ) |
Generates the complete source code for a shader program of given type TODO: Only generate if not generated before/no changes.
shader_type | The type to generate the shader for |
Definition at line 31 of file ShaderFactory.cpp.
void osg_material_manager::ShaderFactory::setShaderProvider | ( | IShaderProvider * | provider, |
ShaderType | shader_type | ||
) |
Sets a shader provider for given shader type The function takes ownership of the provider pointer by storing it inside of an std::unique_ptr!
provider | A pointer to the shader provider |
shader_type | The shader type this provider serves |
Definition at line 26 of file ShaderFactory.cpp.
|
private |
This map contains the current provider for each shader type.
Since the provider pointers are stored inside of an unique_ptr the memory management is taken care of.
Definition at line 73 of file ShaderFactory.h.