#pragma once #include "xe_device.hpp" #include "xe_buffer.hpp" #include #include #define GLM_FORCE_RADIANS #define GLM_FORCE_DEPTH_ZERO_TO_ONE #include namespace xe { class Model { public: struct Builder { std::vector vertexData{}; uint32_t vertexSize; std::vector indices{}; void loadModel(const std::string &filepath); }; Model(Device &device, const Model::Builder &builder); ~Model(); Model(const Model &) = delete; Model operator=(const Model &) = delete; static std::unique_ptr createModelFromFile(Device &device, const std::string &filepath); void bind(VkCommandBuffer commandBuffer); void draw(VkCommandBuffer commandBuffer); private: void createVertexBuffers(const std::vector &vertexData, uint32_t vertexSize); void createIndexBuffers(const std::vector &indexData); Device &xeDevice; std::unique_ptr vertexBuffer; uint32_t vertexCount; bool hasIndexBuffer = false; std::unique_ptr indexBuffer; uint32_t indexCount; }; }