![]() |
Kale
|
#include <Shader.hpp>
Public Member Functions | |
Shader (const char *vertShaderFile, const char *fragShaderFile) | |
Shader (const Shader &other)=delete | |
void | operator= (const Shader &other)=delete |
~Shader () | |
void | useProgram () const |
int | getAttributeLocation (const char *name) const |
int | getUniformLocation (const char *name) const |
void | uniform (unsigned int location, const Vector2f &value) const |
void | uniform (unsigned int location, const Vector3f &value) const |
void | uniform (unsigned int location, const Vector4f &value) const |
void | uniform (unsigned int location, const Matrix2f &value) const |
void | uniform (unsigned int location, const Matrix3f &value) const |
void | uniform (unsigned int location, const Matrix4f &value) const |
void | uniform (unsigned int location, const Transform &value) const |
void | uniform (unsigned int location, float value) const |
void | uniform (unsigned int location, int value) const |
void | uniform (unsigned int location, const std::vector< Vector2f > &value) const |
void | uniform (unsigned int location, const std::vector< Vector3f > &value) const |
void | uniform (unsigned int location, const std::vector< Vector4f > &value) const |
void | uniform (unsigned int location, const std::vector< Matrix2f > &value) const |
void | uniform (unsigned int location, const std::vector< Matrix3f > &value) const |
void | uniform (unsigned int location, const std::vector< Matrix4f > &value) const |
void | uniform (unsigned int location, const std::vector< Transform > &value) const |
void | uniform (unsigned int location, const std::vector< float > &value) const |
void | uniform (unsigned int location, const Vector2f *ptr, size_t size) const |
void | uniform (unsigned int location, const Vector3f *ptr, size_t size) const |
void | uniform (unsigned int location, const Vector4f *ptr, size_t size) const |
void | uniform (unsigned int location, const Matrix2f *ptr, size_t size) const |
void | uniform (unsigned int location, const Matrix3f *ptr, size_t size) const |
void | uniform (unsigned int location, const Matrix4f *ptr, size_t size) const |
void | uniform (unsigned int location, const Transform *ptr, size_t size) const |
void | uniform (unsigned int location, const float *ptr, size_t size) const |
Private Member Functions | |
unsigned int | createShader (unsigned int type, const char *filePath) |
Private Attributes | |
unsigned int | program |
Represents a single shader for use by nodes
Definition at line 28 of file Shader.hpp.
Shader::Shader | ( | const char * | vertShaderFile, |
const char * | fragShaderFile ) |
Creates, loads, and compiles a new shader program.
vertShaderFile | The file path of the vertex shader source |
fragShaderFile | The file path of the fragment shader source |
If | unable to compile |
Creates, loads, and compiles a new shader program.
vertShaderFile | The file path of the vertex shader source |
fragShaderFile | The file path of the fragment shader source |
if | unable to compile |
Definition at line 83 of file Shader.cpp.
|
delete |
Shaders do not support copying
Shader::~Shader | ( | ) |
Frees resources
Definition at line 121 of file Shader.cpp.
|
private |
Creates a shader, compiles it, and throws if unable to compile.
type | The type of shader |
filePath | the path to the source of the shader |
If | unable to compile |
Definition at line 39 of file Shader.cpp.
int Shader::getAttributeLocation | ( | const char * | name | ) | const |
Gets the location of an attribute
name | The name of the attribute |
Definition at line 137 of file Shader.cpp.
int Shader::getUniformLocation | ( | const char * | name | ) | const |
Gets the location of an uniform
name | The name of the uniform |
Definition at line 146 of file Shader.cpp.
|
delete |
Shaders do not support copying
void Shader::uniform | ( | unsigned int | location, |
const float * | ptr, | ||
size_t | size ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
ptr | The beginning pointer of the uniform values |
size | The count of uniform values |
Definition at line 403 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const Matrix2f & | value ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
value | The value of the uniform |
Definition at line 185 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const Matrix2f * | ptr, | ||
size_t | size ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
ptr | The beginning pointer of the uniform values |
size | The count of uniform values |
Definition at line 359 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const Matrix3f & | value ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
value | The value of the uniform |
Definition at line 195 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const Matrix3f * | ptr, | ||
size_t | size ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
ptr | The beginning pointer of the uniform values |
size | The count of uniform values |
Definition at line 370 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const Matrix4f & | value ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
value | The value of the uniform |
Definition at line 205 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const Matrix4f * | ptr, | ||
size_t | size ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
ptr | The beginning pointer of the uniform values |
size | The count of uniform values |
Definition at line 381 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const std::vector< float > & | value ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
value | The value of the uniform |
Definition at line 315 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const std::vector< Matrix2f > & | value ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
value | The value of the uniform |
Definition at line 275 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const std::vector< Matrix3f > & | value ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
value | The value of the uniform |
Definition at line 285 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const std::vector< Matrix4f > & | value ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
value | The value of the uniform |
Definition at line 295 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const std::vector< Transform > & | value ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
value | The value of the uniform |
Definition at line 305 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const std::vector< Vector2f > & | value ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
value | The value of the uniform |
Definition at line 245 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const std::vector< Vector3f > & | value ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
value | The value of the uniform |
Definition at line 255 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const std::vector< Vector4f > & | value ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
value | The value of the uniform |
Definition at line 265 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const Transform & | value ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
value | The value of the uniform |
Definition at line 215 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const Transform * | ptr, | ||
size_t | size ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
ptr | The beginning pointer of the uniform values |
size | The count of uniform values |
Definition at line 392 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const Vector2f & | value ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
value | The value of the uniform |
Definition at line 155 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const Vector2f * | ptr, | ||
size_t | size ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
ptr | The beginning pointer of the uniform values |
size | The count of uniform values |
Definition at line 326 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const Vector3f & | value ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
value | The value of the uniform |
Definition at line 165 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const Vector3f * | ptr, | ||
size_t | size ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
ptr | The beginning pointer of the uniform values |
size | The count of uniform values |
Definition at line 337 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const Vector4f & | value ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
value | The value of the uniform |
Definition at line 175 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
const Vector4f * | ptr, | ||
size_t | size ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
ptr | The beginning pointer of the uniform values |
size | The count of uniform values |
Definition at line 348 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
float | value ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
value | The value of the uniform |
Definition at line 225 of file Shader.cpp.
void Shader::uniform | ( | unsigned int | location, |
int | value ) const |
Passes a uniform at a certain location to the shader
location | The location of the uniform |
value | The value of the uniform |
Definition at line 235 of file Shader.cpp.
void Shader::useProgram | ( | ) | const |
Uses this shader program for rendering
Definition at line 128 of file Shader.cpp.
|
private |
The OpenGL id of the shader program
Definition at line 34 of file Shader.hpp.