代码写完了,下一步调试运行
This commit is contained in:
+30
-1
@@ -4,7 +4,9 @@
|
||||
#include "Application.h"
|
||||
#include "vma/include/vk_mem_alloc.h"
|
||||
#include <map>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtc/matrix_transform.inl>
|
||||
|
||||
struct TextureLoadingVertexStructure
|
||||
{
|
||||
@@ -17,12 +19,22 @@ struct PushConstants {
|
||||
float myValue;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class FaceApp :public Application
|
||||
{
|
||||
public:
|
||||
FaceApp(/* args */);
|
||||
~FaceApp();
|
||||
|
||||
struct
|
||||
{
|
||||
glm::mat4 projection;
|
||||
glm::mat4 model;
|
||||
glm::vec4 view_pos;
|
||||
float lod_bias = 0.0f;
|
||||
} ubo_vs;
|
||||
|
||||
void initVulkan() override;
|
||||
|
||||
|
||||
@@ -30,6 +42,9 @@ public:
|
||||
static FaceApp* Get() { return faceIns; }
|
||||
void update_face_vertex_buffer(float* pos, int pointCount);
|
||||
|
||||
private:
|
||||
glm::vec3 rotation = glm::vec3();
|
||||
glm::vec3 camera_pos = glm::vec3();
|
||||
private:
|
||||
static FaceApp* faceIns;
|
||||
VmaAllocator allocator = nullptr;
|
||||
@@ -37,8 +52,15 @@ private:
|
||||
std::vector<TextureLoadingVertexStructure>& vertices,
|
||||
std::vector<uint32_t>& indices);
|
||||
|
||||
void update_uniform_buffers();
|
||||
|
||||
void createVertexBuffer();
|
||||
void uploadVertexData();
|
||||
VkDescriptorPool descriptor_pool = VK_NULL_HANDLE;
|
||||
void setup_descriptor_pool();
|
||||
void setup_descriptor_set_layout();
|
||||
void setup_descriptor_set();
|
||||
|
||||
void copyBuffer(VkBuffer srcBuffer, VkBuffer dstBuffer, VkDeviceSize size);
|
||||
VkCommandBuffer beginSingleTimeCommands();
|
||||
void endSingleTimeCommands(VkCommandBuffer commandBuffer);
|
||||
@@ -57,6 +79,7 @@ private:
|
||||
VkPipeline m_graphicsPipeline = VK_NULL_HANDLE;
|
||||
VkPipelineLayout m_pipelineLayout = VK_NULL_HANDLE;
|
||||
VkDescriptorSetLayout m_descriptorSetLayout = VK_NULL_HANDLE;
|
||||
VkDescriptorSet m_descriptor_set = VK_NULL_HANDLE;
|
||||
|
||||
|
||||
std::vector<TextureLoadingVertexStructure> obj_vertices;
|
||||
@@ -67,6 +90,12 @@ private:
|
||||
std::mutex mtx_point;
|
||||
long long last_update_time;
|
||||
|
||||
VkBuffer uniform_buffer_vs;
|
||||
VmaAllocation uniform_buffer_allocation; // 需要这个来管理内存
|
||||
void* uniform_buffer_mapped = nullptr; // 映射的内存指针
|
||||
void createUniformBuffer();
|
||||
|
||||
Texture tex_demo0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user