From 5a550880ffe9717c7a7afc4834782d43adfe39e3c6d7ab2eb9f22014fe251a3e Mon Sep 17 00:00:00 2001 From: Mexpert_PRO Date: Sun, 18 Jan 2026 00:47:11 +0100 Subject: [PATCH] small fixes to make it work with demo project --- .gitignore | 6 ------ TSE_Core/src/BehaviourScripts/Renderable.cpp | 16 +++++++++++++--- TSE_Core/src/elements/Layer.cpp | 2 +- TSE_Core/src/elements/Layer.hpp | 2 +- TSE_Core/src/elements/Texture.hpp | 2 +- TSE_Core/src/elements/Transformable.hpp | 2 +- TSE_Core/src/interfaces/IResizeNotifiable.hpp | 2 +- TSE_Core/src/interfaces/IWindow.hpp | 1 - .../src/OpenGLRenderingBackend.cpp | 7 ++++--- TSE_GlfwOpenGlImpl/src/TextureHelperOpenGL.cpp | 3 ++- TSE_GlfwOpenGlImpl/src/buffer/buffer.hpp | 1 + TSE_GlfwOpenGlImpl/src/shader/Shader.cpp | 3 ++- TSE_GlfwOpenGlImpl/src/shader/ShaderPart.cpp | 4 ++-- .../src/shader/basicParticleShader.hpp | 3 ++- TSE_GlfwOpenGlImpl/src/shader/basicShader.cpp | 3 ++- .../src/shader/basicTextureShader.cpp | 3 ++- .../src/shader/ditheringShader.cpp | 3 ++- 17 files changed, 37 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index 435961c..94f59fc 100644 --- a/.gitignore +++ b/.gitignore @@ -21,12 +21,6 @@ *.mod *.smod -# Compiled Static libraries -*.lai -*.la -*.a -*.lib - # Executables *.exe *.out diff --git a/TSE_Core/src/BehaviourScripts/Renderable.cpp b/TSE_Core/src/BehaviourScripts/Renderable.cpp index eb68237..2990046 100644 --- a/TSE_Core/src/BehaviourScripts/Renderable.cpp +++ b/TSE_Core/src/BehaviourScripts/Renderable.cpp @@ -2,6 +2,7 @@ #include #include "MeshContainer.hpp" +#include "RectBase.hpp" #include "elements/Transformable.hpp" namespace TSE @@ -24,8 +25,8 @@ namespace TSE Mesh* Renderable::GetMeshContainer() const { if(baseObject->HasBehaviourScript(MESH_CONTAINER)) return dynamic_cast(baseObject->GetBehaviourScript(MESH_CONTAINER))->GetMesh(); - // if(baseObject->HasBehaviourScript(RECT_BASE)) - // return dynamic_cast(baseObject->GetBehaviourScript(RECT_BASE))->GetMesh(); + if(baseObject->HasBehaviourScript(RECT_BASE)) + return dynamic_cast(baseObject->GetBehaviourScript(RECT_BASE))->GetMesh(); return nullptr; } @@ -38,5 +39,14 @@ namespace TSE auto* container = GetMeshContainer(); return container ? container->uvs.data() : nullptr; } + const std::vector Renderable::GetIndices() const + { + auto* container = GetMeshContainer(); + return container ? container->indecies : std::vector(); + } + size_t Renderable::GetVertexCount() const + { + auto* container = GetMeshContainer(); + return container ? container->VerteciesCount() : 0; + } } // namespace TSE - diff --git a/TSE_Core/src/elements/Layer.cpp b/TSE_Core/src/elements/Layer.cpp index 1a42474..58f8660 100644 --- a/TSE_Core/src/elements/Layer.cpp +++ b/TSE_Core/src/elements/Layer.cpp @@ -22,7 +22,7 @@ void HandleObject(TSE::Transformable* trans, TSE::TransformationStack& stack, TS } } -TSE::Layer::Layer(string &n) +TSE::Layer::Layer(const string &n) { name = n; } diff --git a/TSE_Core/src/elements/Layer.hpp b/TSE_Core/src/elements/Layer.hpp index 20d7c0e..7b59159 100644 --- a/TSE_Core/src/elements/Layer.hpp +++ b/TSE_Core/src/elements/Layer.hpp @@ -14,7 +14,7 @@ namespace TSE std::vector objectsToRender; public: - Layer(string& name); + Layer(const string& name); void Render(IRenderer& rnd) const; void AddTransformable(Transformable* t); diff --git a/TSE_Core/src/elements/Texture.hpp b/TSE_Core/src/elements/Texture.hpp index ee7aa89..6b29792 100644 --- a/TSE_Core/src/elements/Texture.hpp +++ b/TSE_Core/src/elements/Texture.hpp @@ -23,7 +23,7 @@ namespace TSE public: string name = "Unnamed"; - static ITextureHelper* helper; + inline static ITextureHelper* helper = nullptr; Texture(const string& path); Texture(const int& width, const int& height, int bpp = 32); diff --git a/TSE_Core/src/elements/Transformable.hpp b/TSE_Core/src/elements/Transformable.hpp index 02a6375..089eb5c 100644 --- a/TSE_Core/src/elements/Transformable.hpp +++ b/TSE_Core/src/elements/Transformable.hpp @@ -29,7 +29,7 @@ namespace TSE std::vector children; Transformable* parent = nullptr; - static std::unordered_map objectEntries; + inline static std::unordered_map objectEntries = {}; public: Transformable(); diff --git a/TSE_Core/src/interfaces/IResizeNotifiable.hpp b/TSE_Core/src/interfaces/IResizeNotifiable.hpp index ba9e3eb..b1c9f76 100644 --- a/TSE_Core/src/interfaces/IResizeNotifiable.hpp +++ b/TSE_Core/src/interfaces/IResizeNotifiable.hpp @@ -12,7 +12,7 @@ namespace TSE /// @param width the new width /// @param height the new height /// @param resizable the resizable that got changed - virtual void OnResize(float width, float height, IResizable* resizable); + virtual void OnResize(float width, float height, IResizable* resizable) = 0; virtual ~IResizeNotifiable() = default; }; } // namespace TSE diff --git a/TSE_Core/src/interfaces/IWindow.hpp b/TSE_Core/src/interfaces/IWindow.hpp index a662f2d..daca906 100644 --- a/TSE_Core/src/interfaces/IWindow.hpp +++ b/TSE_Core/src/interfaces/IWindow.hpp @@ -15,7 +15,6 @@ namespace TSE virtual bool Init() = 0; public: virtual void Clear() const = 0; - virtual void Update() const = 0; virtual void ClearDepthBuffer() const = 0; virtual bool ShouldClose() const = 0; diff --git a/TSE_GlfwOpenGlImpl/src/OpenGLRenderingBackend.cpp b/TSE_GlfwOpenGlImpl/src/OpenGLRenderingBackend.cpp index 542434c..577528e 100644 --- a/TSE_GlfwOpenGlImpl/src/OpenGLRenderingBackend.cpp +++ b/TSE_GlfwOpenGlImpl/src/OpenGLRenderingBackend.cpp @@ -1,7 +1,7 @@ -#include "OpenGLRenderingBackend.hpp" #include "GL/gl3w.h" -#include "GLFW/glfw3.h" #include "GL/gl.h" +#include "OpenGLRenderingBackend.hpp" +#include "GLFW/glfw3.h" #include "WindowGlfw.hpp" #include "Debug.hpp" #include "imgui/imgui.h" @@ -80,11 +80,12 @@ bool TSE::GLFW::OpenGLRenderingBackend::InitPostWindow() return true; } +std::string imguiIniPath; + bool TSE::GLFW::OpenGLRenderingBackend::InitEnd() { if(useseImGui) { - string imguiIniPath; GetAppDataPath(imguiIniPath); imguiIniPath += "/UI.cfg"; IMGUI_CHECKVERSION(); diff --git a/TSE_GlfwOpenGlImpl/src/TextureHelperOpenGL.cpp b/TSE_GlfwOpenGlImpl/src/TextureHelperOpenGL.cpp index 1a285ea..e26a0d7 100644 --- a/TSE_GlfwOpenGlImpl/src/TextureHelperOpenGL.cpp +++ b/TSE_GlfwOpenGlImpl/src/TextureHelperOpenGL.cpp @@ -1,5 +1,6 @@ +#include "GL/gl3w.h" +#include "GL/gl.h" #include "TextureHelperOpenGL.hpp" -#include void TSE::GLFW::TextureHelperOpenGL::Bind(const Texture *tex) { diff --git a/TSE_GlfwOpenGlImpl/src/buffer/buffer.hpp b/TSE_GlfwOpenGlImpl/src/buffer/buffer.hpp index aa33315..cf35f93 100644 --- a/TSE_GlfwOpenGlImpl/src/buffer/buffer.hpp +++ b/TSE_GlfwOpenGlImpl/src/buffer/buffer.hpp @@ -1,6 +1,7 @@ #pragma once #include "GL/gl3w.h" +#include "GL/gl.h" #include "Types.hpp" namespace TSE::GLFW diff --git a/TSE_GlfwOpenGlImpl/src/shader/Shader.cpp b/TSE_GlfwOpenGlImpl/src/shader/Shader.cpp index 0658666..aed5028 100644 --- a/TSE_GlfwOpenGlImpl/src/shader/Shader.cpp +++ b/TSE_GlfwOpenGlImpl/src/shader/Shader.cpp @@ -1,5 +1,6 @@ -#include "Shader.hpp" #include "GL/gl3w.h" +#include "GL/gl.h" +#include "Shader.hpp" #include "Debug.hpp" TSE::uint TSE::GLFW::Shader::activeProgramID = 0; diff --git a/TSE_GlfwOpenGlImpl/src/shader/ShaderPart.cpp b/TSE_GlfwOpenGlImpl/src/shader/ShaderPart.cpp index 74a2326..f23b3a2 100644 --- a/TSE_GlfwOpenGlImpl/src/shader/ShaderPart.cpp +++ b/TSE_GlfwOpenGlImpl/src/shader/ShaderPart.cpp @@ -1,7 +1,7 @@ -#include "ShaderPart.hpp" - #include "GL/gl3w.h" #include "GL/gl.h" +#include "ShaderPart.hpp" + #include "Debug.hpp" #include #include "PathHelper.hpp" diff --git a/TSE_GlfwOpenGlImpl/src/shader/basicParticleShader.hpp b/TSE_GlfwOpenGlImpl/src/shader/basicParticleShader.hpp index daf17ff..deb969e 100644 --- a/TSE_GlfwOpenGlImpl/src/shader/basicParticleShader.hpp +++ b/TSE_GlfwOpenGlImpl/src/shader/basicParticleShader.hpp @@ -1,8 +1,9 @@ #pragma once +#include "GL/gl3w.h" +#include "GL/gl.h" #include "Shader.hpp" #include "Types.hpp" -#include "GL/gl3w.h" namespace TSE::GLFW { diff --git a/TSE_GlfwOpenGlImpl/src/shader/basicShader.cpp b/TSE_GlfwOpenGlImpl/src/shader/basicShader.cpp index 1f975df..b89edac 100644 --- a/TSE_GlfwOpenGlImpl/src/shader/basicShader.cpp +++ b/TSE_GlfwOpenGlImpl/src/shader/basicShader.cpp @@ -1,6 +1,7 @@ +#include "GL/gl3w.h" +#include "GL/gl.h" #include "basicShader.hpp" -#include "GL/gl3w.h" #include "basicShaderGLSL.hpp" #include "BehaviourScripts/Renderable.hpp" #include "Color.hpp" diff --git a/TSE_GlfwOpenGlImpl/src/shader/basicTextureShader.cpp b/TSE_GlfwOpenGlImpl/src/shader/basicTextureShader.cpp index 1000798..4f41423 100644 --- a/TSE_GlfwOpenGlImpl/src/shader/basicTextureShader.cpp +++ b/TSE_GlfwOpenGlImpl/src/shader/basicTextureShader.cpp @@ -1,9 +1,10 @@ +#include "GL/gl3w.h" +#include "GL/gl.h" #include "basicTextureShader.hpp" #include "basicTextureShaderGLSL.hpp" #include "BehaviourScripts/Renderable.hpp" #include "Color.hpp" #include "interfaces/ITexture.hpp" -#include "GL/gl3w.h" #define SHADER_VERTEX_INDEX 0 #define SHADER_COLOR_INDEX 1 diff --git a/TSE_GlfwOpenGlImpl/src/shader/ditheringShader.cpp b/TSE_GlfwOpenGlImpl/src/shader/ditheringShader.cpp index c735764..4fc3aa5 100644 --- a/TSE_GlfwOpenGlImpl/src/shader/ditheringShader.cpp +++ b/TSE_GlfwOpenGlImpl/src/shader/ditheringShader.cpp @@ -1,8 +1,9 @@ +#include "GL/gl3w.h" +#include "GL/gl.h" #include "ditheringShader.hpp" #include "ditheringShaderGLSL.hpp" #include "BehaviourScripts/Renderable.hpp" #include "Color.hpp" -#include "GL/gl3w.h" #define SHADER_VERTEX_INDEX 0 #define SHADER_COLOR_INDEX 1