diff --git a/CopiumEngine/CopiumEngine.vcxproj b/CopiumEngine/CopiumEngine.vcxproj
index 4476ad3..d13b131 100644
--- a/CopiumEngine/CopiumEngine.vcxproj
+++ b/CopiumEngine/CopiumEngine.vcxproj
@@ -198,6 +198,7 @@
+
@@ -259,6 +260,7 @@
+
diff --git a/CopiumEngine/CopiumEngine.vcxproj.filters b/CopiumEngine/CopiumEngine.vcxproj.filters
index 2545726..cf27edc 100644
--- a/CopiumEngine/CopiumEngine.vcxproj.filters
+++ b/CopiumEngine/CopiumEngine.vcxproj.filters
@@ -225,6 +225,9 @@
Source Files
+
+ Source Files
+
@@ -530,5 +533,8 @@
Header Files
+
+ Header Files
+
\ No newline at end of file
diff --git a/CopiumEngine/assets/passthrough.meta b/CopiumEngine/assets/passthrough.meta
deleted file mode 100644
index d1c57a7..0000000
--- a/CopiumEngine/assets/passthrough.meta
+++ /dev/null
@@ -1,5 +0,0 @@
-[Pipeline]
-vert-filepath=res/shaders/passthrough.vert
-frag-filepath=res/shaders/passthrough.frag
-type=Passthrough
-uuid=8fdcfe12-5c69-cf29-2f31-e177d6267e4e
\ No newline at end of file
diff --git a/CopiumEngine/res/shaders/passthrough.frag b/CopiumEngine/res/shaders/passthrough.frag
deleted file mode 100644
index f09ade6..0000000
--- a/CopiumEngine/res/shaders/passthrough.frag
+++ /dev/null
@@ -1,12 +0,0 @@
-#version 450
-
-layout(set = 0, binding = 0) uniform sampler2D texSampler;
-
-layout(location = 0) in vec2 inTexCoord;
-
-layout(location = 0) out vec4 outColor;
-
-void main()
-{
- outColor = texture(texSampler, inTexCoord);
-}
\ No newline at end of file
diff --git a/CopiumEngine/res/shaders/passthrough.vert b/CopiumEngine/res/shaders/passthrough.vert
deleted file mode 100644
index 40e2c27..0000000
--- a/CopiumEngine/res/shaders/passthrough.vert
+++ /dev/null
@@ -1,12 +0,0 @@
-#version 450
-
-layout(location = 0) in vec2 inPosition;
-
-layout(location = 0) out vec2 outTexCoord;
-
-void main()
-{
- gl_Position = vec4(inPosition, 0.0, 1.0);
- outTexCoord = inPosition * 0.5 + 0.5;
- outTexCoord.y = 1.0 - outTexCoord.y;
-}
\ No newline at end of file
diff --git a/CopiumEngine/src/copium/core/Application.cpp b/CopiumEngine/src/copium/core/Application.cpp
index 672080e..3799dd4 100644
--- a/CopiumEngine/src/copium/core/Application.cpp
+++ b/CopiumEngine/src/copium/core/Application.cpp
@@ -3,14 +3,14 @@
#include "copium/asset/AssetManager.h"
#include "copium/core/Vulkan.h"
#include "copium/event/EventDispatcher.h"
+#include "copium/event/Input.h"
#include "copium/event/KeyPressEvent.h"
#include "copium/event/MouseMoveEvent.h"
#include "copium/event/MousePressEvent.h"
#include "copium/event/MouseScrollEvent.h"
+#include "copium/event/ViewportResize.h"
#include "copium/event/WindowFocusEvent.h"
-#include "copium/event/WindowResizeEvent.h"
#include "copium/mesh/Vertex.h"
-#include "copium/mesh/VertexPassthrough.h"
#include "copium/sampler/Font.h"
#include
@@ -35,17 +35,6 @@ namespace Copium
4, 5, 6, 6, 7, 4
};
- const std::vector verticesPassthrough = {
- VertexPassthrough{{-1.0f, -1.0f}},
- VertexPassthrough{{-1.0f, 1.0f}},
- VertexPassthrough{{ 1.0f, 1.0f}},
- VertexPassthrough{{ 1.0f, -1.0f}},
- };
-
- const std::vector indicesPassthrough = {
- 0, 1, 2, 2, 3, 0,
- };
-
Application::Application()
{
EventDispatcher::AddEventHandler(this);
@@ -63,7 +52,6 @@ namespace Copium
vkDeviceWaitIdle(Vulkan::GetDevice());
AssetManager::UnloadAsset(texture2D);
AssetManager::UnloadAsset(graphicsPipeline);
- AssetManager::UnloadAsset(graphicsPipelinePassthrough);
AssetManager::UnloadAsset(framebuffer);
EventDispatcher::RemoveEventHandler(this);
}
@@ -88,11 +76,10 @@ namespace Copium
scene->OnEvent(event);
switch (event.GetType())
{
- case EventType::WindowResize:
+ case EventType::ViewportResize:
{
- const WindowResizeEvent& windowResizeEvent = static_cast(event);
- AssetManager::GetAsset(framebuffer).Resize(windowResizeEvent.GetWidth(), windowResizeEvent.GetHeight());
- descriptorSetPassthrough->SetSampler(AssetManager::GetAsset(framebuffer).GetColorAttachment(), 0);
+ const ViewportResize& viewportResizeEvent = static_cast(event);
+ AssetManager::GetAsset(framebuffer).Resize(viewportResizeEvent.GetViewport().GetSize().x, viewportResizeEvent.GetViewport().GetSize().y);
descriptorSetImGui->SetSampler(AssetManager::GetAsset(framebuffer).GetColorAttachment(), 0);
return EventResult::Continue;
@@ -145,9 +132,6 @@ namespace Copium
descriptorSet = AssetManager::GetAsset(graphicsPipeline).CreateDescriptorSet(*descriptorPool, 0);
descriptorSet->SetSampler(AssetManager::GetAsset(texture2D), 1);
- descriptorSetPassthrough = AssetManager::GetAsset(graphicsPipelinePassthrough).CreateDescriptorSet(*descriptorPool, 0);
- descriptorSetPassthrough->SetSampler(AssetManager::GetAsset(framebuffer).GetColorAttachment(), 0);
-
descriptorSetImGui = Vulkan::GetImGuiInstance().CreateDescriptorSet();
descriptorSetImGui->SetSampler(AssetManager::GetAsset(framebuffer).GetColorAttachment(), 0);
}
@@ -155,13 +139,11 @@ namespace Copium
void Application::InitializeGraphicsPipeline()
{
graphicsPipeline = AssetManager::LoadAsset("pipeline.meta");
- graphicsPipelinePassthrough = AssetManager::LoadAsset("passthrough.meta");
}
void Application::InitializeMesh()
{
mesh = std::make_unique(vertices, indices);
- meshPassthrough = std::make_unique(verticesPassthrough, indicesPassthrough);
}
void Application::InitializeCommandBuffer()
@@ -171,13 +153,31 @@ namespace Copium
void Application::RecordCommandBuffer()
{
+ Framebuffer& fb = AssetManager::GetAsset(framebuffer);
+
+ // TODO: Move this logic elsewhere
Vulkan::GetImGuiInstance().Begin();
- commandBuffer->Begin();
+
+ ImGui::SetNextWindowPos(ImVec2{0, 0});
+ ImGui::SetNextWindowSize(ImVec2{(float)Vulkan::GetWindow().GetWidth(), (float)Vulkan::GetWindow().GetHeight()});
+ ImGui::Begin("Docker", nullptr, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoBringToFrontOnFocus);
+ ImGui::DockSpace(ImGui::GetID("Dockspace"));
+ ImGui::End();
ImGui::Begin("Viewport");
- ImGui::Image(*descriptorSetImGui, ImVec2{480, 270}, ImVec2{0, 1}, ImVec2{1, 0});
+ BoundingBox viewport{ImGui::GetCursorScreenPos().x,
+ ImGui::GetCursorScreenPos().y + ImGui::GetContentRegionAvail().y,
+ ImGui::GetCursorScreenPos().x + ImGui::GetContentRegionAvail().x,
+ ImGui::GetCursorScreenPos().y};
+ if (viewport.GetSize() != glm::vec2{fb.GetWidth(), fb.GetHeight()})
+ {
+ OnEvent(ViewportResize(viewport));
+ CP_INFO("Viewport resize");
+ }
+ ImGui::Image(*descriptorSetImGui, ImGui::GetContentRegionAvail(), ImVec2{0, 1}, ImVec2{1, 0});
ImGui::End();
- Framebuffer& fb = AssetManager::GetAsset(framebuffer);
+ commandBuffer->Begin();
+
Pipeline& pl = AssetManager::GetAsset(graphicsPipeline);
fb.Bind(*commandBuffer);
pl.Bind(*commandBuffer);
@@ -190,20 +190,15 @@ namespace Copium
mesh->Bind(*commandBuffer);
mesh->Render(*commandBuffer);
+ // TODO: Move this logic elsewhere and only have the Rendering part here
+ Input::PushViewport(viewport);
scene->Update();
+ Input::PopViewport();
fb.Unbind(*commandBuffer);
Vulkan::GetSwapChain().BeginFrameBuffer(*commandBuffer);
- Pipeline& plPassthrough = AssetManager::GetAsset(graphicsPipelinePassthrough);
- plPassthrough.Bind(*commandBuffer);
- plPassthrough.SetDescriptorSet(*descriptorSetPassthrough);
- plPassthrough.BindDescriptorSets(*commandBuffer);
-
- meshPassthrough->Bind(*commandBuffer);
- meshPassthrough->Render(*commandBuffer);
-
Vulkan::GetImGuiInstance().End();
Vulkan::GetImGuiInstance().Render(*commandBuffer);
@@ -219,13 +214,11 @@ namespace Copium
Framebuffer& fb = AssetManager::GetAsset(framebuffer);
float aspect = fb.GetWidth() / (float)fb.GetHeight();
- {
- UniformBuffer& uniformBuffer = descriptorSet->GetUniformBuffer("ubo");
- uniformBuffer.Set("projection", glm::perspective(glm::radians(45.0f), aspect, 0.1f, 10.0f));
- uniformBuffer.Set("view", glm::lookAt(glm::vec3(2.0f, 2.0f, 2.0f), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f)));
- uniformBuffer.Set("model", glm::rotate(glm::mat4(1.0f), time * glm::radians(90.0f), glm::vec3(0.0f, 1.0f, 0.0f)));
- uniformBuffer.Set("lightPos", (glm::vec3)(glm::rotate(glm::mat4{1.0f}, time * glm::radians(45.0f), glm::vec3(0, 1, 0)) * glm::vec4{0.3, 0.1, 0, 1}));
- uniformBuffer.Update();
- }
+ UniformBuffer& uniformBuffer = descriptorSet->GetUniformBuffer("ubo");
+ uniformBuffer.Set("projection", glm::perspective(glm::radians(45.0f), aspect, 0.1f, 10.0f));
+ uniformBuffer.Set("view", glm::lookAt(glm::vec3(2.0f, 2.0f, 2.0f), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f)));
+ uniformBuffer.Set("model", glm::rotate(glm::mat4(1.0f), time * glm::radians(90.0f), glm::vec3(0.0f, 1.0f, 0.0f)));
+ uniformBuffer.Set("lightPos", (glm::vec3)(glm::rotate(glm::mat4{1.0f}, time * glm::radians(45.0f), glm::vec3(0, 1, 0)) * glm::vec4{0.3, 0.1, 0, 1}));
+ uniformBuffer.Update();
}
}
\ No newline at end of file
diff --git a/CopiumEngine/src/copium/core/Application.h b/CopiumEngine/src/copium/core/Application.h
index c96ee92..ce5dc5d 100644
--- a/CopiumEngine/src/copium/core/Application.h
+++ b/CopiumEngine/src/copium/core/Application.h
@@ -21,14 +21,11 @@ namespace Copium
AssetHandle texture2D2;
AssetHandle font;
AssetHandle graphicsPipeline;
- AssetHandle graphicsPipelinePassthrough;
std::unique_ptr descriptorPool;
std::unique_ptr descriptorSet;
- std::unique_ptr descriptorSetPassthrough;
std::unique_ptr descriptorSetImGui;
std::unique_ptr scene;
std::unique_ptr mesh;
- std::unique_ptr meshPassthrough;
std::unique_ptr commandBuffer;
public:
diff --git a/CopiumEngine/src/copium/core/ImGuiInstance.cpp b/CopiumEngine/src/copium/core/ImGuiInstance.cpp
index c795213..695ba59 100644
--- a/CopiumEngine/src/copium/core/ImGuiInstance.cpp
+++ b/CopiumEngine/src/copium/core/ImGuiInstance.cpp
@@ -52,9 +52,10 @@ namespace Copium
{
IMGUI_CHECKVERSION();
ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
- io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
+ ImGuiIO& io = ImGui::GetIO();
+ io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
+ io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
+ io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
ImGui::StyleColorsDark();
diff --git a/CopiumEngine/src/copium/core/Scene.cpp b/CopiumEngine/src/copium/core/Scene.cpp
index 244c3fa..7542fb0 100644
--- a/CopiumEngine/src/copium/core/Scene.cpp
+++ b/CopiumEngine/src/copium/core/Scene.cpp
@@ -24,6 +24,7 @@
#include "copium/example/PlayerControllerSystem.h"
#include "copium/example/RenderSystem.h"
#include "copium/example/UiRenderSystem.h"
+#include "copium/event/ViewportResize.h"
#include
#include
@@ -49,7 +50,7 @@ namespace Copium
ecs->AddSystem(&viewMatrix, &projectionMatrix, &invPvMatrix, &uiProjectionMatrix);
ecs->AddSystem(&invPvMatrix);
ecs->AddSystem();
- ecs->AddSystem();
+ ecs->AddSystem(&viewport);
ecs->AddSystem();
ecs->AddSystem(renderer.get(), descriptorSetRenderer.get(), &commandBuffer, &viewMatrix, &projectionMatrix); // better way to store the RenderSystem data?
ecs->AddSystem(uiRenderer.get(), uiDescriptorSetRenderer.get(), &commandBuffer, &uiProjectionMatrix);
@@ -66,7 +67,16 @@ namespace Copium
EventResult Scene::OnEvent(const Event& event)
{
+ switch (event.GetType())
+ {
+ case EventType::ViewportResize:
+ const ViewportResize& viewportResizeEvent = static_cast(event);
+ viewport = viewportResizeEvent.GetViewport();
+ break;
+ }
+ Input::PushViewport(viewport);
ecs->UpdateSystems(EventSignal{event});
+ Input::PopViewport();
return EventResult::Continue;
}
diff --git a/CopiumEngine/src/copium/core/Scene.h b/CopiumEngine/src/copium/core/Scene.h
index 2f95d2f..a510a72 100644
--- a/CopiumEngine/src/copium/core/Scene.h
+++ b/CopiumEngine/src/copium/core/Scene.h
@@ -23,6 +23,7 @@ namespace Copium
glm::mat4 viewMatrix;
glm::mat4 invPvMatrix;
glm::mat4 uiProjectionMatrix;
+ BoundingBox viewport;
public:
Scene(CommandBuffer& commandBuffer, DescriptorPool& descriptorPool);
void Update();
diff --git a/CopiumEngine/src/copium/event/EventType.h b/CopiumEngine/src/copium/event/EventType.h
index 7586d56..f2a699a 100644
--- a/CopiumEngine/src/copium/event/EventType.h
+++ b/CopiumEngine/src/copium/event/EventType.h
@@ -5,6 +5,7 @@
#define CP_EVENT_TYPE_ENUMS \
MouseMove, MousePress, MouseRelease, MouseScroll, \
KeyPress, KeyRelease, \
- WindowResize, WindowFocus
+ WindowResize, WindowFocus, \
+ ViewportResize
CP_ENUM_CREATOR(Copium, EventType, CP_EVENT_TYPE_ENUMS);
diff --git a/CopiumEngine/src/copium/event/Input.cpp b/CopiumEngine/src/copium/event/Input.cpp
index 488a601..cfa6598 100644
--- a/CopiumEngine/src/copium/event/Input.cpp
+++ b/CopiumEngine/src/copium/event/Input.cpp
@@ -12,6 +12,7 @@ namespace Copium
bool Input::mouseDownList[MAX_NUM_MOUSE_BUTTONS];
bool Input::mouseEventList[MAX_NUM_MOUSE_BUTTONS];
glm::vec2 Input::mousePos{0.0f};
+ glm::vec2 Input::mousePosViewport{0.0f};
bool Input::IsKeyPressed(int keyCode)
{
@@ -66,6 +67,11 @@ namespace Copium
return mousePos;
}
+ glm::vec2 Input::GetMousePosViewport()
+ {
+ return mousePosViewport;
+ }
+
glm::vec2 Input::GetMouseWindowPos()
{
return glm::vec2{(mousePos.x + 1.0f) * 0.5f * Vulkan::GetWindow().GetWidth(), (1.0f - mousePos.y) * 0.5f * Vulkan::GetWindow().GetHeight()};
@@ -88,6 +94,7 @@ namespace Copium
void Input::OnMouseMove(glm::vec2 mousePos)
{
Input::mousePos = mousePos;
+ Input::mousePosViewport = mousePos;
}
void Input::Update()
@@ -95,4 +102,16 @@ namespace Copium
memset(keyEventList, false, sizeof(keyEventList));
memset(mouseEventList, false, sizeof(mouseEventList));
}
+
+ void Input::PushViewport(const BoundingBox& viewport)
+ {
+ mousePosViewport = GetMouseWindowPos();
+ mousePosViewport.x = (mousePosViewport.x - viewport.l) / viewport.GetSize().x * 2 - 1;
+ mousePosViewport.y = 1 - (mousePosViewport.y - viewport.t) / viewport.GetSize().y * 2;
+ }
+
+ void Input::PopViewport()
+ {
+ mousePosViewport = mousePos;
+ }
}
diff --git a/CopiumEngine/src/copium/event/Input.h b/CopiumEngine/src/copium/event/Input.h
index 92b7dfd..91549d7 100644
--- a/CopiumEngine/src/copium/event/Input.h
+++ b/CopiumEngine/src/copium/event/Input.h
@@ -3,6 +3,7 @@
#include
#include "copium/event/InputCode.h"
+#include "copium/util/BoundingBox.h"
#include
@@ -19,6 +20,7 @@ namespace Copium
static bool mouseDownList[MAX_NUM_MOUSE_BUTTONS];
static bool mouseEventList[MAX_NUM_MOUSE_BUTTONS];
static glm::vec2 mousePos;
+ static glm::vec2 mousePosViewport;
public:
// Will only be true for a single frame after the KeyPressEvent/KeyReleaseEvent
@@ -37,11 +39,14 @@ namespace Copium
static glm::vec2 GetMouseWindowPos();
static glm::vec2 GetMousePos();
+ static glm::vec2 GetMousePosViewport();
static void OnKey(int keyCode, bool pressed);
static void OnMouse(int buttion, bool pressed);
static void OnMouseMove(glm::vec2 mousePos);
static void Update();
+ static void PushViewport(const BoundingBox& viewport);
+ static void PopViewport();
};
}
diff --git a/CopiumEngine/src/copium/event/ViewportResize.cpp b/CopiumEngine/src/copium/event/ViewportResize.cpp
new file mode 100644
index 0000000..441029a
--- /dev/null
+++ b/CopiumEngine/src/copium/event/ViewportResize.cpp
@@ -0,0 +1,13 @@
+#include "copium/event/ViewportResize.h"
+
+namespace Copium
+{
+ ViewportResize::ViewportResize(const BoundingBox& viewport)
+ : Event(EventType::ViewportResize), viewport{viewport}
+ {}
+
+ const BoundingBox& ViewportResize::GetViewport() const
+ {
+ return viewport;
+ }
+}
diff --git a/CopiumEngine/src/copium/event/ViewportResize.h b/CopiumEngine/src/copium/event/ViewportResize.h
new file mode 100644
index 0000000..b4046bd
--- /dev/null
+++ b/CopiumEngine/src/copium/event/ViewportResize.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#include "copium/event/Event.h"
+#include "copium/event/EventType.h"
+#include "copium/util/BoundingBox.h"
+
+namespace Copium
+{
+ class ViewportResize : public Event
+ {
+ BoundingBox viewport;
+ public:
+ ViewportResize(const BoundingBox& viewport);
+
+ const BoundingBox& GetViewport() const;
+ };
+}
diff --git a/CopiumEngine/src/copium/example/CameraUpdateSystem.h b/CopiumEngine/src/copium/example/CameraUpdateSystem.h
index cdec66f..be67869 100644
--- a/CopiumEngine/src/copium/example/CameraUpdateSystem.h
+++ b/CopiumEngine/src/copium/example/CameraUpdateSystem.h
@@ -3,7 +3,7 @@
#include "copium/ecs/System.h"
#include "copium/example/Components.h"
#include "copium/event/EventSignal.h"
-#include "copium/event/WindowResizeEvent.h"
+#include "copium/event/ViewportResize.h"
#include
@@ -46,19 +46,19 @@ namespace Copium
const EventSignal& eventSignal = static_cast(signal);
switch (eventSignal.GetEvent().GetType())
{
- case EventType::WindowResize:
+ case EventType::ViewportResize:
{
- const WindowResizeEvent& windowResizeEvent = static_cast(eventSignal.GetEvent());
+ const ViewportResize& viewportResize = static_cast(eventSignal.GetEvent());
if (camera.uiCamera)
{
- camera.projection.r = windowResizeEvent.GetWidth();
- camera.projection.t = windowResizeEvent.GetHeight();
+ camera.projection.r = viewportResize.GetViewport().GetSize().x;
+ camera.projection.t = viewportResize.GetViewport().GetSize().y;
camera.projection.l = 0.0f;
camera.projection.b = 0.0f;
}
else
{
- float aspect = windowResizeEvent.GetWidth() / (float)windowResizeEvent.GetHeight();
+ float aspect = viewportResize.GetViewport().GetSize().x / viewportResize.GetViewport().GetSize().y;
camera.projection.r = aspect;
camera.projection.l = -aspect;
}
diff --git a/CopiumEngine/src/copium/example/DebugSystem.h b/CopiumEngine/src/copium/example/DebugSystem.h
index fe9cbca..8281019 100644
--- a/CopiumEngine/src/copium/example/DebugSystem.h
+++ b/CopiumEngine/src/copium/example/DebugSystem.h
@@ -9,7 +9,12 @@ namespace Copium
{
class DebugSystem : public System
{
+ BoundingBox* viewport;
public:
+ DebugSystem(BoundingBox* viewport)
+ : viewport{viewport}
+ {}
+
void RunEntity(Entity entity, DebugC& debug, TextC& text, TransformC& transform) override
{
const PlayerC& player = debug.playerEntity.GetComponent();
@@ -23,7 +28,7 @@ namespace Copium
text.text += String::Format("Grounded: %s", player.grounded ? "true" : "false");
const Font& font = AssetManager::GetAsset(text.font);
- transform.position.y = Vulkan::GetSwapChain().GetExtent().height - 10.0f - font.GetBaseHeight() * text.fontSize;
+ transform.position.y = viewport->GetSize().y - 10.0f - font.GetBaseHeight() * text.fontSize;
}
};
}
\ No newline at end of file
diff --git a/CopiumEngine/src/copium/example/MouseFollowSystem.h b/CopiumEngine/src/copium/example/MouseFollowSystem.h
index 3cf3f98..7ba0f10 100644
--- a/CopiumEngine/src/copium/example/MouseFollowSystem.h
+++ b/CopiumEngine/src/copium/example/MouseFollowSystem.h
@@ -18,7 +18,7 @@ namespace Copium
void RunEntity(Entity entity, MouseFollowC& mouseFollow, TransformC& transform)
{
- transform.position = (*invPvMatrix) * glm::vec4{Input::GetMousePos().x, Input::GetMousePos().y, 0.0f, 1.0f};
+ transform.position = (*invPvMatrix) * glm::vec4{Input::GetMousePosViewport().x, Input::GetMousePosViewport().y, 0.0f, 1.0f};
transform.position -= transform.size * glm::vec2{0.5f};
}
};
diff --git a/CopiumEngine/src/copium/util/BoundingBox.cpp b/CopiumEngine/src/copium/util/BoundingBox.cpp
index dc93782..06d080c 100644
--- a/CopiumEngine/src/copium/util/BoundingBox.cpp
+++ b/CopiumEngine/src/copium/util/BoundingBox.cpp
@@ -20,6 +20,16 @@ namespace Copium
glm::vec2 BoundingBox::GetSize() const
{
- return rt - lb;
+ return glm::abs(rt - lb);
+ }
+
+ bool BoundingBox::operator==(const BoundingBox& boundingBox) const
+ {
+ return l == boundingBox.l && b == boundingBox.b && r == boundingBox.r && t == boundingBox.t;
+ }
+
+ bool BoundingBox::operator!=(const BoundingBox& boundingBox) const
+ {
+ return !(*this == boundingBox);
}
}
diff --git a/CopiumEngine/src/copium/util/BoundingBox.h b/CopiumEngine/src/copium/util/BoundingBox.h
index 0989b63..6aacead 100644
--- a/CopiumEngine/src/copium/util/BoundingBox.h
+++ b/CopiumEngine/src/copium/util/BoundingBox.h
@@ -18,5 +18,8 @@ namespace Copium
BoundingBox(glm::vec2 lb, glm::vec2 rt);
glm::vec2 GetSize() const;
+
+ bool operator==(const BoundingBox& boundingBox) const;
+ bool operator!=(const BoundingBox& boundingBox) const;
};
}
diff --git a/ext/repos/imgui b/ext/repos/imgui
index 77eba4d..07d1709 160000
--- a/ext/repos/imgui
+++ b/ext/repos/imgui
@@ -1 +1 @@
-Subproject commit 77eba4d0d1682917fee5638e746d5f599c47dc6e
+Subproject commit 07d1709ca2759ab78a19c26c141a99cf8080b2a9