mirror of
https://github.com/antopilo/Nuake.git
synced 2026-01-03 14:09:46 +03:00
Better gizmo drawing
This commit is contained in:
@@ -144,10 +144,11 @@ int ApplicationMain(int argc, char* argv[])
|
||||
}
|
||||
|
||||
// Start application main loop
|
||||
GizmoDrawer gizmoDrawer = GizmoDrawer();
|
||||
GizmoDrawer gizmoDrawer = GizmoDrawer(&editor);
|
||||
while (!window->ShouldClose())
|
||||
{
|
||||
Nuake::Engine::Tick(); // Update
|
||||
|
||||
Nuake::Engine::Draw(); // Render
|
||||
|
||||
// Render editor
|
||||
@@ -155,15 +156,22 @@ int ApplicationMain(int argc, char* argv[])
|
||||
glViewport(0, 0, WindowSize.x, WindowSize.y);
|
||||
Nuake::Renderer2D::BeginDraw(WindowSize);
|
||||
|
||||
// Draw gizmos
|
||||
auto sceneFramebuffer = window->GetFrameBuffer();
|
||||
|
||||
Ref<Nuake::Scene> currentScene = Nuake::Engine::GetCurrentScene();
|
||||
|
||||
// Draw gizmos
|
||||
sceneFramebuffer->Bind();
|
||||
{
|
||||
Ref<Nuake::Scene> currentScene = Nuake::Engine::GetCurrentScene();
|
||||
//glDepthMask(false);
|
||||
|
||||
|
||||
Ref<EditorCamera> camera;
|
||||
if (currentScene)
|
||||
{
|
||||
{
|
||||
camera = currentScene->m_EditorCamera;
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, currentScene->m_SceneRenderer->GetGBuffer().GetTexture(GL_DEPTH_ATTACHMENT)->GetID(), 0);
|
||||
//glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, currentScene->m_SceneRenderer->GetGBuffer().GetTexture(GL_COLOR_ATTACHMENT3)->GetID(), 0);
|
||||
}
|
||||
|
||||
if (currentScene && !Nuake::Engine::IsPlayMode())
|
||||
@@ -177,20 +185,26 @@ int ApplicationMain(int argc, char* argv[])
|
||||
|
||||
if (editor.ShouldDrawCollision())
|
||||
{
|
||||
gizmoDrawer.DrawGizmos(currentScene);
|
||||
gizmoDrawer.DrawGizmos(currentScene, false);
|
||||
glDepthFunc(GL_GREATER);
|
||||
|
||||
gizmoDrawer.DrawGizmos(currentScene, true);
|
||||
glDepthFunc(GL_LESS);
|
||||
}
|
||||
}
|
||||
//glDepthMask(true);
|
||||
|
||||
|
||||
}
|
||||
sceneFramebuffer->Unbind();
|
||||
|
||||
// Update & Draw editor
|
||||
editor.Update(Nuake::Engine::GetTimestep());
|
||||
editor.Draw();
|
||||
|
||||
// Update & Draw editor
|
||||
editor.Draw();
|
||||
editor.Update(Nuake::Engine::GetTimestep());
|
||||
Nuake::Engine::EndDraw();
|
||||
}
|
||||
|
||||
// Shutdown
|
||||
Nuake::Engine::Close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1446,6 +1446,10 @@ namespace Nuake {
|
||||
{
|
||||
Engine::GetCurrentScene()->CreateEntity("Sprite").AddComponent<SpriteComponent>();
|
||||
}
|
||||
if (ImGui::MenuItem("Particle Emitter"))
|
||||
{
|
||||
Engine::GetCurrentScene()->CreateEntity("Particle Emitter").AddComponent<ParticleEmitterComponent>();
|
||||
}
|
||||
if (ImGui::MenuItem("Light"))
|
||||
{
|
||||
Engine::GetCurrentScene()->CreateEntity("Light").AddComponent<LightComponent>();
|
||||
@@ -1523,8 +1527,8 @@ namespace Nuake {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 8, 4 });
|
||||
if (ImGui::BeginTable("entity_table", 3, ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_NoPadInnerX | ImGuiTableFlags_NoPadOuterX))
|
||||
{
|
||||
ImGui::TableSetupColumn("Label", ImGuiTableColumnFlags_IndentEnable);
|
||||
ImGui::TableSetupColumn("Type", ImGuiTableColumnFlags_IndentEnable);
|
||||
ImGui::TableSetupColumn("Label", ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_WidthStretch);
|
||||
ImGui::TableSetupColumn("Type", ImGuiTableColumnFlags_IndentDisable | ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("Visibility", ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_IndentDisable | ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableHeadersRow();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user