#pragma once #include #include #include #include #include #include "vulkan/buffer.hpp" #include "vulkan/device.hpp" namespace sophia { class Mesh { public: struct Vertex { glm::vec2 position{}; glm::vec3 color{}; // glm::vec3 normal{}; // glm::vec2 uv{}; static std::vector getBindingDescriptions(); static std::vector getAttributeDescriptions(); // bool operator==(const Vertex& other) const { // return position == other.position && color == other.color; // } }; struct Builder { std::vector vertices{}; std::vector indices{}; // void loadModel(const std::string& filepath); }; Mesh(Device& device, const Mesh::Builder& builder); ~Mesh(); Mesh(const Mesh&) = delete; Mesh& operator=(const Mesh&) = delete; // static std::unique_ptr createMeshFromFile( // Device& device, const std::string& filepath); void bind(vk::CommandBuffer commandBuffer) const; void draw(vk::CommandBuffer commandBuffer) const; private: void createVertexBuffers(const std::vector& vertices); void createIndexBuffers(const std::vector& indices); Device& device; std::unique_ptr vertexBuffer; u32 vertexCount; bool hasIndexBuffer = false; std::unique_ptr indexBuffer; u32 indexCount; }; } // namespace sophia