From 320c9293b102a6561c35ea5f6886a11fc1e222fd Mon Sep 17 00:00:00 2001 From: Piotr Krygier Date: Sat, 13 May 2023 17:47:42 +0200 Subject: [PATCH] Update return types --- graphics/src/rse_graphics.cpp | 22 +++++++++++++++++----- graphics/src/vulkan_buffers.cpp | 13 ++++++------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/graphics/src/rse_graphics.cpp b/graphics/src/rse_graphics.cpp index 3f9413a4..ed68950f 100644 --- a/graphics/src/rse_graphics.cpp +++ b/graphics/src/rse_graphics.cpp @@ -44,6 +44,11 @@ uint8_t RseGraphics::graphics_run(void) {{0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 1.0f}}, {{0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}}, {{-0.5f, 0.5f, 0.0f}, {1.0f, 0.0f, 1.0f}}}; + const std::vector vertices2 = {{{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 1.0f}}, + + {{0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}}, + {{0.5f, 0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}}, + {{-0.5f, 0.5f, 0.0f}, {1.0f, 1.0f, 0.0f}}}; // FIXME: Temporary array of vertices, for testing purposes std::vector indices = {0, 1, 2, 2, 3, 0}; @@ -55,11 +60,18 @@ uint8_t RseGraphics::graphics_run(void) 1.0f )); - // rse::graphics::mesh::create_mesh_instance(vulkan_state, mesh_id, rse::graphics::mesh::InstanceData( - // glm::vec3(-1.0f, 0.0f, 0.0f), - // glm::vec3(0.0f, 0.0f, 0.0f), - // 1.0f - // )); + rse::graphics::mesh::create_mesh_instance(mesh_id, rse::graphics::mesh::InstanceData( + glm::vec3(-1.0f, 0.0f, 0.0f), + glm::vec3(0.0f, 0.0f, 0.0f), + 1.0f + )); + + mesh_id = rse::graphics::mesh::create_mesh(vertices, indices); + rse::graphics::mesh::create_mesh_instance(mesh_id, rse::graphics::mesh::InstanceData( + glm::vec3(0.0f, 1.0f, 0.0f), + glm::vec3(0.0f, 0.0f, glm::radians(0.0f)), + 1.0f + )); window::windowLoop(); diff --git a/graphics/src/vulkan_buffers.cpp b/graphics/src/vulkan_buffers.cpp index 78f8f9af..66b38b46 100644 --- a/graphics/src/vulkan_buffers.cpp +++ b/graphics/src/vulkan_buffers.cpp @@ -332,8 +332,8 @@ void updateUniformBuffer() memcpy(g_vulkan_state.uniformBuffers[g_vulkan_state.currentFrame].allocationInfo.pMappedData, &ubo, sizeof(ubo)); } -uint8_t update_mesh_buffers( const std::vector& vertices, - const std::vector& indices) +uint8_t update_mesh_buffers(const std::vector& vertices, + const std::vector& indices) { // void* mapped_data; Buffer staging_buffer; @@ -375,7 +375,7 @@ uint8_t update_mesh_buffers( const std::vector(indices.size()), instances.size(), 0, 0, 0); + vkCmdDrawIndexed(commandBuffer, static_cast(indices.size()+3), instances.size(), 0, 0, 0); } vkCmdEndRenderPass(commandBuffer);