Nameless Engine
|
#include <ShaderUser.h>
Public Member Functions | |
ShaderUser (const ShaderUser &)=delete | |
ShaderUser & | operator= (const ShaderUser &)=delete |
Protected Member Functions | |
ShaderUser (ShaderManager *pShaderManager) | |
virtual | ~ShaderUser () |
bool | addShader (const std::string &sShaderName) |
ShaderPack * | findShader (ShaderType shaderType) |
Private Member Functions | |
void | releaseShader (const std::string &sShaderName) const |
Private Attributes | |
std::pair< std::mutex, std::unordered_map< ShaderType, std::shared_ptr< ShaderPack > > > | mtxAssignedShaders |
ShaderManager * | pShaderManager |
The only class that is allowed to store shaders (not counting ShaderManager).
Other classes should inherit from this class in order to work with shaders.
Allows storing one shader per shader type.
|
protected |
Constructor.
pShaderManager | Shader manager to use. |
|
protectedvirtual |
Destructor.
|
protected |
Adds a shader to be stored (for usage).
sShaderName | Name of the compiled shader (see ShaderManager::compileShaders). |
false
if shader was added successfully, true
if it was not found in ShaderManager.
|
protected |
Looks for a previously added shader (see addShader) for the specified type.
shaderType | Type of the shader to query. |
nullptr
if a shader of this type was not added before, valid pointer otherwise.
|
private |
Uses ShaderManager to release shader bytecode if needed and removes shader if it was marked as "to remove".
sShaderName | Name of the shader to release. |
|
private |
Assigned shaders (see addShader). Must be used with mutex.
|
private |
Shader manager to work with shaders.