Add setting of int arrays in Shader

This commit is contained in:
Riyyi
2021-01-08 00:56:19 +01:00
parent bc9449e7de
commit 25e6079000
2 changed files with 8 additions and 1 deletions
+6
View File
@@ -52,6 +52,12 @@ namespace Inferno {
glUniform1i(findUniform(name), value);
}
void Shader::setInt(const std::string& name, int* values, uint32_t count)
{
// Set unifrom int array
glUniform1iv(findUniform(name), count, values);
}
void Shader::setFloat(const std::string& name, float value) const
{
// Set uniform float
+2 -1
View File
@@ -1,7 +1,7 @@
#ifndef SHADER_H
#define SHADER_H
#include <cstdint> // std::int32_t, std::uint32_t
#include <cstdint> // int32_t, uint32_t
#include <memory> // std::shared_ptr
#include <string> // std::string
#include <unordered_map> // std::unordered_map
@@ -18,6 +18,7 @@ namespace Inferno {
int32_t findUniform(const std::string& name) const;
void setInt(const std::string& name, int value);
void setInt(const std::string& name, int* values, uint32_t count);
void setFloat(const std::string& name, float value) const;
void setFloat(const std::string& name, float v1, float v2, float v3, float v4) const;
void setFloat(const std::string& name, glm::vec2 value) const;