small fixes to make it work with demo project

This commit is contained in:
2026-01-18 00:47:11 +01:00
parent 8ca2e4942f
commit 5a550880ff
17 changed files with 37 additions and 26 deletions

6
.gitignore vendored
View File

@@ -21,12 +21,6 @@
*.mod *.mod
*.smod *.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables # Executables
*.exe *.exe
*.out *.out

View File

@@ -2,6 +2,7 @@
#include <typeinfo> #include <typeinfo>
#include "MeshContainer.hpp" #include "MeshContainer.hpp"
#include "RectBase.hpp"
#include "elements/Transformable.hpp" #include "elements/Transformable.hpp"
namespace TSE namespace TSE
@@ -24,8 +25,8 @@ namespace TSE
Mesh* Renderable::GetMeshContainer() const { Mesh* Renderable::GetMeshContainer() const {
if(baseObject->HasBehaviourScript(MESH_CONTAINER)) if(baseObject->HasBehaviourScript(MESH_CONTAINER))
return dynamic_cast<MeshContainer*>(baseObject->GetBehaviourScript(MESH_CONTAINER))->GetMesh(); return dynamic_cast<MeshContainer*>(baseObject->GetBehaviourScript(MESH_CONTAINER))->GetMesh();
// if(baseObject->HasBehaviourScript(RECT_BASE)) if(baseObject->HasBehaviourScript(RECT_BASE))
// return dynamic_cast<RectBase*>(baseObject->GetBehaviourScript(RECT_BASE))->GetMesh(); return dynamic_cast<RectBase*>(baseObject->GetBehaviourScript(RECT_BASE))->GetMesh();
return nullptr; return nullptr;
} }
@@ -38,5 +39,14 @@ namespace TSE
auto* container = GetMeshContainer(); auto* container = GetMeshContainer();
return container ? container->uvs.data() : nullptr; return container ? container->uvs.data() : nullptr;
} }
const std::vector<ushort> Renderable::GetIndices() const
{
auto* container = GetMeshContainer();
return container ? container->indecies : std::vector<unsigned short>();
}
size_t Renderable::GetVertexCount() const
{
auto* container = GetMeshContainer();
return container ? container->VerteciesCount() : 0;
}
} // namespace TSE } // namespace TSE

View File

@@ -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; name = n;
} }

View File

@@ -14,7 +14,7 @@ namespace TSE
std::vector<Transformable*> objectsToRender; std::vector<Transformable*> objectsToRender;
public: public:
Layer(string& name); Layer(const string& name);
void Render(IRenderer& rnd) const; void Render(IRenderer& rnd) const;
void AddTransformable(Transformable* t); void AddTransformable(Transformable* t);

View File

@@ -23,7 +23,7 @@ namespace TSE
public: public:
string name = "Unnamed"; string name = "Unnamed";
static ITextureHelper* helper; inline static ITextureHelper* helper = nullptr;
Texture(const string& path); Texture(const string& path);
Texture(const int& width, const int& height, int bpp = 32); Texture(const int& width, const int& height, int bpp = 32);

View File

@@ -29,7 +29,7 @@ namespace TSE
std::vector<Transformable*> children; std::vector<Transformable*> children;
Transformable* parent = nullptr; Transformable* parent = nullptr;
static std::unordered_map<uuids::uuid, Transformable*> objectEntries; inline static std::unordered_map<uuids::uuid, Transformable*> objectEntries = {};
public: public:
Transformable(); Transformable();

View File

@@ -12,7 +12,7 @@ namespace TSE
/// @param width the new width /// @param width the new width
/// @param height the new height /// @param height the new height
/// @param resizable the resizable that got changed /// @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; virtual ~IResizeNotifiable() = default;
}; };
} // namespace TSE } // namespace TSE

View File

@@ -15,7 +15,6 @@ namespace TSE
virtual bool Init() = 0; virtual bool Init() = 0;
public: public:
virtual void Clear() const = 0; virtual void Clear() const = 0;
virtual void Update() const = 0;
virtual void ClearDepthBuffer() const = 0; virtual void ClearDepthBuffer() const = 0;
virtual bool ShouldClose() const = 0; virtual bool ShouldClose() const = 0;

View File

@@ -1,7 +1,7 @@
#include "OpenGLRenderingBackend.hpp"
#include "GL/gl3w.h" #include "GL/gl3w.h"
#include "GLFW/glfw3.h"
#include "GL/gl.h" #include "GL/gl.h"
#include "OpenGLRenderingBackend.hpp"
#include "GLFW/glfw3.h"
#include "WindowGlfw.hpp" #include "WindowGlfw.hpp"
#include "Debug.hpp" #include "Debug.hpp"
#include "imgui/imgui.h" #include "imgui/imgui.h"
@@ -80,11 +80,12 @@ bool TSE::GLFW::OpenGLRenderingBackend::InitPostWindow()
return true; return true;
} }
std::string imguiIniPath;
bool TSE::GLFW::OpenGLRenderingBackend::InitEnd() bool TSE::GLFW::OpenGLRenderingBackend::InitEnd()
{ {
if(useseImGui) if(useseImGui)
{ {
string imguiIniPath;
GetAppDataPath(imguiIniPath); GetAppDataPath(imguiIniPath);
imguiIniPath += "/UI.cfg"; imguiIniPath += "/UI.cfg";
IMGUI_CHECKVERSION(); IMGUI_CHECKVERSION();

View File

@@ -1,5 +1,6 @@
#include "GL/gl3w.h"
#include "GL/gl.h"
#include "TextureHelperOpenGL.hpp" #include "TextureHelperOpenGL.hpp"
#include <GL/gl3w.h>
void TSE::GLFW::TextureHelperOpenGL::Bind(const Texture *tex) void TSE::GLFW::TextureHelperOpenGL::Bind(const Texture *tex)
{ {

View File

@@ -1,6 +1,7 @@
#pragma once #pragma once
#include "GL/gl3w.h" #include "GL/gl3w.h"
#include "GL/gl.h"
#include "Types.hpp" #include "Types.hpp"
namespace TSE::GLFW namespace TSE::GLFW

View File

@@ -1,5 +1,6 @@
#include "Shader.hpp"
#include "GL/gl3w.h" #include "GL/gl3w.h"
#include "GL/gl.h"
#include "Shader.hpp"
#include "Debug.hpp" #include "Debug.hpp"
TSE::uint TSE::GLFW::Shader::activeProgramID = 0; TSE::uint TSE::GLFW::Shader::activeProgramID = 0;

View File

@@ -1,7 +1,7 @@
#include "ShaderPart.hpp"
#include "GL/gl3w.h" #include "GL/gl3w.h"
#include "GL/gl.h" #include "GL/gl.h"
#include "ShaderPart.hpp"
#include "Debug.hpp" #include "Debug.hpp"
#include <fstream> #include <fstream>
#include "PathHelper.hpp" #include "PathHelper.hpp"

View File

@@ -1,8 +1,9 @@
#pragma once #pragma once
#include "GL/gl3w.h"
#include "GL/gl.h"
#include "Shader.hpp" #include "Shader.hpp"
#include "Types.hpp" #include "Types.hpp"
#include "GL/gl3w.h"
namespace TSE::GLFW namespace TSE::GLFW
{ {

View File

@@ -1,6 +1,7 @@
#include "GL/gl3w.h"
#include "GL/gl.h"
#include "basicShader.hpp" #include "basicShader.hpp"
#include "GL/gl3w.h"
#include "basicShaderGLSL.hpp" #include "basicShaderGLSL.hpp"
#include "BehaviourScripts/Renderable.hpp" #include "BehaviourScripts/Renderable.hpp"
#include "Color.hpp" #include "Color.hpp"

View File

@@ -1,9 +1,10 @@
#include "GL/gl3w.h"
#include "GL/gl.h"
#include "basicTextureShader.hpp" #include "basicTextureShader.hpp"
#include "basicTextureShaderGLSL.hpp" #include "basicTextureShaderGLSL.hpp"
#include "BehaviourScripts/Renderable.hpp" #include "BehaviourScripts/Renderable.hpp"
#include "Color.hpp" #include "Color.hpp"
#include "interfaces/ITexture.hpp" #include "interfaces/ITexture.hpp"
#include "GL/gl3w.h"
#define SHADER_VERTEX_INDEX 0 #define SHADER_VERTEX_INDEX 0
#define SHADER_COLOR_INDEX 1 #define SHADER_COLOR_INDEX 1

View File

@@ -1,8 +1,9 @@
#include "GL/gl3w.h"
#include "GL/gl.h"
#include "ditheringShader.hpp" #include "ditheringShader.hpp"
#include "ditheringShaderGLSL.hpp" #include "ditheringShaderGLSL.hpp"
#include "BehaviourScripts/Renderable.hpp" #include "BehaviourScripts/Renderable.hpp"
#include "Color.hpp" #include "Color.hpp"
#include "GL/gl3w.h"
#define SHADER_VERTEX_INDEX 0 #define SHADER_VERTEX_INDEX 0
#define SHADER_COLOR_INDEX 1 #define SHADER_COLOR_INDEX 1