From 58be5709a39e2865bdc3142958fa00fc3073d35d Mon Sep 17 00:00:00 2001 From: OusmBlueNinja <89956790+OusmBlueNinja@users.noreply.github.com> Date: Wed, 1 Jan 2025 13:39:45 -0600 Subject: [PATCH] Fixed Crashing --- src/Windows/InspectorWindow.cpp | 4 ++-- src/Windows/RenderWindow.cpp | 22 ++++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/Windows/InspectorWindow.cpp b/src/Windows/InspectorWindow.cpp index 4190bb4..a83d970 100644 --- a/src/Windows/InspectorWindow.cpp +++ b/src/Windows/InspectorWindow.cpp @@ -14,7 +14,7 @@ extern GameObject *g_SelectedObject; // Pointer to the currently selected object extern std::shared_ptr g_RuntimeCameraObject; #include "Engine/AssetManager.h" -extern AssetManager *g_AssetManager; +extern AssetManager g_AssetManager; extern LoggerWindow *g_LoggerWindow; void InspectorWindow::Show() @@ -428,7 +428,7 @@ void InspectorWindow::Show() mesh->MeshPath = buffer; } if (ImGui::Button("Reload Mesh")) { - std::shared_ptr model = g_AssetManager->loadAsset(AssetType::MODEL, mesh->MeshPath.c_str()); + std::shared_ptr model = g_AssetManager.loadAsset(AssetType::MODEL, mesh->MeshPath.c_str()); } diff --git a/src/Windows/RenderWindow.cpp b/src/Windows/RenderWindow.cpp index 68cea36..eb26ab6 100644 --- a/src/Windows/RenderWindow.cpp +++ b/src/Windows/RenderWindow.cpp @@ -94,14 +94,9 @@ bool PlayPauseButton(const char *label, bool *isPlaying, ImVec2 Size) return false; // No toggle occurred } - - - - - void RenderWindow::Show(bool *GameRunning) { - ImGui::Begin(ICON_FA_GAMEPAD " Editor##EditorWindow"); + ImGui::Begin(ICON_FA_GAMEPAD " Editor##EditorWindow"); if (!m_Initialized) { @@ -153,11 +148,6 @@ void RenderWindow::Show(bool *GameRunning) ImGui::End(); } - - - - - void RenderWindow::InitGLResources() { // ---------------------------------------------------- @@ -175,7 +165,6 @@ void RenderWindow::InitGLResources() m_ShaderPtr = shaderAsset.get(); } - // ---------------------------------------------------- // 3) Load TEXTURE from the asset manager // ---------------------------------------------------- @@ -223,6 +212,11 @@ void RenderWindow::RenderSceneToFBO(bool *GameRunning) m_FBO.Bind(); glViewport(0, 0, m_LastWidth, m_LastHeight); +#if TRANSPERANCY + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +#endif + glEnable(GL_DEPTH_TEST); glClearColor(0.f, 0.f, 0.f, 1.f); @@ -351,6 +345,10 @@ void RenderWindow::RenderSceneToFBO(bool *GameRunning) } // Cleanup: Unbind the shader program +#if TRANSPERANCY + + glDisable(GL_BLEND); +#endif glUseProgram(0); // Unbind the FBO