From ef199b180edcb42eb892755c1413096bb864ad33 Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Mon, 9 Mar 2026 21:50:24 +0100 Subject: [PATCH] mouse fix --- implementations/Crafter.Graphics-Mesh.cpp | 9 ++++++--- implementations/Crafter.Graphics-RenderingElement3D.cpp | 8 +++++++- implementations/Crafter.Graphics-Window.cpp | 4 ++++ project.json | 5 +++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/implementations/Crafter.Graphics-Mesh.cpp b/implementations/Crafter.Graphics-Mesh.cpp index 8242b77..dfaf8f4 100644 --- a/implementations/Crafter.Graphics-Mesh.cpp +++ b/implementations/Crafter.Graphics-Mesh.cpp @@ -18,9 +18,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ module; - +#ifdef CRAFTER_GRAPHICS_RENDERER_VULKAN #include "vulkan/vulkan.h" - +#endif module Crafter.Graphics:Mesh_impl; import Crafter.Math; import :Mesh; @@ -30,6 +30,8 @@ import std; using namespace Crafter; +#ifdef CRAFTER_GRAPHICS_RENDERER_VULKAN + void Mesh::Build(std::span> verticies, std::span indicies, VkCommandBuffer cmd) { vertexBuffer.Resize(VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT | VK_BUFFER_USAGE_2_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, verticies.size()); indexBuffer.Resize(VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT | VK_BUFFER_USAGE_2_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, indicies.size()); @@ -127,4 +129,5 @@ void Mesh::Build(std::span> verticies, std::span +#endif module Crafter.Graphics:RenderingElement3D_impl; import :RenderingElement3D; import std; using namespace Crafter; +#ifdef CRAFTER_GRAPHICS_RENDERER_VULKAN + std::vector RenderingElement3D::elements; void RenderingElement3D::BuildTLAS(VkCommandBuffer cmd, std::uint32_t index) { @@ -110,4 +114,6 @@ void RenderingElement3D::BuildTLAS(VkCommandBuffer cmd, std::uint32_t index) { 0, nullptr, 0, nullptr ); -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/implementations/Crafter.Graphics-Window.cpp b/implementations/Crafter.Graphics-Window.cpp index 5b0efeb..44924e2 100644 --- a/implementations/Crafter.Graphics-Window.cpp +++ b/implementations/Crafter.Graphics-Window.cpp @@ -598,6 +598,8 @@ void Window::Update() { vblank = duration_cast(startTime - frameEnd); #endif + mouseDelta = {currentMousePos.x-lastMousePos.x, currentMousePos.y-lastMousePos.y}; + #ifdef CRAFTER_TIMING auto renderStart = std::chrono::high_resolution_clock::now(); renderTimings.clear(); @@ -608,6 +610,8 @@ void Window::Update() { totalRender = renderEnd - renderStart; #endif + lastMousePos = currentMousePos; + #ifdef CRAFTER_TIMING frameEnd = std::chrono::high_resolution_clock::now(); diff --git a/project.json b/project.json index 2575830..ca8e1e6 100644 --- a/project.json +++ b/project.json @@ -10,7 +10,9 @@ "implementations/Crafter.Graphics-Transform2D", "implementations/Crafter.Graphics-GridElement", "implementations/Crafter.Graphics-Rendertarget", - "implementations/Crafter.Graphics-Device" + "implementations/Crafter.Graphics-Device", + "implementations/Crafter.Graphics-Mesh", + "implementations/Crafter.Graphics-RenderingElement3D" ], "interfaces": [ "interfaces/Crafter.Graphics-Window", @@ -61,7 +63,6 @@ }, { "name": "vulkan", - "implementations": ["implementations/Crafter.Graphics-Mesh", "implementations/Crafter.Graphics-RenderingElement3D"], "defines": [ { "name": "CRAFTER_GRAPHICS_RENDERER_VULKAN"