diff options
Diffstat (limited to 'src/RenderBackend/OpenGL/ShaderVec.cpp')
-rw-r--r-- | src/RenderBackend/OpenGL/ShaderVec.cpp | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/src/RenderBackend/OpenGL/ShaderVec.cpp b/src/RenderBackend/OpenGL/ShaderVec.cpp deleted file mode 100644 index 8897b84..0000000 --- a/src/RenderBackend/OpenGL/ShaderVec.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include "../../../include/RenderBackend/OpenGL/ShaderVec.hpp" -#include "../../../include/RenderBackend/OpenGL/Shader.hpp" -#include "../../../include/RenderBackend/OpenGL/ShaderProgram.hpp" -#include "../../../include/RenderBackend/OpenGL/opengl.hpp" -#include <cstring> -#include <cassert> - -using namespace std; - -namespace amalgine -{ - AttributeType getAttributeTypeByName(const char *attributeName) - { - if(strncmp(attributeName, "vec2", 4) == 0) - { - return AttributeType::VEC2; - } - else if(strncmp(attributeName, "vec3", 4) == 0) - { - return AttributeType::VEC3; - } - else if(strncmp(attributeName, "vec4", 4) == 0) - { - return AttributeType::VEC4; - } - - assert(false); - return AttributeType::NONE; - } - - void ShaderProgramGlobalVec3::set(f32 x, f32 y, f32 z) - { - shaderProgram->use(); - glUniform3f(uniformId, x, y, z); - } - - const string& ShaderInputVec2::getName() const - { - return shader->getInputAttributeName(attributeIndex); - } - - void ShaderInputVec2::setData(const DeviceMemory &data) - { - data.use(); - AttributeType attributeType = shader->getInputAttributeType(attributeIndex); - switch(attributeType) - { - case AttributeType::VEC2: - { - glVertexAttribPointer(attributeIndex, 2, GL_FLOAT, GL_FALSE, 0, 0); - break; - } - default: - assert(false); - break; - } - glEnableVertexAttribArray(attributeIndex); - } - - const string& ShaderOutputVec4::getName() const - { - return shader->getOutputAttributeName(attributeIndex); - } - - void ShaderOutputVec4::operator=(const ShaderVec4 &shaderVec4) - { - shader->assign(*this, shaderVec4); - } -} |