Class for shader.
More...
#include <shader.h>
|
| Shader ()=delete |
|
| Shader (const unsigned int vertex_program, const unsigned int fragment_program, const unsigned int geometry_program=0) |
| Shader constructor. More...
|
|
unsigned int | getHandle () const noexcept |
| Gets the shader's opengl handle. More...
|
|
void | useProgram () const |
| Tell open gl to use this shader. More...
|
|
std::vector< std::string > | getUniformNames () const noexcept |
| Gets the uniform names. More...
|
|
void | setUniform (const Uniform &uniform) |
| Sets the uniform. More...
|
|
void | setName (const std::string &name) |
| Sets the name. More...
|
|
std::string | getName () const noexcept |
| Gets the name. More...
|
|
std::string | to_string () const noexcept |
| Returns a string representation of the object. More...
|
|
template<class T > |
void | setUniform (const std::string &name, const T &value) |
| Sets the uniform. More...
|
|
template<> |
void | setUniform (const std::string &name, const float &data) |
|
template<> |
void | setUniform (const std::string &name, const int &data) |
|
template<> |
void | setUniform (const std::string &name, const unsigned int &data) |
|
template<> |
void | setUniform (const std::string &name, const bool &data) |
|
Graphics::Shader::Shader |
( |
| ) |
|
|
delete |
Graphics::Shader::Shader |
( |
const unsigned int |
vertex_program, |
|
|
const unsigned int |
fragment_program, |
|
|
const unsigned int |
geometry_program = 0 |
|
) |
| |
Shader constructor.
- Parameters
-
[in] | vertex_program | The vertex program |
[in] | fragment_program | The fragment program |
[in] | geometry_program | The geometry program |
unsigned int Graphics::Shader::getHandle |
( |
| ) |
const |
|
noexcept |
Gets the shader's opengl handle.
- Returns
- The handle.
std::string Graphics::Shader::getName |
( |
| ) |
const |
|
noexcept |
std::vector< std::string > Graphics::Shader::getUniformNames |
( |
| ) |
const |
|
noexcept |
void Graphics::Shader::setName |
( |
const std::string & |
name | ) |
|
void Graphics::Shader::setUniform |
( |
const Uniform & |
uniform | ) |
|
Sets the uniform.
- Parameters
-
References Graphics::Uniform::BOOL, Graphics::Uniform::BVEC2, Graphics::Uniform::BVEC3, Graphics::Uniform::BVEC4, Graphics::Uniform::FLOAT, Graphics::Uniform::getData(), Graphics::Uniform::getName(), Graphics::Uniform::getType(), Graphics::Uniform::INT, Graphics::Uniform::IVEC2, Graphics::Uniform::IVEC3, Graphics::Uniform::IVEC4, Graphics::Uniform::MAT2, Graphics::Uniform::MAT23, Graphics::Uniform::MAT24, Graphics::Uniform::MAT3, Graphics::Uniform::MAT32, Graphics::Uniform::MAT34, Graphics::Uniform::MAT4, Graphics::Uniform::MAT42, Graphics::Uniform::MAT43, Graphics::Uniform::UINT, Graphics::Uniform::UVEC2, Graphics::Uniform::UVEC3, Graphics::Uniform::UVEC4, Graphics::Uniform::VEC2, Graphics::Uniform::VEC3, and Graphics::Uniform::VEC4.
Referenced by generated::getShaderModule().
template<>
void Graphics::Shader::setUniform |
( |
const std::string & |
name, |
|
|
const float & |
data |
|
) |
| |
template<class T >
void Graphics::Shader::setUniform |
( |
const std::string & |
name, |
|
|
const T & |
value |
|
) |
| |
Sets the uniform.
- Parameters
-
[in] | name | The name |
[in] | value | The value |
- Template Parameters
-
T | Type the uniform should hold |
template<>
void Graphics::Shader::setUniform |
( |
const std::string & |
name, |
|
|
const int & |
data |
|
) |
| |
template<>
void Graphics::Shader::setUniform |
( |
const std::string & |
name, |
|
|
const unsigned int & |
data |
|
) |
| |
template<>
void Graphics::Shader::setUniform |
( |
const std::string & |
name, |
|
|
const bool & |
data |
|
) |
| |
std::string Graphics::Shader::to_string |
( |
| ) |
const |
|
noexcept |
void Graphics::Shader::useProgram |
( |
| ) |
const |
Tell open gl to use this shader.
The documentation for this class was generated from the following files: