aboutsummaryrefslogtreecommitdiff
path: root/include/RenderBackend/OpenGL/ShaderVec.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/RenderBackend/OpenGL/ShaderVec.hpp')
-rw-r--r--include/RenderBackend/OpenGL/ShaderVec.hpp142
1 files changed, 0 insertions, 142 deletions
diff --git a/include/RenderBackend/OpenGL/ShaderVec.hpp b/include/RenderBackend/OpenGL/ShaderVec.hpp
deleted file mode 100644
index 4353dd7..0000000
--- a/include/RenderBackend/OpenGL/ShaderVec.hpp
+++ /dev/null
@@ -1,142 +0,0 @@
-#pragma once
-
-#include "../../types.hpp"
-#include "../../RenderBackend/OpenGL/DeviceMemory.hpp"
-#include <string>
-
-namespace amalgine
-{
- class Shader;
- class ShaderProgram;
-
- enum class AttributeType
- {
- NONE,
- VEC2,
- VEC3,
- VEC4
- };
-
- AttributeType getAttributeTypeByName(const char *attributeName);
-
- class ShaderGlobalVec
- {
- friend class Shader;
- friend class ShaderGlobalVec3;
- public:
- ShaderGlobalVec() : attributeType(AttributeType::NONE) {}
- const std::string& getName() const { return name; }
- AttributeType getAttributeType() const { return attributeType; }
- protected:
- ShaderGlobalVec(const std::string &_name, AttributeType _attributeType) : name(_name), attributeType(_attributeType) {}
- private:
- std::string name;
- AttributeType attributeType;
- };
-
- class ShaderGlobalVec3
- {
- friend class Shader;
- public:
- const std::string& getName() const { return globalVec.getName(); }
- AttributeType getAttributeType() const { return globalVec.getAttributeType(); }
- ShaderGlobalVec getVecObject() const { return globalVec; }
- private:
- ShaderGlobalVec3(const std::string &_name) : globalVec(_name, AttributeType::VEC3) {}
- private:
- ShaderGlobalVec globalVec;
- };
-
- class ShaderProgramGlobalVec3
- {
- friend class ShaderProgram;
- public:
- void set(f32 x = 0.0f, f32 y = 0.0f, f32 z = 0.0f);
- private:
- ShaderProgramGlobalVec3(ShaderProgram *_shaderProgram, i32 _uniformId) : shaderProgram(_shaderProgram), uniformId(_uniformId){}
- private:
- ShaderProgram *shaderProgram;
- i32 uniformId;
- };
-
- class ShaderInputVec2
- {
- friend class Shader;
- public:
- const std::string& getName() const;
- void setData(const DeviceMemory &data);
- private:
- ShaderInputVec2(Shader *_shader, i32 _attributeIndex) :
- shader(_shader),
- attributeIndex(_attributeIndex)
- {
-
- }
- private:
- Shader *shader;
- i32 attributeIndex;
- };
-
- class ShaderVec4
- {
- public:
- ShaderVec4(f32 x = 0.0f, f32 y = 0.0f, f32 z = 0.0f, f32 w = 0.0f)
- {
- result = "vec4(";
- result += std::to_string(x);
- result += ", ";
- result += std::to_string(y);
- result += ", ";
- result += std::to_string(z);
- result += ", ";
- result += std::to_string(w);
- result += ")";
- }
-
- ShaderVec4(const ShaderInputVec2 &vec2, f32 z = 0.0f, f32 w = 0.0f)
- {
- result = "vec4(";
- result += vec2.getName();
- result += ", ";
- result += std::to_string(z);
- result += ", ";
- result += std::to_string(w);
- result += ")";
- }
-
- ShaderVec4(const ShaderGlobalVec3 &vec3, f32 w = 0.0f)
- {
- result = "vec4(";
- result += vec3.getName();
- result += ", ";
- result += std::to_string(w);
- result += ")";
- }
-
- const std::string& getOutput() const
- {
- return result;
- }
- private:
- std::string result;
- };
-
- class ShaderOutputVec4
- {
- friend class Shader;
- public:
- const std::string& getName() const;
-
- void operator=(const ShaderVec4 &shaderVec4);
- private:
- ShaderOutputVec4(Shader *_shader, i32 _attributeIndex) :
- shader(_shader),
- attributeIndex(_attributeIndex)
- {
-
- }
- private:
- Shader *shader;
- i32 attributeIndex;
- };
-}