56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
#pragma once
|
|
#include <string>
|
|
#include <vector>
|
|
#include <memory>
|
|
#include <GL/glew.h>
|
|
#include <functional>
|
|
#include "glm/gtc/type_ptr.hpp"
|
|
|
|
#include "Light.h"
|
|
#include "SceneContext.h"
|
|
#include "Loader.h"
|
|
#include "Texture.h"
|
|
|
|
class Shader
|
|
{
|
|
public:
|
|
Shader() {};
|
|
Shader(const std::string vtx_name, const std::string frag_name);
|
|
~Shader();
|
|
|
|
Material mat;
|
|
|
|
void enable();
|
|
void disable();
|
|
|
|
|
|
public:
|
|
void setUniforms(SceneContext ctx);
|
|
|
|
void addUniform(const std::string name, glm::vec3 data)
|
|
{
|
|
_program.use(); glUniform3fv(_program.addUniform(name), 1, glm::value_ptr(data));
|
|
}
|
|
|
|
void addUniform(const std::string name, int data)
|
|
{
|
|
_program.use(); glUniform1i(_program.addUniform(name), data);
|
|
}
|
|
|
|
void addUniform(const std::string name, float data)
|
|
{
|
|
_program.use(); glUniform1fv(_program.addUniform(name), 1, &data);
|
|
}
|
|
|
|
void addUniform(const std::string name, glm::mat3x3 &data)
|
|
{
|
|
_program.use(); glUniformMatrix3fv(_program.addUniform(name), 1, GL_FALSE, glm::value_ptr(data));
|
|
}
|
|
|
|
void addUniform(const std::string name, glm::mat4x4 &data)
|
|
{
|
|
_program.use(); glUniformMatrix4fv(_program.addUniform(name), 1, GL_FALSE, glm::value_ptr(data));
|
|
}
|
|
|
|
ShaderProgram _program;
|
|
}; |