Compare commits
2 Commits
f7f5ffa4e4
...
58be5709a3
Author | SHA1 | Date | |
---|---|---|---|
|
58be5709a3 | ||
|
195f7abbe0 |
@ -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());
|
||||
|
||||
}
|
||||
|
||||
|
@ -33,157 +33,6 @@ extern std::shared_ptr<CameraComponent> g_RuntimeCameraObject;
|
||||
|
||||
extern int g_GPU_Triangles_drawn_to_screen;
|
||||
|
||||
// Example cube data (position + UVs)
|
||||
static float g_CubeVertices[] =
|
||||
{
|
||||
// FRONT (z=+1)
|
||||
-1.f,
|
||||
-1.f,
|
||||
1.f,
|
||||
0.f,
|
||||
0.f,
|
||||
1.f,
|
||||
-1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
0.f,
|
||||
1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
-1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
0.f,
|
||||
1.f,
|
||||
|
||||
// BACK (z=-1)
|
||||
-1.f,
|
||||
-1.f,
|
||||
-1.f,
|
||||
1.f,
|
||||
0.f,
|
||||
1.f,
|
||||
-1.f,
|
||||
-1.f,
|
||||
0.f,
|
||||
0.f,
|
||||
1.f,
|
||||
1.f,
|
||||
-1.f,
|
||||
0.f,
|
||||
1.f,
|
||||
-1.f,
|
||||
1.f,
|
||||
-1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
|
||||
// LEFT (x=-1)
|
||||
-1.f,
|
||||
-1.f,
|
||||
-1.f,
|
||||
0.f,
|
||||
0.f,
|
||||
-1.f,
|
||||
-1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
0.f,
|
||||
-1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
-1.f,
|
||||
1.f,
|
||||
-1.f,
|
||||
0.f,
|
||||
1.f,
|
||||
|
||||
// RIGHT (x=+1)
|
||||
1.f,
|
||||
-1.f,
|
||||
-1.f,
|
||||
1.f,
|
||||
0.f,
|
||||
1.f,
|
||||
-1.f,
|
||||
1.f,
|
||||
0.f,
|
||||
0.f,
|
||||
1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
0.f,
|
||||
1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
-1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
|
||||
// TOP (y=+1)
|
||||
-1.f,
|
||||
1.f,
|
||||
-1.f,
|
||||
0.f,
|
||||
0.f,
|
||||
1.f,
|
||||
1.f,
|
||||
-1.f,
|
||||
1.f,
|
||||
0.f,
|
||||
1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
-1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
0.f,
|
||||
1.f,
|
||||
|
||||
// BOTTOM (y=-1)
|
||||
-1.f,
|
||||
-1.f,
|
||||
-1.f,
|
||||
1.f,
|
||||
0.f,
|
||||
1.f,
|
||||
-1.f,
|
||||
-1.f,
|
||||
0.f,
|
||||
0.f,
|
||||
1.f,
|
||||
-1.f,
|
||||
1.f,
|
||||
0.f,
|
||||
1.f,
|
||||
-1.f,
|
||||
-1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
};
|
||||
|
||||
static unsigned int g_CubeIndices[] =
|
||||
{
|
||||
// Front
|
||||
0, 1, 2, 2, 3, 0,
|
||||
// Back
|
||||
4, 5, 6, 6, 7, 4,
|
||||
// Left
|
||||
8, 9, 10, 10, 11, 8,
|
||||
// Right
|
||||
12, 13, 14, 14, 15, 12,
|
||||
// Top
|
||||
16, 17, 18, 18, 19, 16,
|
||||
// Bottom
|
||||
20, 21, 22, 22, 23, 20};
|
||||
|
||||
bool PlayPauseButton(const char *label, bool *isPlaying, ImVec2 Size)
|
||||
{
|
||||
// Define button size
|
||||
@ -245,11 +94,6 @@ 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");
|
||||
@ -304,11 +148,6 @@ void RenderWindow::Show(bool *GameRunning)
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void RenderWindow::InitGLResources()
|
||||
{
|
||||
// ----------------------------------------------------
|
||||
@ -326,31 +165,6 @@ void RenderWindow::InitGLResources()
|
||||
m_ShaderPtr = shaderAsset.get();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------
|
||||
// 2) Create VAO/VBO/EBO for the cube
|
||||
// ----------------------------------------------------
|
||||
glGenVertexArrays(1, &m_VAO);
|
||||
glBindVertexArray(m_VAO);
|
||||
|
||||
glGenBuffers(1, &m_VBO);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_VBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(g_CubeVertices), g_CubeVertices, GL_STATIC_DRAW);
|
||||
|
||||
glGenBuffers(1, &m_EBO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_EBO);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(g_CubeIndices), g_CubeIndices, GL_STATIC_DRAW);
|
||||
|
||||
// Position = location 0, UV = location 1
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE,
|
||||
5 * sizeof(float), (void *)0);
|
||||
glEnableVertexAttribArray(0);
|
||||
|
||||
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE,
|
||||
5 * sizeof(float), (void *)(3 * sizeof(float)));
|
||||
glEnableVertexAttribArray(1);
|
||||
|
||||
glBindVertexArray(0);
|
||||
|
||||
// ----------------------------------------------------
|
||||
// 3) Load TEXTURE from the asset manager
|
||||
// ----------------------------------------------------
|
||||
@ -398,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);
|
||||
@ -526,6 +345,10 @@ void RenderWindow::RenderSceneToFBO(bool *GameRunning)
|
||||
}
|
||||
|
||||
// Cleanup: Unbind the shader program
|
||||
#if TRANSPERANCY
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
#endif
|
||||
glUseProgram(0);
|
||||
|
||||
// Unbind the FBO
|
||||
|
Loading…
Reference in New Issue
Block a user