Fixed Crashing

This commit is contained in:
OusmBlueNinja 2025-01-01 13:39:45 -06:00
parent 195f7abbe0
commit 58be5709a3
2 changed files with 12 additions and 14 deletions

View File

@ -14,7 +14,7 @@ extern GameObject *g_SelectedObject; // Pointer to the currently selected object
extern std::shared_ptr<CameraComponent> 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> model = g_AssetManager->loadAsset<Model>(AssetType::MODEL, mesh->MeshPath.c_str());
std::shared_ptr<Model> model = g_AssetManager.loadAsset<Model>(AssetType::MODEL, mesh->MeshPath.c_str());
}

View File

@ -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