From bfd21732b35a3856b1f72c826816c2857710fcb3 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 21 Dec 2017 22:52:12 +0100 Subject: Added shader program --- src/RenderBackend/OpenGL/PixelShader.cpp | 44 ++------------------------------ 1 file changed, 2 insertions(+), 42 deletions(-) (limited to 'src/RenderBackend/OpenGL/PixelShader.cpp') diff --git a/src/RenderBackend/OpenGL/PixelShader.cpp b/src/RenderBackend/OpenGL/PixelShader.cpp index cbdc842..2a7c913 100644 --- a/src/RenderBackend/OpenGL/PixelShader.cpp +++ b/src/RenderBackend/OpenGL/PixelShader.cpp @@ -1,7 +1,4 @@ #include "../../../include/RenderBackend/OpenGL/PixelShader.hpp" -#include "../../../include/RenderBackend/OpenGL/CommonShader.hpp" -#include "../../../include/RenderBackend/OpenGL/opengl.hpp" -#include using namespace std; @@ -31,24 +28,11 @@ namespace amalgine } - PixelShader::PixelShader() : locationCounter(0), mainFuncDefined(false) + PixelShader::PixelShader() : mainFuncDefined(false) { - glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxPixelAttribs); writeHeader("#version 330 core\n\n"); } - const string& PixelShader::getOutputAttributeName(i32 attributeIndex) - { - assert(attributeIndex < pixelAttributeNames.size()); - return pixelAttributeNames[attributeIndex]; - } - - ShaderOutputVec4 PixelShader::defineOutputVec4(const std::string &name) - { - i32 attributeIndex = defineOutputVariable(name, "vec4"); - return ShaderOutputVec4(this, attributeIndex); - } - void PixelShader::defineMain(PixelShaderMainFunc mainFunc) { if(mainFuncDefined) @@ -68,31 +52,7 @@ namespace amalgine writeBody(";\n"); } - i32 PixelShader::defineOutputVariable(const string &variableName, const char *typeName) - { - if(!isShaderVariableNameValid(variableName.c_str())) - throw PixelShaderInvalidAttributeName(variableName); - - if(locationCounter + 1 > maxPixelAttribs) - throw PixelShaderTooManyAttributes(maxPixelAttribs); - - if(pixelAttributes.find(variableName) != pixelAttributes.end()) - throw PixelShaderAttributeAlreadyDefined(variableName); - - i32 attributeIndex = locationCounter; - pixelAttributes[variableName] = locationCounter; - pixelAttributeNames.push_back(variableName); - - ++locationCounter; - writeHeader("out "); - writeHeader(typeName); - writeHeader(" "); - writeHeader(variableName); - writeHeader(";\n"); - return attributeIndex; - } - - string PixelShader::build() + string PixelShader::build() const { std::string result; result.reserve(header.size() + 2 + body.size()); -- cgit v1.2.3