diff --git a/Editor/src/Windows/EditorInterface.cpp b/Editor/src/Windows/EditorInterface.cpp index 46d4e009..591493c9 100644 --- a/Editor/src/Windows/EditorInterface.cpp +++ b/Editor/src/Windows/EditorInterface.cpp @@ -370,7 +370,7 @@ namespace Nuake { m_IsViewportFocused = ImGui::IsWindowFocused(); - if (ImGui::GetIO().WantCaptureMouse && m_IsHoveringViewport && Input::IsMouseButtonPressed(GLFW_MOUSE_BUTTON_1) && !ImGuizmo::IsUsing() && m_IsViewportFocused) + if (!Engine::IsPlayMode() && ImGui::GetIO().WantCaptureMouse && m_IsHoveringViewport && Input::IsMouseButtonPressed(GLFW_MOUSE_BUTTON_1) && !ImGuizmo::IsUsing() && m_IsViewportFocused) { const auto windowPosNuake = Vector2(windowPos.x, windowPos.y); diff --git a/Editor/src/Windows/EditorSelectionPanel.cpp b/Editor/src/Windows/EditorSelectionPanel.cpp index ce15b92e..7856d7e1 100644 --- a/Editor/src/Windows/EditorSelectionPanel.cpp +++ b/Editor/src/Windows/EditorSelectionPanel.cpp @@ -170,6 +170,8 @@ void EditorSelectionPanel::DrawAddComponentMenu(Nuake::Entity entity) MenuItemComponent("Quake map", QuakeMapComponent); ImGui::Separator(); MenuItemComponent("Audio Emitter", AudioEmitterComponent); + ImGui::Separator(); + MenuItemComponent("Path", AudioEmitterComponent); ImGui::EndPopup(); } ImGui::Separator(); diff --git a/Nuake/Engine.cpp b/Nuake/Engine.cpp index f323daf7..2cbe34a5 100644 --- a/Nuake/Engine.cpp +++ b/Nuake/Engine.cpp @@ -6,7 +6,7 @@ #include "src/Core/FileSystem.h" #include "src/Scripting/ScriptingEngine.h" #include "src/Audio/AudioManager.h" - +#include "src/Threading/JobSystem.h" #include "src/Rendering/Renderer.h" #include "src/Rendering/Renderer2D.h" @@ -41,6 +41,8 @@ namespace Nuake void Engine::Tick() { + JobSystem::Get().Update(); + s_Time = static_cast(glfwGetTime()); s_TimeStep = s_Time - s_LastFrameTime; s_LastFrameTime = s_Time; diff --git a/Nuake/src/Resource/StaticResources.cpp b/Nuake/src/Resource/StaticResources.cpp index 92cb0f02..7da9197f 100644 --- a/Nuake/src/Resource/StaticResources.cpp +++ b/Nuake/src/Resource/StaticResources.cpp @@ -235391,66 +235391,85 @@ const std::string Resources_Shaders_outline_shader_path = R"(Resources/Shaders/o 0x61, 0x74, 0x20, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x20, 0x3d, 0x20, 0x34, 0x2e, 0x66, 0x3b, 0x0d, 0x0a, 0x09, 0x76, 0x65, 0x63, 0x32, 0x20, 0x75, 0x76, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x55, 0x56, 0x3b, 0x0d, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, - 0x20, 0x43, 0x6f, 0x72, 0x72, 0x65, 0x63, 0x74, 0x20, 0x61, 0x73, 0x70, - 0x65, 0x63, 0x74, 0x20, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x0d, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x61, 0x73, 0x70, 0x65, - 0x63, 0x74, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x20, 0x2f, 0x20, 0x76, - 0x65, 0x63, 0x32, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x53, - 0x69, 0x7a, 0x65, 0x28, 0x75, 0x5f, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x2c, 0x20, 0x30, 0x29, 0x29, - 0x3b, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x0d, 0x0a, 0x09, 0x76, 0x65, - 0x63, 0x34, 0x20, 0x66, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, - 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x28, 0x30, 0x2e, 0x30, 0x2c, - 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, - 0x2e, 0x30, 0x66, 0x29, 0x3b, 0x0d, 0x0a, 0x09, 0x66, 0x6f, 0x72, 0x20, - 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x69, 0x20, 0x3d, 0x20, 0x30, - 0x2e, 0x30, 0x3b, 0x20, 0x69, 0x20, 0x3c, 0x20, 0x54, 0x41, 0x55, 0x3b, - 0x20, 0x69, 0x20, 0x2b, 0x3d, 0x20, 0x54, 0x41, 0x55, 0x20, 0x2f, 0x20, - 0x73, 0x74, 0x65, 0x70, 0x73, 0x29, 0x20, 0x0d, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x7b, 0x0d, 0x0a, 0x09, 0x09, 0x2f, 0x2f, 0x20, 0x53, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x20, 0x69, 0x6e, - 0x20, 0x61, 0x20, 0x63, 0x69, 0x72, 0x63, 0x75, 0x6c, 0x61, 0x72, 0x20, - 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x0d, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x32, 0x28, - 0x73, 0x69, 0x6e, 0x28, 0x69, 0x29, 0x2c, 0x20, 0x63, 0x6f, 0x73, 0x28, - 0x69, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x61, 0x73, 0x70, 0x65, 0x63, 0x74, - 0x20, 0x2a, 0x20, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x3b, 0x0d, 0x0a, - 0x09, 0x09, 0x75, 0x69, 0x6e, 0x74, 0x20, 0x63, 0x6f, 0x6c, 0x20, 0x3d, - 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x75, 0x5f, 0x45, - 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, - 0x2c, 0x20, 0x75, 0x76, 0x20, 0x2b, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x29, 0x2e, 0x72, 0x3b, 0x0d, 0x0a, 0x09, 0x09, 0x0d, 0x0a, 0x09, - 0x09, 0x2f, 0x2f, 0x20, 0x4d, 0x69, 0x78, 0x20, 0x6f, 0x75, 0x74, 0x6c, - 0x69, 0x6e, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x62, 0x61, 0x63, - 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x0d, 0x0a, 0x09, 0x09, 0x66, - 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x20, 0x3d, - 0x20, 0x73, 0x6d, 0x6f, 0x6f, 0x74, 0x68, 0x73, 0x74, 0x65, 0x70, 0x28, - 0x30, 0x2e, 0x35, 0x2c, 0x20, 0x30, 0x2e, 0x37, 0x2c, 0x20, 0x69, 0x6e, - 0x74, 0x28, 0x63, 0x6f, 0x6c, 0x20, 0x21, 0x3d, 0x20, 0x74, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x29, 0x20, 0x2a, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x66, - 0x29, 0x3b, 0x0d, 0x0a, 0x09, 0x09, 0x66, 0x72, 0x61, 0x67, 0x43, 0x6f, - 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x6d, 0x69, 0x78, 0x28, 0x66, 0x72, - 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x75, 0x5f, 0x4f, - 0x75, 0x74, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, - 0x20, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x29, 0x3b, 0x0d, 0x0a, 0x09, 0x7d, - 0x0d, 0x0a, 0x09, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x28, - 0x66, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x61, 0x20, - 0x3e, 0x20, 0x30, 0x2e, 0x31, 0x29, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x7b, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, - 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x61, 0x20, 0x3d, - 0x20, 0x31, 0x2e, 0x30, 0x66, 0x3b, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x7d, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x0d, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, - 0x20, 0x6d, 0x69, 0x78, 0x28, 0x76, 0x65, 0x63, 0x34, 0x28, 0x30, 0x29, - 0x2c, 0x20, 0x66, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, - 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x75, 0x5f, 0x45, - 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, - 0x2c, 0x20, 0x75, 0x76, 0x29, 0x2e, 0x72, 0x20, 0x3d, 0x3d, 0x20, 0x74, + 0x20, 0x20, 0x20, 0x20, 0x0d, 0x0a, 0x09, 0x2f, 0x2f, 0x20, 0x73, 0x61, + 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x0d, + 0x0a, 0x09, 0x75, 0x69, 0x6e, 0x74, 0x20, 0x6d, 0x69, 0x64, 0x64, 0x6c, + 0x65, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x3d, 0x20, 0x74, 0x65, + 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x75, 0x5f, 0x45, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x2c, 0x20, 0x75, + 0x76, 0x29, 0x2e, 0x72, 0x3b, 0x0d, 0x0a, 0x09, 0x66, 0x6c, 0x6f, 0x61, + 0x74, 0x20, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x4d, 0x75, 0x6c, + 0x74, 0x20, 0x3d, 0x20, 0x6d, 0x69, 0x78, 0x28, 0x30, 0x2e, 0x30, 0x2c, + 0x20, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x69, 0x6e, 0x74, 0x28, 0x6d, 0x69, + 0x64, 0x64, 0x6c, 0x65, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x29, 0x20, + 0x3d, 0x3d, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x29, 0x3b, 0x0d, + 0x0a, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6f, + 0x72, 0x72, 0x65, 0x63, 0x74, 0x20, 0x61, 0x73, 0x70, 0x65, 0x63, 0x74, + 0x20, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x76, 0x65, 0x63, 0x32, 0x20, 0x61, 0x73, 0x70, 0x65, 0x63, 0x74, 0x20, + 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x20, 0x2f, 0x20, 0x76, 0x65, 0x63, 0x32, + 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x53, 0x69, 0x7a, 0x65, + 0x28, 0x75, 0x5f, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x65, 0x78, + 0x74, 0x75, 0x72, 0x65, 0x2c, 0x20, 0x30, 0x29, 0x29, 0x3b, 0x0d, 0x0a, + 0x20, 0x20, 0x20, 0x20, 0x0d, 0x0a, 0x09, 0x66, 0x6c, 0x6f, 0x61, 0x74, + 0x20, 0x68, 0x61, 0x73, 0x4d, 0x69, 0x73, 0x73, 0x65, 0x64, 0x20, 0x3d, + 0x20, 0x30, 0x2e, 0x30, 0x66, 0x3b, 0x0d, 0x0a, 0x09, 0x76, 0x65, 0x63, + 0x34, 0x20, 0x66, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, + 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, + 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, 0x2e, + 0x30, 0x66, 0x29, 0x3b, 0x0d, 0x0a, 0x09, 0x66, 0x6f, 0x72, 0x20, 0x28, + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x69, 0x20, 0x3d, 0x20, 0x30, 0x2e, + 0x30, 0x3b, 0x20, 0x69, 0x20, 0x3c, 0x20, 0x54, 0x41, 0x55, 0x3b, 0x20, + 0x69, 0x20, 0x2b, 0x3d, 0x20, 0x54, 0x41, 0x55, 0x20, 0x2f, 0x20, 0x73, + 0x74, 0x65, 0x70, 0x73, 0x29, 0x20, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x7b, 0x0d, 0x0a, 0x09, 0x09, 0x2f, 0x2f, 0x20, 0x53, 0x61, 0x6d, 0x70, + 0x6c, 0x65, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x20, 0x69, 0x6e, 0x20, + 0x61, 0x20, 0x63, 0x69, 0x72, 0x63, 0x75, 0x6c, 0x61, 0x72, 0x20, 0x70, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x32, 0x28, 0x73, + 0x69, 0x6e, 0x28, 0x69, 0x29, 0x2c, 0x20, 0x63, 0x6f, 0x73, 0x28, 0x69, + 0x29, 0x29, 0x20, 0x2a, 0x20, 0x61, 0x73, 0x70, 0x65, 0x63, 0x74, 0x20, + 0x2a, 0x20, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x3b, 0x0d, 0x0a, 0x09, + 0x09, 0x75, 0x69, 0x6e, 0x74, 0x20, 0x63, 0x6f, 0x6c, 0x20, 0x3d, 0x20, + 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x75, 0x5f, 0x45, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x2c, + 0x20, 0x75, 0x76, 0x20, 0x2b, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x29, 0x2e, 0x72, 0x3b, 0x0d, 0x0a, 0x09, 0x09, 0x0d, 0x0a, 0x09, 0x09, + 0x69, 0x66, 0x28, 0x63, 0x6f, 0x6c, 0x20, 0x3d, 0x3d, 0x20, 0x74, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x20, 0x7c, 0x7c, 0x20, 0x63, 0x6f, 0x6c, 0x20, + 0x3d, 0x3d, 0x20, 0x30, 0x29, 0x0d, 0x0a, 0x09, 0x09, 0x7b, 0x0d, 0x0a, + 0x09, 0x09, 0x09, 0x68, 0x61, 0x73, 0x4d, 0x69, 0x73, 0x73, 0x65, 0x64, + 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x66, 0x3b, 0x0d, 0x0a, 0x09, 0x09, + 0x7d, 0x0d, 0x0a, 0x0d, 0x0a, 0x09, 0x09, 0x2f, 0x2f, 0x20, 0x4d, 0x69, + 0x78, 0x20, 0x6f, 0x75, 0x74, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x77, 0x69, + 0x74, 0x68, 0x20, 0x62, 0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, + 0x64, 0x0d, 0x0a, 0x09, 0x09, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x20, 0x3d, 0x20, 0x73, 0x6d, 0x6f, 0x6f, 0x74, + 0x68, 0x73, 0x74, 0x65, 0x70, 0x28, 0x30, 0x2e, 0x35, 0x2c, 0x20, 0x30, + 0x2e, 0x37, 0x2c, 0x20, 0x69, 0x6e, 0x74, 0x28, 0x63, 0x6f, 0x6c, 0x20, + 0x21, 0x3d, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x29, 0x20, 0x2a, + 0x20, 0x68, 0x61, 0x73, 0x4d, 0x69, 0x73, 0x73, 0x65, 0x64, 0x20, 0x2a, + 0x20, 0x31, 0x30, 0x2e, 0x30, 0x66, 0x29, 0x3b, 0x0d, 0x0a, 0x09, 0x09, + 0x66, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, + 0x6d, 0x69, 0x78, 0x28, 0x66, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, + 0x72, 0x2c, 0x20, 0x75, 0x5f, 0x4f, 0x75, 0x74, 0x6c, 0x69, 0x6e, 0x65, + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x29, 0x3b, 0x0d, 0x0a, 0x09, 0x7d, 0x0d, 0x0a, 0x09, 0x0d, 0x0a, 0x20, + 0x20, 0x20, 0x20, 0x69, 0x66, 0x28, 0x66, 0x72, 0x61, 0x67, 0x43, 0x6f, + 0x6c, 0x6f, 0x72, 0x2e, 0x61, 0x20, 0x3e, 0x20, 0x30, 0x2e, 0x31, 0x29, + 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0d, 0x0a, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, + 0x6f, 0x72, 0x2e, 0x61, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x66, 0x3b, + 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0d, 0x0a, 0x20, 0x20, 0x20, + 0x20, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x46, 0x72, 0x61, 0x67, 0x43, + 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x6d, 0x69, 0x78, 0x28, 0x76, + 0x65, 0x63, 0x34, 0x28, 0x30, 0x29, 0x2c, 0x20, 0x66, 0x72, 0x61, 0x67, + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x6d, 0x69, 0x64, 0x64, 0x6c, + 0x65, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x21, 0x3d, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x29, 0x3b, 0x0d, 0x0a, 0x7d, 0x0d, 0x0a }; - unsigned int Resources_Shaders_outline_shader_len = 1260; + unsigned int Resources_Shaders_outline_shader_len = 1488; // Data for file: Resources_Shaders_pbr_shader_path const std::string Resources_Shaders_pbr_shader_path = R"(Resources/Shaders/pbr.shader)"; diff --git a/Resources/Images/project_icon.png b/Resources/Images/project_icon.png new file mode 100644 index 00000000..384eabf2 Binary files /dev/null and b/Resources/Images/project_icon.png differ diff --git a/Resources/Shaders/outline.shader b/Resources/Shaders/outline.shader index 8cc25404..bb621339 100644 --- a/Resources/Shaders/outline.shader +++ b/Resources/Shaders/outline.shader @@ -32,9 +32,14 @@ void main() float radius = 4.f; vec2 uv = a_UV; + // sample middle + uint middleSample = texture(u_EntityTexture, uv).r; + float opacityMult = mix(0.0, 1.0, int(middleSample) == target); + // Correct aspect ratio vec2 aspect = 1.0 / vec2(textureSize(u_EntityTexture, 0)); + float hasMissed = 0.0f; vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0f); for (float i = 0.0; i < TAU; i += TAU / steps) { @@ -42,8 +47,13 @@ void main() vec2 offset = vec2(sin(i), cos(i)) * aspect * radius; uint col = texture(u_EntityTexture, uv + offset).r; + if(col == target || col == 0) + { + hasMissed = 1.0f; + } + // Mix outline with background - float alpha = smoothstep(0.5, 0.7, int(col != target) * 10.0f); + float alpha = smoothstep(0.5, 0.7, int(col != target) * hasMissed * 10.0f); fragColor = mix(fragColor, u_OutlineColor, alpha); } @@ -52,5 +62,5 @@ void main() fragColor.a = 1.0f; } - FragColor = mix(vec4(0), fragColor, texture(u_EntityTexture, uv).r == target); + FragColor = mix(vec4(0), fragColor, middleSample != target); }