From 8ab4780f134c33a9e11ac0fe0bd866e17d3ee650 Mon Sep 17 00:00:00 2001 From: vimene Date: Mon, 29 Dec 2025 21:21:09 +0100 Subject: starting to merge vulkan with the engine - refactored scene_main to be able to share code between software and hardware renderers, while still sharing code between terminal software renderer and graphical software renderer - made the hardware renderer use scene objects vertices and transforms, instead of hardcoded ones - made the hardware renderer use the scene's camera - made .obj parser create Vector3 instead of Vector4, which didn't made sense - removed unnecessary std:: - lots of small changes --- src/vulkan_utils.hpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/vulkan_utils.hpp') diff --git a/src/vulkan_utils.hpp b/src/vulkan_utils.hpp index 1647e91..c822caa 100644 --- a/src/vulkan_utils.hpp +++ b/src/vulkan_utils.hpp @@ -39,7 +39,7 @@ struct Vertex { }; } - static constexpr std::array get_attr_descs() { + static constexpr std::array get_attr_descs() { return { VkVertexInputAttributeDescription { .location = 0, @@ -51,25 +51,21 @@ struct Vertex { .location = 1, .binding = 0, .format = VK_FORMAT_R32G32B32_SFLOAT, - .offset = offsetof(Vertex, col), - }, - VkVertexInputAttributeDescription { - .location = 2, - .binding = 0, - .format = VK_FORMAT_R32G32_SFLOAT, - .offset = offsetof(Vertex, uv), + .offset = offsetof(Vertex, normal), }, }; } engine::math::Vector3 pos; - engine::math::Vector3 col; - engine::math::Vector2 uv; + engine::math::Vector3 normal; }; // TODO: move to a better place. Also, see TODOs for struct Vertex struct UniformBufferObject { alignas(16) engine::math::Matrix4 model, view, proj; + // TODO: should me Matrix3, but it isn't implemented yet + alignas(16) engine::math::Matrix4 camera_rot; + alignas(16) engine::math::Vector3 camera_loc; }; } -- cgit v1.2.3