82 void load(
const std::string &path,
float positionScale = 1.0f);
91 void load(
const std::string &path,
const std::string &textureManifestPath,
const std::string &textureBasePath,
float positionScale = 1.0f);
98 void exportOBJ(
const std::string &objPath,
const std::string &mtlPath =
"")
const;
103 static void exportOBJ(
const std::string &modelPath,
const std::string &textureManifestPath,
const std::string &textureBasePath,
const std::string &objPath,
float positionScale = 1.0f);
112 void upload(VkDevice device, VkPhysicalDevice physicalDevice, VkCommandPool commandPool, VkQueue graphicsQueue);
124 void draw(VkCommandBuffer cmd)
const;
131 void drawSubMesh(VkCommandBuffer cmd,
size_t index)
const;
136 [[nodiscard]]
const std::vector<VKVertex> &
vertices()
const {
return verticesData; }
137 [[nodiscard]]
const std::vector<uint32_t> &
indices()
const {
return indicesData; }
138 [[nodiscard]] uint32_t
indexCount()
const {
return static_cast<uint32_t
>(indicesData.size()); }
140 [[nodiscard]] VkBuffer
vertexBuffer()
const {
return vertexBufferHandle; }
141 [[nodiscard]] VkBuffer
indexBuffer()
const {
return indexBufferHandle; }
143 [[nodiscard]]
size_t subMeshCount()
const {
return subMeshList.size(); }
145 [[nodiscard]]
const std::vector<SubMesh> &
subMeshes()
const {
return subMeshList; }
147 [[nodiscard]]
const std::vector<MXMaterial> &
materials()
const {
return materialList; }
148 [[nodiscard]]
const std::string &
mtlLibPath()
const {
return mtlLibraryPath; }
151 std::vector<VKVertex> verticesData{};
152 std::vector<uint32_t> indicesData{};
153 std::vector<SubMesh> subMeshList{};
154 std::vector<MXMaterial> materialList{};
155 std::string mtlLibraryPath{};
157 VkBuffer vertexBufferHandle = VK_NULL_HANDLE;
158 VkDeviceMemory vertexBufferMemory = VK_NULL_HANDLE;
159 VkBuffer indexBufferHandle = VK_NULL_HANDLE;
160 VkDeviceMemory indexBufferMemory = VK_NULL_HANDLE;
162 static void createBuffer(VkDevice device, VkPhysicalDevice physicalDevice, VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, VkBuffer &buffer, VkDeviceMemory &bufferMemory);
164 static uint32_t findMemoryType(VkPhysicalDevice physicalDevice, uint32_t typeFilter, VkMemoryPropertyFlags properties);
166 static void copyBuffer(VkDevice device, VkCommandPool commandPool, VkQueue graphicsQueue, VkBuffer srcBuffer, VkBuffer dstBuffer, VkDeviceSize size);
168 void loadOBJ(
const std::string &path,
float positionScale);
169 void loadMXMOD(
const std::string &path,
float positionScale);
170 void loadMXMODZ(
const std::string &path,
float positionScale);
171 void loadMTL(
const std::string &path);
172 void loadTextureManifest(
const std::string &path,
const std::string &textureBasePath);
void upload(VkDevice device, VkPhysicalDevice physicalDevice, VkCommandPool commandPool, VkQueue graphicsQueue)
Upload parsed geometry to device-local GPU buffers.