Radium Engine
1.5.20
|
#include <Engine/Data/ShaderProgramManager.hpp>
Public Member Functions | |
ShaderProgramManager () | |
Rule of three needed here to prevent copy on this manager (only movable) | |
ShaderProgramManager (const ShaderProgramManager &)=delete | |
ShaderProgramManager & | operator= (const ShaderProgramManager &)=delete |
Core::Utils::optional< const Data::ShaderProgram * > | addShaderProgram (const Data::ShaderConfiguration &config) |
const Data::ShaderProgram * | getShaderProgram (const std::string &id) |
const Data::ShaderProgram * | getShaderProgram (const Data::ShaderConfiguration &config) |
void | reloadAllShaderPrograms () |
void | reloadNotCompiledShaderPrograms () |
bool | addNamedString (const std::string &includepath, const std::string &realfile) |
void | reloadNamedString () |
Manage the set of shaders used by Radium Engine for rendering.
This class allows to manage shader programs according to their configuration so that, for a given configuration, there is only one ShaderProgram instance in the system.
This manager is a singleton. At the creation of the singleton, one can give parameters that will define the default shader program example : Engine::ShaderProgramManager::createInstance( "Shaders/Default.vert.glsl", "Shaders/Default.frag.glsl" );
Definition at line 36 of file ShaderProgramManager.hpp.
Ra::Engine::Data::ShaderProgramManager::ShaderProgramManager | ( | ) |
Rule of three needed here to prevent copy on this manager (only movable)
Definition at line 19 of file ShaderProgramManager.cpp.
Ra::Engine::Data::ShaderProgramManager::~ShaderProgramManager | ( | ) |
Definition at line 21 of file ShaderProgramManager.cpp.
bool Ra::Engine::Data::ShaderProgramManager::addNamedString | ( | const std::string & | includepath, |
const std::string & | realfile ) |
Allows to define named string so that the inclusion mechanism of OpenGL could be efficient. A name string associates the name that will be used by a #define directive in a glsl source file with a file that contains the included glsl source code.
includepath | |
realfile |
Definition at line 25 of file ShaderProgramManager.cpp.
Core::Utils::optional< const Data::ShaderProgram * > Ra::Engine::Data::ShaderProgramManager::addShaderProgram | ( | const Data::ShaderConfiguration & | config | ) |
Add a shader program to the program collection according to the given configuration. This method must be called only once an opeGL context is bound. The shader sources corresponding to the configuration will be compiled, linked and verified.
config | the configuration of the program to add to the collection |
Definition at line 58 of file ShaderProgramManager.cpp.
const Data::ShaderProgram * Ra::Engine::Data::ShaderProgramManager::getShaderProgram | ( | const Data::ShaderConfiguration & | config | ) |
Get the shader program corresponding to the given configuration
config | Name of the program to retrieve |
Definition at line 105 of file ShaderProgramManager.cpp.
const Data::ShaderProgram * Ra::Engine::Data::ShaderProgramManager::getShaderProgram | ( | const std::string & | id | ) |
Get the shader program corresponding to the given id
id | Name of the program to retrieve |
Definition at line 97 of file ShaderProgramManager.cpp.
void Ra::Engine::Data::ShaderProgramManager::reloadAllShaderPrograms | ( | ) |
Reload source, recompile, link and validate all the managed programms. Usefull for shaders development
Definition at line 110 of file ShaderProgramManager.cpp.
void Ra::Engine::Data::ShaderProgramManager::reloadNamedString | ( | ) |
Reload all the registered name string. Usefull for shader development.
Definition at line 49 of file ShaderProgramManager.cpp.
void Ra::Engine::Data::ShaderProgramManager::reloadNotCompiledShaderPrograms | ( | ) |
Programs that did not compiled are temporarilly stored and could be reloaded and compiled when one call this method. If the reloaded program is ok, it is removed from the set of not compiled program and added to the program collection.
Definition at line 123 of file ShaderProgramManager.cpp.