mouse fix

This commit is contained in:
Jorijn van der Graaf 2026-03-09 21:50:24 +01:00
commit ef199b180e
4 changed files with 20 additions and 6 deletions

View file

@ -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<Vector<float, 3, 3>> verticies, std::span<std::uint32_t> 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());
@ -128,3 +130,4 @@ void Mesh::Build(std::span<Vector<float, 3, 3>> verticies, std::span<std::uint32
};
blasAddr = Device::vkGetAccelerationStructureDeviceAddressKHR(Device::device, &addrInfo);
}
#endif

View file

@ -18,13 +18,17 @@ License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
module;
#ifdef CRAFTER_GRAPHICS_RENDERER_VULKAN
#include <vulkan/vulkan_core.h>
#endif
module Crafter.Graphics:RenderingElement3D_impl;
import :RenderingElement3D;
import std;
using namespace Crafter;
#ifdef CRAFTER_GRAPHICS_RENDERER_VULKAN
std::vector<RenderingElement3D*> RenderingElement3D::elements;
void RenderingElement3D::BuildTLAS(VkCommandBuffer cmd, std::uint32_t index) {
@ -111,3 +115,5 @@ void RenderingElement3D::BuildTLAS(VkCommandBuffer cmd, std::uint32_t index) {
0, nullptr
);
}
#endif

View file

@ -598,6 +598,8 @@ void Window::Update() {
vblank = duration_cast<std::chrono::milliseconds>(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();

View file

@ -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"