mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-03-29 18:54:07 +00:00
Add uniform setters for int[2..4] vectors in Shader class.
This commit is contained in:
@ -109,6 +109,16 @@ void Shader::SetUniformFloat2(const char* uniform, const glm::vec2& values) cons
|
||||
glUniform2fv(location, 1, glm::value_ptr(values));
|
||||
}
|
||||
|
||||
void Shader::SetUniformInt2(const char* uniform, const glm::ivec2& values) const
|
||||
{
|
||||
auto location = glGetUniformLocation(m_shaderProgram, uniform);
|
||||
if (location < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
glUniform2iv(location, 1, glm::value_ptr(values));
|
||||
}
|
||||
|
||||
void Shader::SetUniformFloat3(const char* uniform, const glm::vec3& values) const
|
||||
{
|
||||
auto location = glGetUniformLocation(m_shaderProgram, uniform);
|
||||
@ -119,6 +129,16 @@ void Shader::SetUniformFloat3(const char* uniform, const glm::vec3& values) cons
|
||||
glUniform3fv(location, 1, glm::value_ptr(values));
|
||||
}
|
||||
|
||||
void Shader::SetUniformInt3(const char* uniform, const glm::ivec3& values) const
|
||||
{
|
||||
auto location = glGetUniformLocation(m_shaderProgram, uniform);
|
||||
if (location < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
glUniform3iv(location, 1, glm::value_ptr(values));
|
||||
}
|
||||
|
||||
void Shader::SetUniformFloat4(const char* uniform, const glm::vec4& values) const
|
||||
{
|
||||
auto location = glGetUniformLocation(m_shaderProgram, uniform);
|
||||
@ -129,6 +149,16 @@ void Shader::SetUniformFloat4(const char* uniform, const glm::vec4& values) cons
|
||||
glUniform4fv(location, 1, glm::value_ptr(values));
|
||||
}
|
||||
|
||||
void Shader::SetUniformInt4(const char* uniform, const glm::ivec4& values) const
|
||||
{
|
||||
auto location = glGetUniformLocation(m_shaderProgram, uniform);
|
||||
if (location < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
glUniform4iv(location, 1, glm::value_ptr(values));
|
||||
}
|
||||
|
||||
void Shader::SetUniformMat3x4(const char* uniform, const glm::mat3x4& values) const
|
||||
{
|
||||
auto location = glGetUniformLocation(m_shaderProgram, uniform);
|
||||
@ -202,4 +232,4 @@ auto Shader::GetShaderLanguageVersion() -> Shader::GlslVersion
|
||||
int versionMinor = std::stoi(shaderLanguageVersionString.substr(dotPos + 1));
|
||||
|
||||
return {versionMajor, versionMinor};
|
||||
}
|
||||
}
|
||||
@ -112,6 +112,14 @@ public:
|
||||
*/
|
||||
void SetUniformFloat2(const char* uniform, const glm::vec2& values) const;
|
||||
|
||||
/**
|
||||
* @brief Sets an int vec2 uniform.
|
||||
* The program must be bound before calling this method!
|
||||
* @param uniform The uniform name
|
||||
* @param values The values to set.
|
||||
*/
|
||||
void SetUniformInt2(const char* uniform, const glm::ivec2& values) const;
|
||||
|
||||
/**
|
||||
* @brief Sets a float vec3 uniform.
|
||||
* The program must be bound before calling this method!
|
||||
@ -120,6 +128,14 @@ public:
|
||||
*/
|
||||
void SetUniformFloat3(const char* uniform, const glm::vec3& values) const;
|
||||
|
||||
/**
|
||||
* @brief Sets an int vec3 uniform.
|
||||
* The program must be bound before calling this method!
|
||||
* @param uniform The uniform name
|
||||
* @param values The values to set.
|
||||
*/
|
||||
void SetUniformInt3(const char* uniform, const glm::ivec3& values) const;
|
||||
|
||||
/**
|
||||
* @brief Sets a float vec4 uniform.
|
||||
* The program must be bound before calling this method!
|
||||
@ -128,6 +144,14 @@ public:
|
||||
*/
|
||||
void SetUniformFloat4(const char* uniform, const glm::vec4& values) const;
|
||||
|
||||
/**
|
||||
* @brief Sets an int vec4 uniform.
|
||||
* The program must be bound before calling this method!
|
||||
* @param uniform The uniform name
|
||||
* @param values The values to set.
|
||||
*/
|
||||
void SetUniformInt4(const char* uniform, const glm::ivec4& values) const;
|
||||
|
||||
/**
|
||||
* @brief Sets a float 3x4 matrix uniform.
|
||||
* The program must be bound before calling this method!
|
||||
|
||||
Reference in New Issue
Block a user