Vertex positions no longer hard coded
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
namespace cve {
|
||||
FirstApp::FirstApp() {
|
||||
loadModels();
|
||||
createPipelineLayout();
|
||||
createPipeline();
|
||||
createCommandBuffers();
|
||||
@@ -22,6 +23,17 @@ namespace cve {
|
||||
|
||||
vkDeviceWaitIdle(cveDevice.device());
|
||||
}
|
||||
|
||||
void FirstApp::loadModels() {
|
||||
std::vector<CveModel::Vertex> verticies {
|
||||
{{0.0f, -0.5f}},
|
||||
{{0.5f, 0.5f}},
|
||||
{{-0.5f, 0.5f}}
|
||||
};
|
||||
|
||||
cveModel = std::make_unique<CveModel>(cveDevice, verticies);
|
||||
}
|
||||
|
||||
void FirstApp::createPipelineLayout() {
|
||||
VkPipelineLayoutCreateInfo pipelineLayoutInfo{};
|
||||
pipelineLayoutInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
|
||||
@@ -86,7 +98,8 @@ namespace cve {
|
||||
vkCmdBeginRenderPass(commandBuffers[i], &renderPassInfo, VK_SUBPASS_CONTENTS_INLINE);
|
||||
|
||||
cvePipeline->bind(commandBuffers[i]);
|
||||
vkCmdDraw(commandBuffers[i], 3, 1, 0, 0);
|
||||
cveModel->bind(commandBuffers[i]);
|
||||
cveModel->draw(commandBuffers[i]);
|
||||
|
||||
vkCmdEndRenderPass(commandBuffers[i]);
|
||||
if (vkEndCommandBuffer(commandBuffers[i]) != VK_SUCCESS) {
|
||||
|
||||
Reference in New Issue
Block a user