diff --git a/src/dawn/display/RenderPipeline.cpp b/src/dawn/display/RenderPipeline.cpp index b5c6f175..aca204f1 100644 --- a/src/dawn/display/RenderPipeline.cpp +++ b/src/dawn/display/RenderPipeline.cpp @@ -93,6 +93,8 @@ void RenderPipeline::init() { // 0.0f // ); // glyphMesh.draw(MESH_DRAW_MODE_TRIANGLES, 0, -1); + + this->shaderBuffer.init(); } void RenderPipeline::render() { @@ -167,6 +169,11 @@ void RenderPipeline::renderSceneCamera(Scene *scene, Camera *camera) { assertNotNull(renderTarget); // Update shader parameter buffers with current knowledge + struct RenderPipelineShaderBufferData shaderBufferData; + shaderBufferData.projection = camera->getProjection(); + shaderBufferData.view = camera->transform->getWorldTransform(); + this->shaderBuffer.buffer(&shaderBufferData); + this->camera = camera; // Get the list of things to render first. @@ -219,6 +226,9 @@ void RenderPipeline::renderSceneCamera(Scene *scene, Camera *camera) { // Now we've sorted everything! Let's actually start rendering. Shader *boundShader = nullptr; std::map boundTextures; + std::map locationSlotMap; + std::map*, shaderbufferslot_t> bufferSlotMap; + shaderbufferslot_t globalSlot = 0; // TODO: This will be editable! renderTarget->bind(); @@ -251,6 +261,29 @@ void RenderPipeline::renderSceneCamera(Scene *scene, Camera *camera) { ++itTextureSlot; } + // Bind the buffers to their slots + auto itBufferSlot = item.parameterBuffers.begin(); + while(itBufferSlot != item.parameterBuffers.end()) { + // First check if buffer is already bound + auto location = itBufferSlot->first; + auto buff = itBufferSlot->second; + // auto existingBind = bufferSlotMap.find(buff); + shaderbufferslot_t slot; + + // if(existingBind == bufferSlotMap.end()) { + // Not bound, let's find a slot we can use! + // slot = -1; + slot = globalSlot++; + // } else { + // // Already bound + // slot = existingBind->second; + // } + + buff->bind(slot); + locationSlotMap[itBufferSlot->first] = slot; + ++itBufferSlot; + } + // Now set each of the parameters. Nothing exciting here. auto itColors = item.colorValues.begin(); while(itColors != item.colorValues.end()) { @@ -282,6 +315,12 @@ void RenderPipeline::renderSceneCamera(Scene *scene, Camera *camera) { ++itText; } + auto itBuffer = item.parameterBuffers.begin(); + while(itBuffer != item.parameterBuffers.end()) { + item.shader->setParameterBuffer(itBuffer->first, locationSlotMap[itBuffer->first]); + ++itBuffer; + } + auto itFloat = item.floatValues.begin(); while(itFloat != item.floatValues.end()) { item.shader->setFloat(itFloat->first, itFloat->second); diff --git a/src/dawn/display/RenderPipeline.hpp b/src/dawn/display/RenderPipeline.hpp index 7334607a..283166ea 100644 --- a/src/dawn/display/RenderPipeline.hpp +++ b/src/dawn/display/RenderPipeline.hpp @@ -10,6 +10,7 @@ #include "scene/components/scene/SubSceneController.hpp" #include "scene/components/ui/UIComponent.hpp" #include "display/shader/ShaderPass.hpp" +#include "display/shader/buffers/RenderPipelineShaderBuffer.hpp" namespace Dawn { class RenderManager; @@ -23,6 +24,7 @@ namespace Dawn { // Temporary hack Camera *camera = nullptr; + RenderPipelineShaderBuffer shaderBuffer; /** * Constructs a new RenderPipeline. Render Pipelines are my attempt to diff --git a/src/dawn/display/shader/ShaderPass.hpp b/src/dawn/display/shader/ShaderPass.hpp index bda6b946..d749d2d5 100644 --- a/src/dawn/display/shader/ShaderPass.hpp +++ b/src/dawn/display/shader/ShaderPass.hpp @@ -6,6 +6,7 @@ #pragma once #include "display/shader/Shader.hpp" #include "display/mesh/Mesh.hpp" +#include "display/shader/ShaderParameterBuffer.hpp" namespace Dawn { struct ShaderPassItem { @@ -26,6 +27,7 @@ namespace Dawn { std::map vec3Values; std::map textureValues; std::map floatValues; + std::map*> parameterBuffers; // Textures std::map textureSlots; diff --git a/src/dawn/display/shader/_ShaderParameterBuffer.hpp b/src/dawn/display/shader/_ShaderParameterBuffer.hpp index 1642d56b..abdf2cb0 100644 --- a/src/dawn/display/shader/_ShaderParameterBuffer.hpp +++ b/src/dawn/display/shader/_ShaderParameterBuffer.hpp @@ -7,7 +7,7 @@ #include "dawnlibs.hpp" namespace Dawn { - template + template class IShaderParameterBuffer { public: /** @@ -15,14 +15,6 @@ namespace Dawn { */ virtual void init() = 0; - /** - * Basic buffer method. Buffers the entire contents of the data struct to - * this shader parameter buffer. - * - * @param data Data to buffer to the parameter. - */ - virtual void buffer(T *data) = 0; - /** * Bind this shader buffer to the supplied location. * diff --git a/src/dawn/scene/debug/SceneDebugLine.cpp b/src/dawn/scene/debug/SceneDebugLine.cpp index 82c404fe..c5f3cf6e 100644 --- a/src/dawn/scene/debug/SceneDebugLine.cpp +++ b/src/dawn/scene/debug/SceneDebugLine.cpp @@ -4,7 +4,7 @@ // https://opensource.org/licenses/MIT #include "SceneDebugLine.hpp" -#include "display/shader/SimpleTexturedShader.hpp" +#include "display/shader/shaders/SimpleTexturedShader.hpp" #include "scene/components/display/Camera.hpp" #include "scene/Scene.hpp" #include "scene/components/physics/3d/Collider3D.hpp" diff --git a/src/dawnliminal/scenes/HelloWorldScene.hpp b/src/dawnliminal/scenes/HelloWorldScene.hpp index f5814049..1637eb5d 100644 --- a/src/dawnliminal/scenes/HelloWorldScene.hpp +++ b/src/dawnliminal/scenes/HelloWorldScene.hpp @@ -27,33 +27,33 @@ namespace Dawn { camera = Camera::create(this); camera->transform->lookAt(glm::vec3(3, 3, 3), glm::vec3(0, 0, 0)); - // cube = SimpleSpinningCubePrefab::create(this); + cube = SimpleSpinningCubePrefab::create(this); - item = this->createSceneItem(); - auto meshRenderer = item->addComponent(); - auto quadMeshHost = item->addComponent(); - auto material = item->addComponent(); + // item = this->createSceneItem(); + // auto meshRenderer = item->addComponent(); + // auto quadMeshHost = item->addComponent(); + // auto material = item->addComponent(); - if(FT_New_Face( - this->game->renderManager.getFontManager()->fontLibrary, - "C:\\Windows\\Fonts\\Arial.ttf", - 0, - &face - )) { - assertUnreachable(); - } - if(FT_Set_Pixel_Sizes(face, 0, 16)) { - assertUnreachable(); - } + // if(FT_New_Face( + // this->game->renderManager.getFontManager()->fontLibrary, + // "C:\\Windows\\Fonts\\Arial.ttf", + // 0, + // &face + // )) { + // assertUnreachable(); + // } + // if(FT_Set_Pixel_Sizes(face, 0, 16)) { + // assertUnreachable(); + // } - _newTrueTypePlaceholder(face, texture, charStore); - FT_ULong c = 'B'; - auto x = charStore[c]; - glm::vec2 wh = glm::vec2(texture.getWidth(), texture.getHeight()); - quadMeshHost->uv0 = glm::vec2(0.0f, x.textureY) / wh; - quadMeshHost->uv1 = (glm::vec2)quadMeshHost->uv0 + (x.bitmapSize / wh); - std::cout << "Done" << std::endl; - material->texture = &texture; + // _newTrueTypePlaceholder(face, texture, charStore); + // FT_ULong c = 'B'; + // auto x = charStore[c]; + // glm::vec2 wh = glm::vec2(texture.getWidth(), texture.getHeight()); + // quadMeshHost->uv0 = glm::vec2(0.0f, x.textureY) / wh; + // quadMeshHost->uv1 = (glm::vec2)quadMeshHost->uv0 + (x.bitmapSize / wh); + // std::cout << "Done" << std::endl; + // material->texture = &texture; } std::vector getRequiredAssets() override { diff --git a/src/dawnopengl/display/RenderManager.hpp b/src/dawnopengl/display/RenderManager.hpp index 4c5d26db..af5bcd3e 100644 --- a/src/dawnopengl/display/RenderManager.hpp +++ b/src/dawnopengl/display/RenderManager.hpp @@ -7,9 +7,9 @@ #include "display/_RenderManager.hpp" #include "display/BackBufferRenderTarget.hpp" #include "display/shader/ShaderManager.hpp" -#include "display/shader/SimpleTexturedShader.hpp" -#include "display/shader/FontShader.hpp" -#include "display/shader/UIShader.hpp" +#include "display/shader/shaders/SimpleTexturedShader.hpp" +#include "display/shader/shaders/FontShader.hpp" +#include "display/shader/shaders/UIShader.hpp" #include "display/RenderPipeline.hpp" #include "display/font/FontManager.hpp" #include "display/font/ExampleFont.hpp" diff --git a/src/dawnopengl/display/shader/CMakeLists.txt b/src/dawnopengl/display/shader/CMakeLists.txt index 7bb59203..1bf1f2d0 100644 --- a/src/dawnopengl/display/shader/CMakeLists.txt +++ b/src/dawnopengl/display/shader/CMakeLists.txt @@ -7,7 +7,7 @@ target_sources(${DAWN_TARGET_NAME} PRIVATE Shader.cpp - FontShader.cpp - SimpleTexturedShader.cpp - SimpleBillboardedShader.cpp -) \ No newline at end of file +) + +add_subdirectory(buffers) +add_subdirectory(shaders) \ No newline at end of file diff --git a/src/dawnopengl/display/shader/ShaderParameterBuffer.hpp b/src/dawnopengl/display/shader/ShaderParameterBuffer.hpp index 556a6254..af76fcba 100644 --- a/src/dawnopengl/display/shader/ShaderParameterBuffer.hpp +++ b/src/dawnopengl/display/shader/ShaderParameterBuffer.hpp @@ -13,7 +13,7 @@ namespace Dawn { typedef GLuint shaderbufferlocation_t; template - class ShaderParameterBuffer : public IShaderParameterBuffer { + class ShaderParameterBuffer : public IShaderParameterBuffer { protected: shaderbufferlocation_t id = -1; size_t size; @@ -29,7 +29,14 @@ namespace Dawn { glBufferData(GL_UNIFORM_BUFFER, this->size, NULL, GL_DYNAMIC_DRAW); } - void buffer(T *data) override { + /** + * Basic buffer method. Buffers the entire contents of the data struct to + * this shader parameter buffer. + * + * @param data Data to buffer to the parameter. + */ + void buffer(T *data) { + this->bind(0); this->bufferRaw((void*)data); } diff --git a/src/dawnopengl/display/shader/buffers/CMakeLists.txt b/src/dawnopengl/display/shader/buffers/CMakeLists.txt new file mode 100644 index 00000000..0ffe7bd4 --- /dev/null +++ b/src/dawnopengl/display/shader/buffers/CMakeLists.txt @@ -0,0 +1,9 @@ +# Copyright (c) 2023 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE +) diff --git a/src/dawnopengl/display/shader/buffers/RenderPipelineShaderBuffer.hpp b/src/dawnopengl/display/shader/buffers/RenderPipelineShaderBuffer.hpp new file mode 100644 index 00000000..662dac52 --- /dev/null +++ b/src/dawnopengl/display/shader/buffers/RenderPipelineShaderBuffer.hpp @@ -0,0 +1,30 @@ +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "display/shader/ShaderParameterBuffer.hpp" + +namespace Dawn { + struct RenderPipelineShaderBufferData { + glm::mat4 view; + glm::mat4 projection; + }; + + class RenderPipelineShaderBuffer : public ShaderParameterBuffer { + public: + static std::string getShaderUniformName() { + return "ub_RenderPipeline"; + } + + static std::string getShaderUniform() { + return std::string( + "layout (std140) uniform ub_RenderPipeline {\n" + "mat4 u_View;\n" + "mat4 u_Projection;\n" + "};" + ); + } + }; +} \ No newline at end of file diff --git a/src/dawnopengl/display/shader/shaders/CMakeLists.txt b/src/dawnopengl/display/shader/shaders/CMakeLists.txt new file mode 100644 index 00000000..775fbb74 --- /dev/null +++ b/src/dawnopengl/display/shader/shaders/CMakeLists.txt @@ -0,0 +1,12 @@ +# Copyright (c) 2023 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE + FontShader.cpp + SimpleTexturedShader.cpp + SimpleBillboardedShader.cpp +) diff --git a/src/dawnopengl/display/shader/FontShader.cpp b/src/dawnopengl/display/shader/shaders/FontShader.cpp similarity index 100% rename from src/dawnopengl/display/shader/FontShader.cpp rename to src/dawnopengl/display/shader/shaders/FontShader.cpp diff --git a/src/dawnopengl/display/shader/FontShader.hpp b/src/dawnopengl/display/shader/shaders/FontShader.hpp similarity index 100% rename from src/dawnopengl/display/shader/FontShader.hpp rename to src/dawnopengl/display/shader/shaders/FontShader.hpp diff --git a/src/dawnopengl/display/shader/SimpleBillboardedShader.cpp b/src/dawnopengl/display/shader/shaders/SimpleBillboardedShader.cpp similarity index 100% rename from src/dawnopengl/display/shader/SimpleBillboardedShader.cpp rename to src/dawnopengl/display/shader/shaders/SimpleBillboardedShader.cpp diff --git a/src/dawnopengl/display/shader/SimpleBillboardedShader.hpp b/src/dawnopengl/display/shader/shaders/SimpleBillboardedShader.hpp similarity index 100% rename from src/dawnopengl/display/shader/SimpleBillboardedShader.hpp rename to src/dawnopengl/display/shader/shaders/SimpleBillboardedShader.hpp diff --git a/src/dawnopengl/display/shader/SimpleTexturedShader.cpp b/src/dawnopengl/display/shader/shaders/SimpleTexturedShader.cpp similarity index 85% rename from src/dawnopengl/display/shader/SimpleTexturedShader.cpp rename to src/dawnopengl/display/shader/shaders/SimpleTexturedShader.cpp index b371403a..283e1cbd 100644 --- a/src/dawnopengl/display/shader/SimpleTexturedShader.cpp +++ b/src/dawnopengl/display/shader/shaders/SimpleTexturedShader.cpp @@ -1,96 +1,98 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "SimpleTexturedShader.hpp" - -using namespace Dawn; - -void SimpleTexturedShader::compile() { - #if DAWN_OPENGL_GLSL - this->compileShader( - { - { "aPos", 0 }, - { "aTexCoord", 1 } - }, - // Vertex Shader - "#version 330 core\n" - "layout (location = 0) in vec3 aPos;\n" - "layout (location = 1) in vec2 aTexCoord;\n" - - "uniform mat4 u_Proj;\n" - "uniform mat4 u_View;\n" - "uniform mat4 u_Model;\n" - - "out vec2 o_TextCoord;\n" - "void main() {\n" - "gl_Position = u_Proj * u_View * u_Model * vec4(aPos, 1.0);\n" - "o_TextCoord = vec2(aTexCoord.x, aTexCoord.y);\n" - "}", - - // Fragment Shader - "#version 330 core\n" - - "in vec2 o_TextCoord;\n" - "out vec4 o_Color;\n" - "uniform vec4 u_Color;\n" - "uniform bool u_HasTexture;\n" - "uniform sampler2D u_Text;\n" - - "void main() {\n" - "if(u_HasTexture) {\n" - "o_Color = texture(u_Text, o_TextCoord) * u_Color;\n" - "} else {\n" - "o_Color = u_Color;" - "}\n" - "}\n" - ); - #elif DAWN_OPENGL_HLSL - this->compileShader( - { - { "aPos", 0 }, - { "aTexCoord", 1 } - }, - // Vertex Shader - "uniform float4x4 u_Proj;\n" - "uniform float4x4 u_View;\n" - "uniform float4x4 u_Model;\n" - "void main(" - "float3 aPos,\n" - "float2 aTexCoord,\n" - "float2 out o_TextCoord : TEXCOORD0,\n" - "float4 out gl_Position : POSITION\n" - ") {\n" - "o_TextCoord = aTexCoord;\n" - "gl_Position = mul(mul(mul(float4(aPos, 1.0), u_Model), u_View), u_Proj);\n" - "}", - - // Fragment Shader - "uniform float4 u_Color;\n" - "uniform bool u_HasTexture;\n" - "uniform sampler2D u_Text : TEXUNIT0;\n" - - "float4 main(\n" - "float2 o_TextCoord : TEXCOORD0\n" - ") {\n" - "float4 o_Color;\n" - "if(u_HasTexture) {\n" - "o_Color = mul(tex2D(u_Text, o_TextCoord), u_Color);\n" - "} else {\n" - "o_Color = u_Color;\n" - "}\n" - "return o_Color;\n" - "}\n" - ); - #else - #error Shader Type must be either GLSL or HLSL - #endif - - this->paramProjection = this->getParameterByName("u_Proj"); - this->paramView = this->getParameterByName("u_View"); - this->paramModel = this->getParameterByName("u_Model"); - this->paramColor = this->getParameterByName("u_Color"); - this->paramTexture = this->getParameterByName("u_Text"); - this->paramHasTexture = this->getParameterByName("u_HasTexture"); +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "SimpleTexturedShader.hpp" + +using namespace Dawn; + +void SimpleTexturedShader::compile() { + #if DAWN_OPENGL_GLSL + this->compileShader( + { + { "aPos", 0 }, + { "aTexCoord", 1 } + }, + // Vertex Shader + "#version 330 core\n" + "layout (location = 0) in vec3 aPos;\n" + "layout (location = 1) in vec2 aTexCoord;\n" + + + RenderPipelineShaderBuffer::getShaderUniform() + "" + + // "uniform mat4 u_Proj;\n" + // "uniform mat4 u_View;\n" + "uniform mat4 u_Model;\n" + + "out vec2 o_TextCoord;\n" + "void main() {\n" + "gl_Position = u_Projection * u_View * u_Model * vec4(aPos, 1.0);\n" + "o_TextCoord = vec2(aTexCoord.x, aTexCoord.y);\n" + "}", + + // Fragment Shader + "#version 330 core\n" + + "in vec2 o_TextCoord;\n" + "out vec4 o_Color;\n" + "uniform vec4 u_Color;\n" + "uniform bool u_HasTexture;\n" + "uniform sampler2D u_Text;\n" + + "void main() {\n" + "if(u_HasTexture) {\n" + "o_Color = texture(u_Text, o_TextCoord) * u_Color;\n" + "} else {\n" + "o_Color = u_Color;" + "}\n" + "}\n" + ); + #elif DAWN_OPENGL_HLSL + this->compileShader( + { + { "aPos", 0 }, + { "aTexCoord", 1 } + }, + // Vertex Shader + "uniform float4x4 u_Proj;\n" + "uniform float4x4 u_View;\n" + "uniform float4x4 u_Model;\n" + "void main(" + "float3 aPos,\n" + "float2 aTexCoord,\n" + "float2 out o_TextCoord : TEXCOORD0,\n" + "float4 out gl_Position : POSITION\n" + ") {\n" + "o_TextCoord = aTexCoord;\n" + "gl_Position = mul(mul(mul(float4(aPos, 1.0), u_Model), u_View), u_Proj);\n" + "}", + + // Fragment Shader + "uniform float4 u_Color;\n" + "uniform bool u_HasTexture;\n" + "uniform sampler2D u_Text : TEXUNIT0;\n" + + "float4 main(\n" + "float2 o_TextCoord : TEXCOORD0\n" + ") {\n" + "float4 o_Color;\n" + "if(u_HasTexture) {\n" + "o_Color = mul(tex2D(u_Text, o_TextCoord), u_Color);\n" + "} else {\n" + "o_Color = u_Color;\n" + "}\n" + "return o_Color;\n" + "}\n" + ); + #else + #error Shader Type must be either GLSL or HLSL + #endif + + this->paramModel = this->getParameterByName("u_Model"); + this->paramColor = this->getParameterByName("u_Color"); + this->paramTexture = this->getParameterByName("u_Text"); + this->paramHasTexture = this->getParameterByName("u_HasTexture"); + + this->bufferRenderPipeline = this->getBufferLocationByName(RenderPipelineShaderBuffer::getShaderUniformName()); } \ No newline at end of file diff --git a/src/dawnopengl/display/shader/SimpleTexturedShader.hpp b/src/dawnopengl/display/shader/shaders/SimpleTexturedShader.hpp similarity index 81% rename from src/dawnopengl/display/shader/SimpleTexturedShader.hpp rename to src/dawnopengl/display/shader/shaders/SimpleTexturedShader.hpp index c8e6bd6c..8890c868 100644 --- a/src/dawnopengl/display/shader/SimpleTexturedShader.hpp +++ b/src/dawnopengl/display/shader/shaders/SimpleTexturedShader.hpp @@ -1,21 +1,24 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "display/shader/Shader.hpp" - -namespace Dawn { - class SimpleTexturedShader : public Shader { - public: - shaderparameter_t paramProjection; - shaderparameter_t paramView; - shaderparameter_t paramModel; - shaderparameter_t paramColor; - shaderparameter_t paramTexture; - shaderparameter_t paramHasTexture; - - void compile() override; - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "display/shader/buffers/RenderPipelineShaderBuffer.hpp" +#include "display/shader/Shader.hpp" + +namespace Dawn { + class SimpleTexturedShader : public Shader { + public: + shaderparameter_t paramProjection; + shaderparameter_t paramView; + + shaderparameter_t paramModel; + shaderparameter_t paramColor; + shaderparameter_t paramTexture; + shaderparameter_t paramHasTexture; + shaderbufferlocation_t bufferRenderPipeline; + + void compile() override; + }; } \ No newline at end of file diff --git a/src/dawnopengl/display/shader/UIShader.hpp b/src/dawnopengl/display/shader/shaders/UIShader.hpp similarity index 100% rename from src/dawnopengl/display/shader/UIShader.hpp rename to src/dawnopengl/display/shader/shaders/UIShader.hpp diff --git a/src/dawnopengl/scene/components/display/material/SimpleBillboardedMaterial.cpp b/src/dawnopengl/scene/components/display/material/SimpleBillboardedMaterial.cpp index 7fc102de..adadc25e 100644 --- a/src/dawnopengl/scene/components/display/material/SimpleBillboardedMaterial.cpp +++ b/src/dawnopengl/scene/components/display/material/SimpleBillboardedMaterial.cpp @@ -3,7 +3,7 @@ // This software is released under the MIT License. // https://opensource.org/licenses/MIT -#include "display/shader/SimpleBillboardedShader.hpp" +#include "display/shader/shaders/SimpleBillboardedShader.hpp" #include "SimpleBillboardedMaterial.hpp" #include "game/DawnGame.hpp" diff --git a/src/dawnopengl/scene/components/display/material/SimpleTexturedMaterial.cpp b/src/dawnopengl/scene/components/display/material/SimpleTexturedMaterial.cpp index c876f6ae..86f6f43d 100644 --- a/src/dawnopengl/scene/components/display/material/SimpleTexturedMaterial.cpp +++ b/src/dawnopengl/scene/components/display/material/SimpleTexturedMaterial.cpp @@ -36,8 +36,12 @@ std::vector SimpleTexturedMaterial::getRenderPasses() { onlyPass.shader = shader; onlyPass.colorValues[shader->paramColor] = this->color; onlyPass.matrixValues[shader->paramModel] = this->transform->getWorldTransform(); - onlyPass.matrixValues[shader->paramView] = camera->transform->getWorldTransform(); - onlyPass.matrixValues[shader->paramProjection] = camera->getProjection(); + + onlyPass.parameterBuffers[shader->bufferRenderPipeline] = &this->getGame()->renderManager.getRenderPipeline()->shaderBuffer; + + // onlyPass.matrixValues[shader->paramView] = camera->transform->getWorldTransform(); + // onlyPass.matrixValues[shader->paramProjection] = camera->getProjection(); + onlyPass.renderFlags = ( RENDER_MANAGER_RENDER_FLAG_BLEND | RENDER_MANAGER_RENDER_FLAG_DEPTH_TEST