Molecular Vis
Improving perception of molecular visualization
|
Class handling shader construction and managment. More...
#include <Shader.h>
Public Member Functions | |
Shader (std::string vertexShader, std::string fragmentShader) | |
Shader (std::string computeShader) | |
void | setUniform (std::string uniform, const glm::vec3 &value) |
void | setUnifrom (GLint location, const glm::vec3 &value) |
void | setUniform (std::string uniform, const glm::uvec3 &value) |
void | setUnifrom (GLint location, const glm::uvec3 &value) |
void | setUniform (std::string uniform, const int value) |
void | setUniform (GLint location, const int value) |
void | setUniform (std::string uniform, const float value) |
void | setUniform (GLint location, const float value) |
void | setUniform (std::string uniform, const glm::mat4 &mat) |
void | setUniform (GLint location, const glm::mat4 &mat) |
void | setUniform (std::string uniform, const glm::mat3 &mat) |
void | setUniform (GLint location, const glm::mat3 &mat) |
void | use () |
void | unuse () |
Static Public Attributes | |
static const std::string | IMPORT_DIRECTIVE = "%%import" |
static const std::string | SHADER_DIRECTORY = "./assets/shader/" |
Class handling shader construction and managment.
This class can be used to generate vertex-fragment programs or compute shader programs. It handles the reading of the source files and compilation and linking of the source. It also handles the setting of uniforms and can also handle the import of shaders into other shaders.
Shader::Shader | ( | std::string | vertexShader, |
std::string | fragmentShader | ||
) |
Creates a vertex - fragment shader program
vertexShader | filename of vertex shader, has to be located in SHADER::SHADER_DIRECTORY |
fragmentShader | filename of fragment shader, has to be located in SHADER::SHADER_DIRECTORY |
Shader::Shader | ( | std::string | computeShader | ) |
Creates a compute shader program
computeShader | filename of compute shader, has to be located in SHADER::SHADER_DIRECTORY |
void Shader::setUniform | ( | std::string | uniform, |
const glm::vec3 & | value | ||
) |
Set a vec3 uniform
uniform | string of uniform name |
value | glm::vec3 value to be set |
void Shader::setUniform | ( | std::string | uniform, |
const glm::uvec3 & | value | ||
) |
Set a uvec3 uniform
uniform | string of uniform name |
value | glm::uvec3 value to be set |
void Shader::setUniform | ( | std::string | uniform, |
const int | value | ||
) |
Set a int uniform
uniform | string of uniform name |
value | int value to be set |
void Shader::setUniform | ( | GLint | location, |
const int | value | ||
) |
Set a int uniform
location | GLint location of uniform |
value | int value to be set |
void Shader::setUniform | ( | std::string | uniform, |
const float | value | ||
) |
Set a float uniform
uniform | string of uniform name |
value | float value to be set |
void Shader::setUniform | ( | GLint | location, |
const float | value | ||
) |
Set a float uniform
location | GLint location of uniform |
value | float value to be set |
void Shader::setUniform | ( | std::string | uniform, |
const glm::mat4 & | mat | ||
) |
Set a mat4 uniform
uniform | string of uniform name |
mat | glm::mat4 value to be set |
void Shader::setUniform | ( | GLint | location, |
const glm::mat4 & | mat | ||
) |
Set a mat4 uniform
location | GLint location of uniform |
mat | glm::mat4 value to be set |
void Shader::setUniform | ( | std::string | uniform, |
const glm::mat3 & | mat | ||
) |
Set a uvec3 uniform
uniform | string of uniform name |
mat | glm::uvec3 value to be set |
void Shader::setUniform | ( | GLint | location, |
const glm::mat3 & | mat | ||
) |
Set a mat3 uniform
location | GLint location of uniform |
mat | glm::mat3 value to be set |
void Shader::setUnifrom | ( | GLint | location, |
const glm::vec3 & | value | ||
) |
Set a vec3 uniform
location | GLint location of uniform |
value | glm::vec3 value to be set |
void Shader::setUnifrom | ( | GLint | location, |
const glm::uvec3 & | value | ||
) |
Set a uvec3 uniform
location | GLint location of uniform |
value | glm::uvec3 value to be set |
void Shader::unuse | ( | ) |
Disables current active shader program.
void Shader::use | ( | ) |
Sets the shader program as active.
|
static |
Preprocesser directive for import statement. Usage in shader code: <IMPORT_DIRECTIVE> <file>
This directive gets replaced with the code in file before compilation.
|
static |
Path to the shader folder