From 9eda87dd468e3bec5fd09c37f279274dcd7aa144 Mon Sep 17 00:00:00 2001 From: Slendi Date: Sun, 7 Dec 2025 00:12:04 +0200 Subject: [PATCH] 3d modle load Signed-off-by: Slendi --- src/VulkanRenderer.cpp | 24 ++++++++++++++++++------ thirdparty/smath | 2 +- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/VulkanRenderer.cpp b/src/VulkanRenderer.cpp index 4f32fc2..7428068 100644 --- a/src/VulkanRenderer.cpp +++ b/src/VulkanRenderer.cpp @@ -775,12 +775,24 @@ auto VulkanRenderer::draw_geometry(VkCommandBuffer cmd) -> void push_constants.vertex_buffer = m_vk.test_meshes[2]->mesh_buffers.vertex_buffer_address; - auto const view { smath::translate(smath::Vec3 { 0, 0, -0.1 }) }; - auto projection { smath::matrix_perspective(smath::deg(70.0f), - static_cast(m_vk.draw_extent.width) - / static_cast(m_vk.draw_extent.height), - 10000.0f, 0.1f) }; - push_constants.world_matrix = projection * view; + auto model { smath::Mat4::identity() }; + // auto model { smath::translate(smath::Vec3 { 0.0f, 0.0f, -3.0f }) }; + + auto view { smath::matrix_look_at(smath::Vec3 { 0.0f, 0.0f, 3.0f }, + smath::Vec3 { 0.0f, 0.0f, 0.0f }, smath::Vec3 { 0.0f, 1.0f, 0.0f }, + false) }; + + // auto projection { smath::Mat4::identity() }; + // projection[1][1] *= -1; + auto projection { + smath::matrix_perspective(smath::deg(70.0f), + static_cast(m_vk.draw_extent.width) + / static_cast(m_vk.draw_extent.height), + 0.1f, 10000.0f), + }; + + push_constants.world_matrix = projection * view * model; + push_constants.world_matrix[1][1] *= -1; vkCmdPushConstants(cmd, m_vk.mesh_pipeline_layout, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(push_constants), &push_constants); diff --git a/thirdparty/smath b/thirdparty/smath index b5e0aab..a5d6692 160000 --- a/thirdparty/smath +++ b/thirdparty/smath @@ -1 +1 @@ -Subproject commit b5e0aabe379b363ebfbf2172d5325d7fbf099c29 +Subproject commit a5d669235e81a05e80ceb41840a417ca146692c4