84 void load(
const std::string &path,
float positionScale = 1.0f);
93 void load(
const std::string &path,
94 const std::string &textureManifestPath,
95 const std::string &textureBasePath,
96 float positionScale = 1.0f);
103 void exportOBJ(
const std::string &objPath,
const std::string &mtlPath =
"")
const;
108 static void exportOBJ(
const std::string &modelPath,
109 const std::string &textureManifestPath,
110 const std::string &textureBasePath,
111 const std::string &objPath,
112 float positionScale = 1.0f);
121 void upload(VkDevice device, VkPhysicalDevice physicalDevice,
122 VkCommandPool commandPool, VkQueue graphicsQueue);
134 void draw(VkCommandBuffer cmd)
const;
141 void drawSubMesh(VkCommandBuffer cmd,
size_t index)
const;
146 [[nodiscard]]
const std::vector<VKVertex> &
vertices()
const {
return verticesData; }
147 [[nodiscard]]
const std::vector<uint32_t> &
indices()
const {
return indicesData; }
148 [[nodiscard]] uint32_t
indexCount()
const {
return static_cast<uint32_t
>(indicesData.size()); }
150 [[nodiscard]] VkBuffer
vertexBuffer()
const {
return vertexBufferHandle; }
151 [[nodiscard]] VkBuffer
indexBuffer()
const {
return indexBufferHandle; }
153 [[nodiscard]]
size_t subMeshCount()
const {
return subMeshList.size(); }
155 [[nodiscard]]
const std::vector<SubMesh> &
subMeshes()
const {
return subMeshList; }
157 [[nodiscard]]
const std::vector<MXMaterial> &
materials()
const {
return materialList; }
158 [[nodiscard]]
const std::string &
mtlLibPath()
const {
return mtlLibraryPath; }
161 std::vector<VKVertex> verticesData{};
162 std::vector<uint32_t> indicesData{};
163 std::vector<SubMesh> subMeshList{};
164 std::vector<MXMaterial> materialList{};
165 std::string mtlLibraryPath{};
167 VkBuffer vertexBufferHandle = VK_NULL_HANDLE;
168 VkDeviceMemory vertexBufferMemory = VK_NULL_HANDLE;
169 VkBuffer indexBufferHandle = VK_NULL_HANDLE;
170 VkDeviceMemory indexBufferMemory = VK_NULL_HANDLE;
172 static void createBuffer(VkDevice device, VkPhysicalDevice physicalDevice,
173 VkDeviceSize size, VkBufferUsageFlags usage,
174 VkMemoryPropertyFlags properties,
175 VkBuffer &buffer, VkDeviceMemory &bufferMemory);
177 static uint32_t findMemoryType(VkPhysicalDevice physicalDevice,
178 uint32_t typeFilter, VkMemoryPropertyFlags properties);
180 static void copyBuffer(VkDevice device, VkCommandPool commandPool,
181 VkQueue graphicsQueue,
182 VkBuffer srcBuffer, VkBuffer dstBuffer, VkDeviceSize size);
184 void loadOBJ(
const std::string &path,
float positionScale);
185 void loadMXMOD(
const std::string &path,
float positionScale);
186 void loadMXMODZ(
const std::string &path,
float positionScale);
187 void loadMTL(
const std::string &path);
188 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.