From 9477f686c6f432f597e109878963909e27885160 Mon Sep 17 00:00:00 2001 From: JimmyBinoculars Date: Fri, 20 Feb 2026 18:50:50 +0000 Subject: [PATCH] cve_model done? --- cve_model.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/cve_model.cpp b/cve_model.cpp index 5807794..b56d2a7 100644 --- a/cve_model.cpp +++ b/cve_model.cpp @@ -31,4 +31,32 @@ namespace cve { memcpy(data, verticies.data(), static_cast(bufferSize)); vkUnmapMemory(cveDevice.device(), vertexBufferMemory); } + + void CveModel::draw(VkCommandBuffer commandBuffer) { + vkCmdDraw(commandBuffer, vertexCount, 1, 0, 0); + } + + void CveModel::bind(VkCommandBuffer commandBuffer) { + VkBuffer buffers[] = {vertexBuffer}; + VkDeviceSize offsets[] = {0}; + vkCmdBindVertexBuffers(commandBuffer, 0, 1, buffers, offsets); + } + + std::vector CveModel::Vertex::getBindingDescriptions() { + std::vector bindingDescriptions(1); + bindingDescriptions[0].binding = 0; + bindingDescriptions[0].stride = sizeof(Vertex); + bindingDescriptions[0].inputRate = VK_VERTEX_INPUT_RATE_VERTEX; + return bindingDescriptions; + } + + std::vector CveModel::Vertex::getAttributeDescriptions() { + std::vector attributeDescriptions(1); + attributeDescriptions[0].binding = 0; + attributeDescriptions[0].location = 0; + attributeDescriptions[0].format = VK_FORMAT_R32G32_SFLOAT; + attributeDescriptions[0].offset = 0; + + return attributeDescriptions; + } }