diff --git a/src/dawn/display/CMakeLists.txt b/src/dawn/display/CMakeLists.txt index aac2a745..7522759a 100644 --- a/src/dawn/display/CMakeLists.txt +++ b/src/dawn/display/CMakeLists.txt @@ -14,4 +14,5 @@ target_sources(${DAWN_TARGET_NAME} # Subdirs add_subdirectory(animation) add_subdirectory(font) -add_subdirectory(mesh) \ No newline at end of file +add_subdirectory(mesh) +add_subdirectory(shader) \ No newline at end of file diff --git a/src/dawn/display/RenderPipeline.cpp b/src/dawn/display/RenderPipeline.cpp index 18edc24c..9c0c3b1e 100644 --- a/src/dawn/display/RenderPipeline.cpp +++ b/src/dawn/display/RenderPipeline.cpp @@ -18,7 +18,7 @@ RenderPipeline::RenderPipeline(RenderManager *renderManager) { } void RenderPipeline::init() { - + this->renderManager->getShaderManager()->lockShader(); } void RenderPipeline::render() { @@ -160,7 +160,7 @@ void RenderPipeline::renderSceneCamera(Scene *scene, Camera *camera) { &lineMesh, &lineIndex, camera, - &this->renderManager->simpleShader + this->renderManager->getShaderManager()->getShader(this->simpleTexturedShaderLock) ); shaderPassItems.push_back(item); itDebugLine = scene->debugLines.erase(itDebugLine); @@ -262,5 +262,5 @@ void RenderPipeline::renderSceneCamera(Scene *scene, Camera *camera) { } RenderPipeline::~RenderPipeline() { - + this->renderManager->getShaderManager()->releaseShader(this->simpleTexturedShaderLock); } \ No newline at end of file diff --git a/src/dawn/display/RenderPipeline.hpp b/src/dawn/display/RenderPipeline.hpp index da1bcd64..a57d4acf 100644 --- a/src/dawn/display/RenderPipeline.hpp +++ b/src/dawn/display/RenderPipeline.hpp @@ -17,6 +17,7 @@ namespace Dawn { class RenderPipeline { private: int_fast16_t renderId = -1; + shaderlock_t simpleTexturedShaderLock; public: RenderManager *renderManager; diff --git a/src/dawn/display/_RenderManager.hpp b/src/dawn/display/_RenderManager.hpp index 7a903ded..e3a40b05 100644 --- a/src/dawn/display/_RenderManager.hpp +++ b/src/dawn/display/_RenderManager.hpp @@ -4,8 +4,8 @@ // https://opensource.org/licenses/MIT #pragma once -#include "RenderTarget.hpp" #include "util/flag.hpp" +#include "RenderTarget.hpp" #define RENDER_MANAGER_RENDER_FLAG_DEPTH_TEST FLAG_DEFINE(0) #define RENDER_MANAGER_RENDER_FLAG_BLEND FLAG_DEFINE(1) @@ -14,6 +14,7 @@ typedef flag_t renderflag_t; namespace Dawn { class DawnGame; class RenderPipeline; + class ShaderManager; class IRenderManager { protected: @@ -21,7 +22,6 @@ namespace Dawn { public: DawnGame *game; - RenderPipeline *renderPipeline; /** * Default constructor for a render manager instance. @@ -48,6 +48,13 @@ namespace Dawn { * @return Reference to the currently active main scene render pipeline. */ virtual RenderPipeline * getRenderPipeline() = 0; + + /** + * Returns the shader manager that this render manager uses. + * + * @return Reference to the shader manager. + */ + virtual ShaderManager * getShaderManager() = 0; /** * Sets the render flags for the render manager to use. diff --git a/src/dawn/display/shader/CMakeLists.txt b/src/dawn/display/shader/CMakeLists.txt new file mode 100644 index 00000000..5dab52fa --- /dev/null +++ b/src/dawn/display/shader/CMakeLists.txt @@ -0,0 +1,10 @@ +# 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 + ShaderManager.cpp +) \ No newline at end of file diff --git a/src/dawn/display/shader/Shader.hpp b/src/dawn/display/shader/Shader.hpp index f50c3048..9eac673a 100644 --- a/src/dawn/display/shader/Shader.hpp +++ b/src/dawn/display/shader/Shader.hpp @@ -38,6 +38,7 @@ namespace Dawn { class Shader { public: + int32_t shaderId = -1; int_fast16_t renderId = 0; /** diff --git a/src/dawn/display/shader/ShaderManager.cpp b/src/dawn/display/shader/ShaderManager.cpp new file mode 100644 index 00000000..33f92a0b --- /dev/null +++ b/src/dawn/display/shader/ShaderManager.cpp @@ -0,0 +1,20 @@ +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "ShaderManager.hpp" + +using namespace Dawn; + +ShaderManager::ShaderManager() { + this->nextLock = 0; +} + +ShaderManager::~ShaderManager() { + auto it = this->shaders.begin(); + while(it != this->shaders.end()) { + delete it->second; + ++it; + } +} \ No newline at end of file diff --git a/src/dawn/display/shader/ShaderManager.hpp b/src/dawn/display/shader/ShaderManager.hpp new file mode 100644 index 00000000..042c466d --- /dev/null +++ b/src/dawn/display/shader/ShaderManager.hpp @@ -0,0 +1,108 @@ +// 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 { + typedef int64_t shaderlock_t; + typedef int16_t shaderid_t; + + class ShaderManager { + private: + int32_t nextId; + shaderlock_t nextLock; + std::map shaders; + std::map shaderLocks; + std::map> shaderLocksByShader; + + /** + * Returns the shader id for the given shader type, or -1 if it is not + * loaded. + * + * @return The shader id for the shader, or -1 if it is not loaded. + */ + template + shaderid_t getShaderId() { + auto it = shaders.begin(); + while(it != shaders.end()) { + auto asT = dynamic_cast(it->second); + if(asT != nullptr) return asT->shaderId; + ++it; + } + return -1; + } + + public: + /** + * Creates a new shader manager. + */ + ShaderManager(); + + /** + * Locks a shader of the given type. If the shader is not already loaded, + * it will be loaded. If the shader is already loaded, it will be + * returned. + * + * @return The shader lock for the shader of the given type. + */ + template + shaderlock_t lockShader() { + auto shaderId = this->getShaderId(); + if(shaderId == -1) { + T* shader = new T(); + shader->compile(); + shader->shaderId = this->nextId++; + this->shaders[shader->shaderId] = shader; + shaderId = shader->shaderId; + } + + shaderlock_t lock = this->nextId++; + this->shaderLocks[lock] = shaderId; + this->shaderLocksByShader[shaderId].push_back(lock); + return lock; + } + + /** + * Returns the shader for the given lock. + * + * @param lock The shader lock. + * @return The shader for the given lock. + */ + template + T * getShader(shaderlock_t lock) { + auto shaderId = this->shaderLocks[lock]; + return (T*)this->shaders[shaderId]; + } + + /** + * Releases the shader for the given lock. This will unload any shader + * that is no longer in use. + * + * @param lock Lock to release. + */ + template + void releaseShader(shaderlock_t lock) { + auto shaderId = this->shaderLocks[lock]; + this->shaderLocks.erase(lock); + + auto& locks = this->shaderLocksByShader[shaderId]; + auto it = std::find(locks.begin(), locks.end(), lock); + if(it != locks.end()) locks.erase(it); + + if(locks.size() == 0) { + this->shaderLocksByShader.erase(shaderId); + auto shader = (T*)this->shaders[shaderId]; + delete shader; + this->shaders.erase(shaderId); + } + } + + /** + * Destroys the shader manager. + */ + ~ShaderManager(); + }; +} \ No newline at end of file diff --git a/src/dawn/display/shader/_ShaderProgram.hpp b/src/dawn/display/shader/_ShaderProgram.hpp index 1a87f2d5..d75d60a5 100644 --- a/src/dawn/display/shader/_ShaderProgram.hpp +++ b/src/dawn/display/shader/_ShaderProgram.hpp @@ -7,15 +7,6 @@ #include "display/Texture.hpp" namespace Dawn { - // class Material; - // enum ShaderParameterType { - // SHADER_PARAMETER_TYPE_MATRIX, - // SHADER_PARAMETER_TYPE_BOOLEAN, - // SHADER_PARAMETER_TYPE_COLOR, - // SHADER_PARAMETER_TYPE_VECTOR3, - // SHADER_PARAMETER_TYPE_TEXTURE, - // SHADER_PARAMETER_TYPE_FLOAT - // }; template class IShaderProgram { diff --git a/src/dawn/scene/Scene.hpp b/src/dawn/scene/Scene.hpp index ea8d9d65..5b91cab9 100644 --- a/src/dawn/scene/Scene.hpp +++ b/src/dawn/scene/Scene.hpp @@ -6,6 +6,7 @@ #pragma once #include "event/Event.hpp" #include "asset/Asset.hpp" +#include "display/shader/ShaderManager.hpp" #include "scene/debug/SceneDebugLine.hpp" #include "physics/ScenePhysicsManager.hpp" #include "state/StateEvent.hpp" diff --git a/src/dawn/scene/components/display/Material.hpp b/src/dawn/scene/components/display/Material.hpp index 14b75c97..988aadf6 100644 --- a/src/dawn/scene/components/display/Material.hpp +++ b/src/dawn/scene/components/display/Material.hpp @@ -5,7 +5,7 @@ #pragma once #include "scene/SceneItemComponent.hpp" -#include "display/shader/Shader.hpp" +#include "display/shader/ShaderManager.hpp" namespace Dawn { class Material : public SceneItemComponent { diff --git a/src/dawn/scene/components/ui/UIComponent.hpp b/src/dawn/scene/components/ui/UIComponent.hpp index a5047094..3848b51b 100644 --- a/src/dawn/scene/components/ui/UIComponent.hpp +++ b/src/dawn/scene/components/ui/UIComponent.hpp @@ -6,7 +6,6 @@ #pragma once #include "scene/SceneItemComponent.hpp" #include "UICanvas.hpp" -#include "display/shader/Shader.hpp" #include "util/mathutils.hpp" namespace Dawn { diff --git a/src/dawn/scene/components/ui/UIImage.cpp b/src/dawn/scene/components/ui/UIImage.cpp index 69228d48..fb582f64 100644 --- a/src/dawn/scene/components/ui/UIImage.cpp +++ b/src/dawn/scene/components/ui/UIImage.cpp @@ -29,7 +29,7 @@ std::vector UIImage::getPassItems( glm::mat4 proj, glm::mat4 view ) { struct ShaderPassItem item; - auto shader = &getGame()->renderManager.uiShaderProgram; + auto shader = &getGame()->renderManager.uiShader->program; item.shaderProgram = shader; item.colorValues[shader->paramColor] = this->color; item.matrixValues[shader->paramProjection] = proj; diff --git a/src/dawn/scene/components/ui/UILabel.cpp b/src/dawn/scene/components/ui/UILabel.cpp index 68580e10..5e41d7e0 100644 --- a/src/dawn/scene/components/ui/UILabel.cpp +++ b/src/dawn/scene/components/ui/UILabel.cpp @@ -63,7 +63,7 @@ std::vector UILabel::getPassItems( this->updateMesh(); struct ShaderPassItem item; - auto shader = &getGame()->renderManager.uiShaderProgram; + auto shader = &getGame()->renderManager.uiShader->program; item.shaderProgram = shader; item.colorValues[shader->paramColor] = textColor; item.matrixValues[shader->paramProjection] = proj; diff --git a/src/dawn/scene/debug/SceneDebugLine.hpp b/src/dawn/scene/debug/SceneDebugLine.hpp index fe874437..6c5f1a5b 100644 --- a/src/dawn/scene/debug/SceneDebugLine.hpp +++ b/src/dawn/scene/debug/SceneDebugLine.hpp @@ -6,7 +6,7 @@ #pragma once #include "display/Color.hpp" #include "display/mesh/Mesh.hpp" -#include "display/shader/Shader.hpp" +#include "display/shader/ShaderManager.hpp" #define SCENE_DEBUG_LINE_VERTICE_COUNT 2 #define SCENE_DEBUG_LINE_INDICE_COUNT 2 diff --git a/src/dawnopengl/display/RenderManager.cpp b/src/dawnopengl/display/RenderManager.cpp index d38fc59a..dbf4c45c 100644 --- a/src/dawnopengl/display/RenderManager.cpp +++ b/src/dawnopengl/display/RenderManager.cpp @@ -17,9 +17,14 @@ RenderManager::RenderManager(DawnGame *game) : } void RenderManager::init() { + // Lock the common shaders + this->lockSimpleTextured = this->shaderManager.lockShader(); + this->lockUIShaderProgram = this->shaderManager.lockShader(); + this->simpleTexturedShader = this->shaderManager.getShader(this->lockSimpleTextured); + this->uiShader = this->shaderManager.getShader(this->lockUIShaderProgram); + this->renderPipeline.init(); - this->simpleShader.compile(); - this->uiShaderProgram.compile(); + // Prepare the initial values glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -37,6 +42,10 @@ RenderPipeline * RenderManager::getRenderPipeline() { return &this->renderPipeline; } +ShaderManager * RenderManager::getShaderManager() { + return &this->shaderManager; +} + void RenderManager::setRenderFlags(renderflag_t flags) { this->renderFlags = flags; @@ -58,4 +67,6 @@ void RenderManager::update() { } RenderManager::~RenderManager() { + this->shaderManager.releaseShader(this->lockSimpleTextured); + this->shaderManager.releaseShader(this->lockUIShaderProgram); } \ No newline at end of file diff --git a/src/dawnopengl/display/RenderManager.hpp b/src/dawnopengl/display/RenderManager.hpp index a312a047..648442ae 100644 --- a/src/dawnopengl/display/RenderManager.hpp +++ b/src/dawnopengl/display/RenderManager.hpp @@ -6,6 +6,7 @@ #pragma once #include "display/_RenderManager.hpp" #include "display/BackBufferRenderTarget.hpp" +#include "display/shader/ShaderManager.hpp" #include "display/shader/SimpleTexturedShader.hpp" #include "display/shader/UIShaderProgram.hpp" #include "display/RenderPipeline.hpp" @@ -15,11 +16,14 @@ namespace Dawn { class RenderManager : public IRenderManager { private: RenderPipeline renderPipeline; + ShaderManager shaderManager; + shaderlock_t lockSimpleTextured = -1; + shaderlock_t lockUIShaderProgram = -1; public: BackBufferRenderTarget backBuffer; - SimpleTexturedShader simpleShader; - UIShaderProgram uiShaderProgram; + SimpleTexturedShader *simpleTexturedShader = nullptr; + SimpleTexturedShader *uiShader = nullptr; ExampleFont defaultFont; /** @@ -29,6 +33,7 @@ namespace Dawn { RenderTarget * getBackBuffer() override; RenderPipeline * getRenderPipeline() override; + ShaderManager * getShaderManager() override; void setRenderFlags(renderflag_t renderFlags) override; void init() override; void update() override; diff --git a/src/dawnopengl/display/shader/CMakeLists.txt b/src/dawnopengl/display/shader/CMakeLists.txt index 7e90d7bb..db17981e 100644 --- a/src/dawnopengl/display/shader/CMakeLists.txt +++ b/src/dawnopengl/display/shader/CMakeLists.txt @@ -8,4 +8,5 @@ target_sources(${DAWN_TARGET_NAME} PRIVATE ShaderProgram.cpp SimpleTexturedShader.cpp + SimpleBillboardedShader.cpp ) \ No newline at end of file diff --git a/src/dawnopengl/display/shader/SimpleBillboardedShader.cpp b/src/dawnopengl/display/shader/SimpleBillboardedShader.cpp index 92d343df..37da2400 100644 --- a/src/dawnopengl/display/shader/SimpleBillboardedShader.cpp +++ b/src/dawnopengl/display/shader/SimpleBillboardedShader.cpp @@ -4,6 +4,8 @@ // https://opensource.org/licenses/MIT #include "SimpleBillboardedShader.hpp" +#include "scene/components/display/mesh/MeshRenderer.hpp" +#include "scene/components/display/Camera.hpp" using namespace Dawn; @@ -25,9 +27,9 @@ void SimpleBillboardedShaderProgram::compile() { "out vec2 o_TextCoord;\n" "void main() {\n" - "vec3 camRight = vec3(view[0][0], view[1][0], view[2][0]);\n" - "vec3 camUp = vec3(view[0][1], view[1][1], view[2][1]);\n" - "vec3 billboardPos = view[3].xyz + position.x * camRight + position.y * camUp;\n" + "vec3 camRight = vec3(u_View[0][0], u_View[1][0], u_View[2][0]);\n" + "vec3 camUp = vec3(u_View[0][1], u_View[1][1], u_View[2][1]);\n" + "vec3 billboardPos = u_View[3].xyz + aPos.x * camRight + aPos.y * camUp;\n" "gl_Position = u_Proj * u_View * u_Model * vec4(billboardPos, 1.0);\n" "o_TextCoord = vec2(aTexCoord.x, aTexCoord.y);\n" "}", @@ -56,4 +58,43 @@ void SimpleBillboardedShaderProgram::compile() { this->paramColor = this->getParameterByName("u_Color"); this->paramTexture = this->getParameterByName("u_Text"); this->paramHasTexture = this->getParameterByName("u_HasTexture"); +} + + + +void SimpleBillboardedShader::compile() { + this->program.compile(); +} + +std::vector SimpleBillboardedShader::getPassItems( + Mesh *mesh, + Material *material, + Camera *camera +) { + auto simpleMaterial = dynamic_cast(material); + assertNotNull(simpleMaterial); + + struct ShaderPassItem onlyPass; + onlyPass.mesh = mesh; + onlyPass.shaderProgram = &program; + onlyPass.colorValues[program.paramColor] = simpleMaterial->color; + onlyPass.matrixValues[program.paramModel] = material->transform->getWorldTransform(); + onlyPass.matrixValues[program.paramView] = camera->transform->getWorldTransform(); + onlyPass.matrixValues[program.paramProjection] = camera->getProjection(); + onlyPass.renderFlags = ( + RENDER_MANAGER_RENDER_FLAG_BLEND | + RENDER_MANAGER_RENDER_FLAG_DEPTH_TEST + ); + + if(simpleMaterial->texture != nullptr) { + onlyPass.boolValues[program.paramHasTexture] = true; + onlyPass.textureSlots[0] = simpleMaterial->texture; + onlyPass.textureValues[program.paramTexture] = 0; + } else { + onlyPass.boolValues[program.paramHasTexture] = false; + } + + std::vector passes; + passes.push_back(onlyPass); + return passes; } \ No newline at end of file diff --git a/src/dawnopengl/display/shader/SimpleBillboardedShader.hpp b/src/dawnopengl/display/shader/SimpleBillboardedShader.hpp index ef041323..6c21c398 100644 --- a/src/dawnopengl/display/shader/SimpleBillboardedShader.hpp +++ b/src/dawnopengl/display/shader/SimpleBillboardedShader.hpp @@ -4,10 +4,10 @@ // https://opensource.org/licenses/MIT #pragma once -#include "display/shader/Shader.hpp" +#include "scene/components/display/material/SimpleBillboardedMaterial.hpp" namespace Dawn { - class SimpleBillboardedShader : public ShaderProgram { + class SimpleBillboardedShaderProgram : public ShaderProgram { public: shaderparameter_t paramProjection; shaderparameter_t paramView; diff --git a/src/dawnopengl/display/shader/SimpleTexturedShader.hpp b/src/dawnopengl/display/shader/SimpleTexturedShader.hpp index 055b2c75..c6e90f5c 100644 --- a/src/dawnopengl/display/shader/SimpleTexturedShader.hpp +++ b/src/dawnopengl/display/shader/SimpleTexturedShader.hpp @@ -4,7 +4,7 @@ // https://opensource.org/licenses/MIT #pragma once -#include "display/shader/Shader.hpp" +#include "display/shader/ShaderManager.hpp" #include "scene/components/display/material/SimpleTexturedMaterial.hpp" namespace Dawn { diff --git a/src/dawnopengl/scene/components/display/material/CMakeLists.txt b/src/dawnopengl/scene/components/display/material/CMakeLists.txt index 97005fae..3f24400d 100644 --- a/src/dawnopengl/scene/components/display/material/CMakeLists.txt +++ b/src/dawnopengl/scene/components/display/material/CMakeLists.txt @@ -7,4 +7,5 @@ target_sources(${DAWN_TARGET_NAME} PRIVATE SimpleTexturedMaterial.cpp + SimpleBillboardedMaterial.cpp ) \ No newline at end of file diff --git a/src/dawnopengl/scene/components/display/material/SimpleBillboardedMaterial.cpp b/src/dawnopengl/scene/components/display/material/SimpleBillboardedMaterial.cpp new file mode 100644 index 00000000..401470c1 --- /dev/null +++ b/src/dawnopengl/scene/components/display/material/SimpleBillboardedMaterial.cpp @@ -0,0 +1,27 @@ +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "display/shader/SimpleBillboardedShader.hpp" +#include "SimpleBillboardedMaterial.hpp" +#include "game/DawnGame.hpp" + +using namespace Dawn; + +SimpleBillboardedMaterial::SimpleBillboardedMaterial(SceneItem *i) : + Material(i) +{ +} + +void SimpleBillboardedMaterial::onStart() { + this->shaderLock = this->getGame()->renderManager.getShaderManager()->lockShader(); +} + +void SimpleBillboardedMaterial::onDispose() { + this->getGame()->renderManager.getShaderManager()->releaseShader(this->shaderLock); +} + +Shader * SimpleBillboardedMaterial::getShader() { + return this->getGame()->renderManager.getShaderManager()->getShader(this->shaderLock); +} \ No newline at end of file diff --git a/src/dawnopengl/scene/components/display/material/SimpleBillboardedMaterial.hpp b/src/dawnopengl/scene/components/display/material/SimpleBillboardedMaterial.hpp new file mode 100644 index 00000000..66757465 --- /dev/null +++ b/src/dawnopengl/scene/components/display/material/SimpleBillboardedMaterial.hpp @@ -0,0 +1,32 @@ +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "scene/components/display/Material.hpp" + +namespace Dawn { + class SimpleBillboardedMaterial : public Material { + private: + shaderlock_t shaderLock = -1; + + public: + // @optional + Texture *texture = nullptr; + // @optional + struct Color color = COLOR_WHITE; + + /** + * SimpleBillboardMaterial scene item component interface. + * + * @param i Scene Item this interface belongs to. + */ + SimpleBillboardedMaterial(SceneItem *i); + + void onStart() override; + void onDispose() override; + + Shader * getShader() override; + }; +} \ No newline at end of file diff --git a/src/dawnopengl/scene/components/display/material/SimpleTexturedMaterial.cpp b/src/dawnopengl/scene/components/display/material/SimpleTexturedMaterial.cpp index e55b83b0..eee92a0b 100644 --- a/src/dawnopengl/scene/components/display/material/SimpleTexturedMaterial.cpp +++ b/src/dawnopengl/scene/components/display/material/SimpleTexturedMaterial.cpp @@ -13,6 +13,14 @@ SimpleTexturedMaterial::SimpleTexturedMaterial(SceneItem *i) : { } +void SimpleTexturedMaterial::onStart() { + this->shaderLock = this->getGame()->renderManager.getShaderManager()->lockShader(); +} + +void SimpleTexturedMaterial::onDispose() { + this->getGame()->renderManager.getShaderManager()->releaseShader(this->shaderLock); +} + Shader * SimpleTexturedMaterial::getShader() { - return &this->getGame()->renderManager.simpleShader; + return this->getGame()->renderManager.getShaderManager()->getShader(this->shaderLock); } \ No newline at end of file diff --git a/src/dawnopengl/scene/components/display/material/SimpleTexturedMaterial.hpp b/src/dawnopengl/scene/components/display/material/SimpleTexturedMaterial.hpp index ec29eb36..86acfa8a 100644 --- a/src/dawnopengl/scene/components/display/material/SimpleTexturedMaterial.hpp +++ b/src/dawnopengl/scene/components/display/material/SimpleTexturedMaterial.hpp @@ -8,6 +8,9 @@ namespace Dawn { class SimpleTexturedMaterial : public Material { + private: + shaderlock_t shaderLock = -1; + public: // @optional Texture *texture = nullptr; @@ -20,6 +23,9 @@ namespace Dawn { * @param i Scene Item this interface belongs to. */ SimpleTexturedMaterial(SceneItem *i); + + void onStart() override; + void onDispose() override; Shader * getShader() override; };