Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Graphics::ShaderManager Class Reference

Class for shader manager. More...

#include <shader_manager.h>

Public Member Functions

 ShaderManager ()=delete
 
 ShaderManager (const std::string &shader_directory)
 Shader Manager constructor. More...
 
 ~ShaderManager ()
 Destroys the object. More...
 
bool loadShader (const std::string &name, const bool geometry_shader=false)
 Loads a shader. More...
 
bool loadShader (const std::string &name, const std::string &vertex_filename, const std::string &fragment_filename, const std::string &geometry_filename)
 Loads a shader. More...
 
std::shared_ptr< Shaderoperator[] (const std::string &name) const
 looks up shader by name More...
 
std::shared_ptr< ShadergetShader (const std::string &name) const
 Gets the shader. More...
 
void setUniformForAllPrograms (const Uniform &u)
 Sets the uniform for all programs. More...
 
template<class T >
void setUniformForAllPrograms (const std::string &name, const T &data)
 Sets the uniform for all programs. More...
 

Static Public Attributes

static char const * VERTEX_EXTENSION = ".vert"
 
static char const * FRAGMENT_EXTENSION = ".frag"
 
static char const * GEOMETRY_EXTENSION = ".geom"
 

Detailed Description

Class for shader manager.

Constructor & Destructor Documentation

Graphics::ShaderManager::ShaderManager ( )
delete
Graphics::ShaderManager::ShaderManager ( const std::string &  shader_directory)

Shader Manager constructor.

Graphics::ShaderManager::~ShaderManager ( )

Destroys the object.

Member Function Documentation

std::shared_ptr< Shader > Graphics::ShaderManager::getShader ( const std::string &  name) const

Gets the shader.

Parameters
[in]nameThe name
Returns
The shader.

Referenced by generated::getShaderManagerModule(), and operator[]().

bool Graphics::ShaderManager::loadShader ( const std::string &  name,
const bool  geometry_shader = false 
)

Loads a shader.

Parameters
[in]nameThe name
[in]geometry_shaderThe geometry shader
Returns
True if successful

References FRAGMENT_EXTENSION, GEOMETRY_EXTENSION, and VERTEX_EXTENSION.

Referenced by generated::getShaderManagerModule().

bool Graphics::ShaderManager::loadShader ( const std::string &  name,
const std::string &  vertex_filename,
const std::string &  fragment_filename,
const std::string &  geometry_filename 
)

Loads a shader.

Parameters
[in]nameThe name
[in]vertex_filenameThe vertex filename
[in]fragment_filenameThe fragment filename
[in]geometry_filenameThe geometry filename
Returns
True if successful
std::shared_ptr< Shader > Graphics::ShaderManager::operator[] ( const std::string &  name) const

looks up shader by name

Parameters
[in]nameThe name
Returns
Shader with name

References getShader().

void Graphics::ShaderManager::setUniformForAllPrograms ( const Uniform u)

Sets the uniform for all programs.

Parameters
[in]uThe uniform to set

Referenced by generated::getShaderManagerModule().

template<class T >
void Graphics::ShaderManager::setUniformForAllPrograms ( const std::string &  name,
const T &  data 
)

Sets the uniform for all programs.

Parameters
[in]nameThe name
[in]dataThe data
Template Parameters
TThe data type for the uniform

Member Data Documentation

char const * Graphics::ShaderManager::FRAGMENT_EXTENSION = ".frag"
static

Fragment Shader Extension

Referenced by loadShader().

char const * Graphics::ShaderManager::GEOMETRY_EXTENSION = ".geom"
static

Geometry Shader Extension

Referenced by loadShader().

char const * Graphics::ShaderManager::VERTEX_EXTENSION = ".vert"
static

Vertex Shader Extension

Referenced by loadShader().


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