update Shader class
This commit is contained in:
parent
5678700826
commit
c3bc084e76
@ -38,7 +38,7 @@ uint Shader::getUniformLocation(const std::string& name) {
|
||||
return found->second;
|
||||
}
|
||||
|
||||
void Shader::uniformMatrix(const std::string& name, glm::mat4 matrix){
|
||||
void Shader::uniformMatrix(const std::string& name, const glm::mat4& matrix){
|
||||
glUniformMatrix4fv(getUniformLocation(name), 1, GL_FALSE, glm::value_ptr(matrix));
|
||||
}
|
||||
|
||||
@ -54,11 +54,11 @@ void Shader::uniform2f(const std::string& name, float x, float y){
|
||||
glUniform2f(getUniformLocation(name), x, y);
|
||||
}
|
||||
|
||||
void Shader::uniform2f(const std::string& name, glm::vec2 xy){
|
||||
void Shader::uniform2f(const std::string& name, const glm::vec2& xy){
|
||||
glUniform2f(getUniformLocation(name), xy.x, xy.y);
|
||||
}
|
||||
|
||||
void Shader::uniform2i(const std::string& name, glm::ivec2 xy){
|
||||
void Shader::uniform2i(const std::string& name, const glm::ivec2& xy){
|
||||
glUniform2i(getUniformLocation(name), xy.x, xy.y);
|
||||
}
|
||||
|
||||
@ -66,10 +66,14 @@ void Shader::uniform3f(const std::string& name, float x, float y, float z){
|
||||
glUniform3f(getUniformLocation(name), x,y,z);
|
||||
}
|
||||
|
||||
void Shader::uniform3f(const std::string& name, glm::vec3 xyz){
|
||||
void Shader::uniform3f(const std::string& name, const glm::vec3& xyz){
|
||||
glUniform3f(getUniformLocation(name), xyz.x, xyz.y, xyz.z);
|
||||
}
|
||||
|
||||
void Shader::uniform4f(const std::string& name, const glm::vec4& xyzw) {
|
||||
glUniform4f(getUniformLocation(name), xyzw.x, xyzw.y, xyzw.z, xyzw.w);
|
||||
}
|
||||
|
||||
|
||||
inline auto shader_deleter = [](GLuint* shader) {
|
||||
glDeleteShader(*shader);
|
||||
|
||||
@ -21,14 +21,15 @@ public:
|
||||
~Shader();
|
||||
|
||||
void use();
|
||||
void uniformMatrix(const std::string&, glm::mat4 matrix);
|
||||
void uniformMatrix(const std::string&, const glm::mat4& matrix);
|
||||
void uniform1i(const std::string& name, int x);
|
||||
void uniform1f(const std::string& name, float x);
|
||||
void uniform2f(const std::string& name, float x, float y);
|
||||
void uniform2f(const std::string& name, glm::vec2 xy);
|
||||
void uniform2i(const std::string& name, glm::ivec2 xy);
|
||||
void uniform2f(const std::string& name, const glm::vec2& xy);
|
||||
void uniform2i(const std::string& name, const glm::ivec2& xy);
|
||||
void uniform3f(const std::string& name, float x, float y, float z);
|
||||
void uniform3f(const std::string& name, glm::vec3 xyz);
|
||||
void uniform3f(const std::string& name, const glm::vec3& xyz);
|
||||
void uniform4f(const std::string& name, const glm::vec4& xyzw);
|
||||
|
||||
/// @brief Create shader program using vertex and fragment shaders source.
|
||||
/// @param vertexFile vertex shader file name
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user