From: Eleni Maria Stea Date: Sun, 11 Mar 2018 18:49:26 +0000 (+0200) Subject: more buffers X-Git-Url: http://git.mutantstargoat.com?p=demo;a=commitdiff_plain;h=8d1aef17df1bf15491ce4fd35242adcd58a9c411 more buffers --- diff --git a/src/vulkan/mesh-vk.cc b/src/vulkan/mesh-vk.cc index c190199..2c55013 100644 --- a/src/vulkan/mesh-vk.cc +++ b/src/vulkan/mesh-vk.cc @@ -47,14 +47,36 @@ bool MeshVK::update_vertex_data() return false; } - /* create vertex buffer */ + /* create the buffers */ if(!(vk_vertices = vku_create_buffer(vertices.size() * sizeof(Vec3), VK_BUFFER_USAGE_VERTEX_BUFFER_BIT))) { - fprintf(stderr, "Failed to create vertex buffer.\n"); + fprintf(stderr, "Failed to create the buffer for the vertices.\n"); return false; } + if(!(vk_normals = vku_create_buffer(normals.size() * sizeof(Vec3), + VK_BUFFER_USAGE_VERTEX_BUFFER_BIT))) { + fprintf(stderr, "Failed to create the buffer for the normals.\n"); + return false; + } + + if(!(vk_tex_coords = vku_create_buffer(tex_coords.size() * sizeof(Vec2), + VK_BUFFER_USAGE_VERTEX_BUFFER_BIT))) { + fprintf(stderr, + "Failed to create the buffer for the texture coordinates.\n"); + return false; + } + + if(!(vk_indices = vku_create_buffer(indices.size() * 2, + VK_BUFFER_USAGE_INDEX_BUFFER_BIT))) { + fprintf(stderr, "Failed to create the indices buffer.\n"); + return false; + } + + //TODO XXX + /* map the buffers */ + return true; }