Carna
Version 3.3.2
|
Ensures that each shader is built just once and not each time someone requests it. More...
#include <ShaderManager.h>
Public Member Functions | |
virtual | ~ShaderManager () |
Deletes. More... | |
const ShaderProgram & | acquireShader (const std::string &shaderName) |
References shader named shaderName. More... | |
void | releaseShader (const ShaderProgram &shader) |
Releases previously acquired shader. More... | |
void | setSource (const std::string &srcName, const std::string &src) |
Sets shader sources named srcName to src. More... | |
void | removeSource (const std::string &srcName) |
Removes any previously set shader sources named srcName. | |
![]() | |
virtual | ~Singleton () |
Denotes that the instance was deleted. | |
Protected Member Functions | |
ShaderManager () | |
Instantiates. | |
![]() | |
Singleton () | |
Denotes that the instance was created. Default constructor is hidden. | |
Friends | |
class | Singleton< ShaderManager > |
Additional Inherited Members | |
![]() | |
typedef ShaderManager | Instance |
Denotes the class, that is derived from this class template. | |
![]() | |
static ShaderManager & | instance () |
Returns the only instance from class InstanceType. | |
static bool | exists () |
Tells whether the instance from class InstanceType currently exists. | |
![]() | |
static void | reset () |
Deletes the only instance from class InstanceType. | |
Ensures that each shader is built just once and not each time someone requests it.
Definition at line 43 of file ShaderManager.h.
|
virtual |
Deletes.
const ShaderProgram& Carna::base::ShaderManager::acquireShader | ( | const std::string & | shaderName | ) |
References shader named shaderName.
Compiles the shader first, if it wasn't built yet. For compilation, the method looks for shader sources named shaderName, suffixed with .vert
and .frag
respectively. If no such sources were specified, the method assumes that shader sources with appropriate names were built in into the library.
void Carna::base::ShaderManager::releaseShader | ( | const ShaderProgram & | shader | ) |
Releases previously acquired shader.
void Carna::base::ShaderManager::setSource | ( | const std::string & | srcName, |
const std::string & | src | ||
) |
Sets shader sources named srcName to src.
Overrides any different shader sources with same name that might have been set previously.
Documentation generated by Doxygen