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

Class for shader. More...

#include <shader.h>

Public Member Functions

 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)
 

Detailed Description

Class for shader.

Constructor & Destructor Documentation

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_programThe vertex program
[in]fragment_programThe fragment program
[in]geometry_programThe geometry program

Member Function Documentation

unsigned int Graphics::Shader::getHandle ( ) const
noexcept

Gets the shader's opengl handle.

Returns
The handle.
std::string Graphics::Shader::getName ( ) const
noexcept

Gets the name.

Returns
The name.

Referenced by generated::getShaderModule(), and to_string().

std::vector< std::string > Graphics::Shader::getUniformNames ( ) const
noexcept

Gets the uniform names.

Returns
The uniform names.

Referenced by generated::getShaderModule(), and to_string().

void Graphics::Shader::setName ( const std::string &  name)

Sets the name.

Parameters
[in]nameThe name

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]nameThe name
[in]valueThe value
Template Parameters
TType 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

Returns a string representation of the object.

Returns
String representation of the object.

References getName(), and getUniformNames().

Referenced by generated::getShaderModule().

void Graphics::Shader::useProgram ( ) const

Tell open gl to use this shader.


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