Creating geometry with a buffer resource
In this section, we will create a simple geometrical shape--a triangle. This will be stored in the GPU memory with the help of a buffer resource. Most applications will consume buffers through uniform or storage blocks. The implementation of a buffer resource is very similar to that of an image resource, except the fact that here we would not need to create the buffer view (VkBufferView
).
Preparing geometry data
Create MeshData.h
and define the geometry data inside it. Declare the following structures:
/*---------------------MeshData.h-----------------------*/ // Mesh data structure and Vertex Data struct VertexWithColor { float x, y, z, w; // Vertex Position float r, g, b, a; // Color format Red, Green, Blue, Alpha }; // Interleaved data containing position and color information static const VertexWithColor triangleData[] = { { 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f...