summaryrefslogtreecommitdiffstats
path: root/src/Shader.hpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2021-12-25 07:42:52 +0100
committerGitHub <noreply@github.com>2021-12-25 07:42:52 +0100
commit40421159568518bb7573903d14a2c69c64dead95 (patch)
tree15c830dce151bf0b427123efd214173742887e8e /src/Shader.hpp
parentMerge pull request #70 from LaG1924/ftr/build-3 (diff)
parentFixed missing APIENTRY linux build (diff)
downloadAltCraft-40421159568518bb7573903d14a2c69c64dead95.tar
AltCraft-40421159568518bb7573903d14a2c69c64dead95.tar.gz
AltCraft-40421159568518bb7573903d14a2c69c64dead95.tar.bz2
AltCraft-40421159568518bb7573903d14a2c69c64dead95.tar.lz
AltCraft-40421159568518bb7573903d14a2c69c64dead95.tar.xz
AltCraft-40421159568518bb7573903d14a2c69c64dead95.tar.zst
AltCraft-40421159568518bb7573903d14a2c69c64dead95.zip
Diffstat (limited to 'src/Shader.hpp')
-rw-r--r--src/Shader.hpp60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/Shader.hpp b/src/Shader.hpp
deleted file mode 100644
index 6b3220d..0000000
--- a/src/Shader.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-#pragma once
-
-#include <map>
-#include <vector>
-#include <string>
-
-#include <GL/glew.h>
-#include <glm/glm.hpp>
-#include <glm/gtc/type_ptr.hpp>
-
-class Shader {
- std::map<std::string, GLuint> uniforms;
- GLuint program = 0;
-
- GLuint GetUniformLocation(const std::string &name);
-
-public:
- Shader(const Shader &) = delete;
- Shader(Shader &&other) = delete;
- Shader &operator=(const Shader &) = delete;
- Shader &operator=(Shader &&other) = delete;
-
- Shader(const std::string &vertSource, const std::string &fragSource, const std::vector<std::string> &uniformsNames);
-
- ~Shader();
-
- void Activate();
-
- inline void SetUniform(const std::string& name, unsigned int val, unsigned int val2) {
- glUniform2ui(GetUniformLocation(name), val, val2);
- }
-
- inline void SetUniform(const std::string &name, int val) {
- glUniform1i(GetUniformLocation(name), val);
- }
-
- inline void SetUniform(const std::string& name, int val, int val2) {
- glUniform2i(GetUniformLocation(name), val, val2);
- }
-
- inline void SetUniform(const std::string &name, float val) {
- glUniform1f(GetUniformLocation(name), val);
- }
-
- inline void SetUniform(const std::string &name, glm::vec2 val) {
- glUniform2f(GetUniformLocation(name), val.x, val.y);
- }
-
- inline void SetUniform(const std::string &name, glm::vec3 val) {
- glUniform3f(GetUniformLocation(name), val.x, val.y, val.z);
- }
-
- inline void SetUniform(const std::string &name, glm::vec4 val) {
- glUniform4f(GetUniformLocation(name), val.x, val.y, val.z, val.w);
- }
-
- inline void SetUniform(const std::string &name, glm::mat4 val) {
- glUniformMatrix4fv(GetUniformLocation(name), 1, GL_FALSE, glm::value_ptr(val));
- }
-}; \ No newline at end of file