#ifndef __FaceApp_H__ #define __FaceApp_H__ #include "Application.h" #include "vma/include/vk_mem_alloc.h" #include struct TextureLoadingVertexStructure { float pos[3]; float uv[2]; float normal[3]; }; struct PushConstants { float myValue; }; class FaceApp :public Application { public: FaceApp(/* args */); ~FaceApp(); void initVulkan() override; void render(VkCommandBuffer commandBuffer) override; static FaceApp* Get() { return faceIns; } void update_face_vertex_buffer(float* pos, int pointCount); private: static FaceApp* faceIns; VmaAllocator allocator = nullptr; bool LoadOBJ(const std::string& filename, std::vector& vertices, std::vector& indices); void createVertexBuffer(); void uploadVertexData(); void copyBuffer(VkBuffer srcBuffer, VkBuffer dstBuffer, VkDeviceSize size); VkCommandBuffer beginSingleTimeCommands(); void endSingleTimeCommands(VkCommandBuffer commandBuffer); // 顶点缓冲区相关 VkBuffer m_vertexBuffer = VK_NULL_HANDLE; VmaAllocation m_vertexBufferAllocation = VK_NULL_HANDLE; VkBuffer m_stagingBuffer = VK_NULL_HANDLE; VmaAllocation m_stagingBufferAllocation = VK_NULL_HANDLE; // 索引缓冲区相关 VkBuffer m_indexBuffer = VK_NULL_HANDLE; VmaAllocation m_indexBufferAllocation = VK_NULL_HANDLE; // 渲染管线和描述符 VkPipeline m_graphicsPipeline = VK_NULL_HANDLE; VkPipelineLayout m_pipelineLayout = VK_NULL_HANDLE; VkDescriptorSetLayout m_descriptorSetLayout = VK_NULL_HANDLE; std::vector obj_vertices; std::vector obj_indices; std::map obj_vertices_map; std::map vertices_map_3dmax; std::mutex mtx_point; long long last_update_time; }; #endif