Browse Source

Add setting of int arrays in Shader

master
Riyyi 4 years ago
parent
commit
25e6079000
  1. 6
      inferno/src/inferno/render/shader.cpp
  2. 3
      inferno/src/inferno/render/shader.h

6
inferno/src/inferno/render/shader.cpp

@ -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

3
inferno/src/inferno/render/shader.h

@ -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;

Loading…
Cancel
Save