Changeset 0fe8433 in opengl-game for graphics-pipeline_vulkan.hpp
- Timestamp:
- Dec 24, 2019, 2:57:03 AM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 3e8cc8b
- Parents:
- cd1cb0f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
graphics-pipeline_vulkan.hpp
rcd1cb0f r0fe8433 29 29 vector<VkDescriptorBufferInfo>* bufferDataList; 30 30 VkDescriptorImageInfo* imageData; 31 };32 33 // TODO: Change the index type to uint32_t and check the Vulkan Tutorial loading model section as a reference34 // TODO: Create a typedef for index type so I can easily change uin16_t to something else later35 template<class VertexType>36 struct SceneObject {37 vector<VertexType> vertices;38 vector<uint16_t> indices;39 40 mat4 model_base;41 mat4 model_transform;42 31 }; 43 32 … … 50 39 ~GraphicsPipeline_Vulkan(); 51 40 41 size_t getNumVertices(); 42 52 43 void updateRenderPass(VkRenderPass renderPass); 53 44 … … 66 57 void createRenderCommands(VkCommandBuffer& commandBuffer, uint32_t currentImage); 67 58 68 vector<SceneObject<VertexType>>& getObjects(); 69 void addObject(const vector<VertexType>& vertices, vector<uint16_t> indices, VkCommandPool commandPool, 59 void addVertices(const vector<VertexType>& vertices, vector<uint16_t> indices, VkCommandPool commandPool, 70 60 VkQueue graphicsQueue); 71 61 … … 100 90 VkDeviceMemory indexBufferMemory; 101 91 102 // TODO: The objects vector isn't used at all in this class, except in the method that returns103 // the number of objects. Move this vector and the SceneObject declaration into VulkanGame, esp.104 // since I'll be adding other object-specific fields such as transforms to SceneObject later105 vector<SceneObject<VertexType>> objects;106 107 92 VkShaderModule createShaderModule(const vector<char>& code); 108 93 vector<char> readFile(const string& filename); … … 151 136 template<class VertexType> 152 137 GraphicsPipeline_Vulkan<VertexType>::~GraphicsPipeline_Vulkan() { 138 } 139 140 template<class VertexType> 141 size_t GraphicsPipeline_Vulkan<VertexType>::getNumVertices() { 142 return numVertices; 153 143 } 154 144 … … 422 412 423 413 template<class VertexType> 424 vector<SceneObject<VertexType>>& GraphicsPipeline_Vulkan<VertexType>::getObjects() { 425 return objects; 426 } 427 428 template<class VertexType> 429 void GraphicsPipeline_Vulkan<VertexType>::addObject(const vector<VertexType>& vertices, vector<uint16_t> indices, 414 void GraphicsPipeline_Vulkan<VertexType>::addVertices(const vector<VertexType>& vertices, vector<uint16_t> indices, 430 415 VkCommandPool commandPool, VkQueue graphicsQueue) { 431 416 … … 436 421 resizeIndexBuffer(commandPool, graphicsQueue); 437 422 } 438 439 for (uint16_t& idx : indices) {440 idx += numVertices;441 }442 objects.push_back({ vertices, indices, mat4(1.0f), mat4(1.0f) });443 423 444 424 VulkanUtils::copyDataToBuffer(device, physicalDevice, commandPool, vertices, vertexBuffer, numVertices,
Note:
See TracChangeset
for help on using the changeset viewer.