Index: vulkan-game.cpp
===================================================================
--- vulkan-game.cpp	(revision f97c5e78e8f533e4b803e95b4dbb4ec3f1358ff3)
+++ vulkan-game.cpp	(revision 1802a418ac0026c85d2a8724ad0cb462308d852d)
@@ -27,4 +27,5 @@
 
    modelMvpMats = {};
+   shipMvpMats = {};
 }
 
@@ -245,4 +246,245 @@
    overlayPipeline.createDescriptorSets(swapChainImages);
 
+   shipPipeline.addAttribute(VK_FORMAT_R32G32B32_SFLOAT, offset_of(&ShipVertex::pos));
+   shipPipeline.addAttribute(VK_FORMAT_R32G32B32_SFLOAT, offset_of(&ShipVertex::color));
+
+   createUniformBuffers<UBO_MvpMat>(uniformBuffers_shipPipeline, uniformBuffersMemory_shipPipeline, uniformBufferInfoList_shipPipeline);
+
+   shipPipeline.addDescriptorInfo(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
+      VK_SHADER_STAGE_VERTEX_BIT, &uniformBufferInfoList_shipPipeline);
+
+   shipPipeline.addObject({
+         //back
+         {{ -0.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+
+         // left back
+         {{ -0.5f,   0.3f,  -2.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.0f,  -2.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.3f,  -2.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+
+         // right back
+         {{  0.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.0f,  -2.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.0f,  -2.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.3f,  -2.0f}, {0.0f, 0.0f, 0.3f}},
+
+         // left mid
+         {{-0.25f,   0.3f,  -3.0f}, {0.0f, 0.0f, 0.3f}},
+         {{-0.25f,   0.0f,  -3.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.0f,  -2.0f}, {0.0f, 0.0f, 0.3f}},
+         {{-0.25f,   0.3f,  -3.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.0f,  -2.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.3f,  -2.0f}, {0.0f, 0.0f, 0.3f}},
+
+         // right mid
+         {{  0.5f,   0.3f,  -2.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.0f,  -2.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ 0.25f,   0.0f,  -3.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.3f,  -2.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ 0.25f,   0.0f,  -3.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ 0.25f,   0.3f,  -3.0f}, {0.0f, 0.0f, 0.3f}},
+
+         // left front
+         {{  0.0f,   0.0f,  -3.5f}, {0.0f, 0.0f, 1.0f}},
+         {{-0.25f,   0.0f,  -3.0f}, {0.0f, 0.0f, 1.0f}},
+         {{-0.25f,   0.3f,  -3.0f}, {0.0f, 0.0f, 1.0f}},
+
+         // right front
+         {{ 0.25f,   0.3f,  -3.0f}, {0.0f, 0.0f, 1.0f}},
+         {{ 0.25f,   0.0f,  -3.0f}, {0.0f, 0.0f, 1.0f}},
+         {{  0.0f,   0.0f,  -3.5f}, {0.0f, 0.0f, 1.0f}},
+
+         // top back
+         {{ -0.5f,   0.3f,  -2.0f}, {0.0f, 0.0f, 1.0f}},
+         {{ -0.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 1.0f}},
+         {{  0.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 1.0f}},
+         {{ -0.5f,   0.3f,  -2.0f}, {0.0f, 0.0f, 1.0f}},
+         {{  0.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 1.0f}},
+         {{  0.5f,   0.3f,  -2.0f}, {0.0f, 0.0f, 1.0f}},
+
+         // bottom back
+         {{ -0.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 1.0f}},
+         {{ -0.5f,   0.0f,  -2.0f}, {0.0f, 0.0f, 1.0f}},
+         {{  0.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 1.0f}},
+         {{  0.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 1.0f}},
+         {{ -0.5f,   0.0f,  -2.0f}, {0.0f, 0.0f, 1.0f}},
+         {{  0.5f,   0.0f,  -2.0f}, {0.0f, 0.0f, 1.0f}},
+
+         // top mid
+         {{-0.25f,   0.3f, -3.0f}, {0.0f, 0.0f, 1.0f}},
+         {{ -0.5f,   0.3f, -2.0f}, {0.0f, 0.0f, 1.0f}},
+         {{  0.5f,   0.3f, -2.0f}, {0.0f, 0.0f, 1.0f}},
+         {{ -0.25f,  0.3f, -3.0f}, {0.0f, 0.0f, 1.0f}},
+         {{  0.5f,   0.3f, -2.0f}, {0.0f, 0.0f, 1.0f}},
+         {{ 0.25f,   0.3f, -3.0f}, {0.0f, 0.0f, 1.0f}},
+
+         // bottom mid
+         {{ -0.5f,   0.0f,  -2.0f}, {0.0f, 0.0f, 1.0f}},
+         {{-0.25f,   0.0f,  -3.0f}, {0.0f, 0.0f, 1.0f}},
+         {{  0.5f,   0.0f,  -2.0f}, {0.0f, 0.0f, 1.0f}},
+         {{  0.5f,   0.0f,  -2.0f}, {0.0f, 0.0f, 1.0f}},
+         {{-0.25f,   0.0f,  -3.0f}, {0.0f, 0.0f, 1.0f}},
+         {{ 0.25f,   0.0f,  -3.0f}, {0.0f, 0.0f, 1.0f}},
+
+         // top front
+         {{-0.25f,   0.3f,  -3.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ 0.25f,   0.3f,  -3.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.0f,   0.0f,  -3.5f}, {0.0f, 0.0f, 0.3f}},
+
+         // bottom front
+         {{ 0.25f,   0.0f,  -3.0f}, {0.0f, 0.0f, 0.3f}},
+         {{-0.25f,   0.0f,  -3.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.0f,   0.0f,  -3.5f}, {0.0f, 0.0f, 0.3f}},
+
+         // left wing start back
+         {{ -1.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -1.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -1.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+
+         // left wing start top
+         {{ -0.5f,   0.3f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{ -1.3f,   0.3f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{ -1.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.3f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{ -1.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+
+         // left wing start front
+         {{ -0.5f,   0.3f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{ -1.3f,   0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.3f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{ -1.3f,   0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{ -1.3f,   0.3f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+
+         // left wing start bottom
+         {{ -0.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -1.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -1.3f,   0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -1.3f,   0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{ -0.5f,   0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+
+         // left wing end outside
+         {{ -1.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -2.2f,   0.15f, -0.8f}, {0.0f, 0.0f, 0.3f}},
+         {{ -1.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+
+         // left wing end top
+         {{ -1.3f,   0.3f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{ -2.2f,   0.15f, -0.8f}, {0.0f, 0.0f, 0.3f}},
+         {{ -1.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+
+         // left wing end front
+         {{ -1.3f,   0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{ -2.2f,  0.15f,  -0.8f}, {0.0f, 0.0f, 0.3f}},
+         {{ -1.3f,   0.3f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+
+         // left wing end bottom
+         {{ -1.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ -2.2f,  0.15f,  -0.8f}, {0.0f, 0.0f, 0.3f}},
+         {{ -1.3f,   0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+
+         // right wing start back
+         {{  1.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  1.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  1.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+
+         // right wing start top
+         {{  1.3f,   0.3f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.3f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{  1.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  1.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.3f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+
+         // right wing start front
+         {{  0.5f,   0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.3f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{  1.3f,   0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{  1.3f,   0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.3f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{  1.3f,   0.3f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+
+         // right wing start bottom
+         {{  1.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  0.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ 1.3f,    0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{ 1.3f,    0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{ 0.5f,    0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{ 0.5f,    0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+
+         // right wing end outside
+         {{  2.2f,   0.15f, -0.8f}, {0.0f, 0.0f, 0.3f}},
+         {{  1.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  1.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+
+         // right wing end top
+         {{  2.2f,  0.15f,  -0.8f}, {0.0f, 0.0f, 0.3f}},
+         {{  1.3f,   0.3f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{  1.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+
+         // right wing end front
+         {{  2.2f,   0.15f,  -0.8f}, {0.0f, 0.0f, 0.3f}},
+         {{  1.3f,   0.0f,   -0.3f}, {0.0f, 0.0f, 0.3f}},
+         {{  1.3f,   0.3f,   -0.3f}, {0.0f, 0.0f, 0.3f}},
+
+         // right wing end bottom
+         {{  2.2f,  0.15f,  -0.8f}, {0.0f, 0.0f, 0.3f}},
+         {{  1.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
+         {{  1.3f,   0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
+      }, {
+           0,   1,   2,   3,   4,   5,
+           6,   7,   8,   9,  10,  11,
+          12,  13,  14,  15,  16,  17,
+          18,  19,  20,  21,  22,  23,
+          24,  25,  26,  27,  28,  29,
+          30,  31,  32,
+          33,  34,  35,
+          36,  37,  38,  39,  40,  41,
+          42,  43,  44,  45,  46,  47,
+          48,  49,  50,  51,  52,  53,
+          54,  55,  56,  57,  58,  59,
+          60,  61,  62,
+          63,  64,  65,
+          66,  67,  68,  69,  70,  71,
+          72,  73,  74,  75,  76,  77,
+          78,  79,  80,  81,  82,  83,
+          84,  85,  86,  87,  88,  89,
+          90,  91,  92,
+          93,  94,  95,
+          96,  97,  98,
+          99, 100, 101,
+         102, 103, 104, 105, 106, 107,
+         108, 109, 110, 111, 112, 113,
+         114, 115, 116, 117, 118, 119,
+         120, 121, 122, 123, 124, 125,
+         126, 127, 128,
+         129, 130, 131,
+         132, 133, 134,
+         135, 136, 137,
+      }, commandPool, graphicsQueue);
+
+   shipPipeline.createDescriptorSetLayout();
+   shipPipeline.createPipeline("shaders/ship-vert.spv", "shaders/ship-frag.spv");
+   shipPipeline.createDescriptorPool(swapChainImages);
+   shipPipeline.createDescriptorSets(swapChainImages);
+
    cout << "Created all the graphics pipelines" << endl;
 
@@ -258,4 +500,7 @@
    overlayPipeline = GraphicsPipeline_Vulkan<OverlayVertex>(physicalDevice, device, renderPass,
       { 0, 0, (int)swapChainExtent.width, (int)swapChainExtent.height }, 4, 6);
+
+   shipPipeline = GraphicsPipeline_Vulkan<ShipVertex>(physicalDevice, device, renderPass,
+      { 0, 0, (int)swapChainExtent.width, (int)swapChainExtent.height }, 138, 138);
 }
 
@@ -280,4 +525,11 @@
    modelMvpMats.view = view;
    modelMvpMats.proj = proj;
+
+   mat4 T_model = translate(mat4(1.0f), vec3(0.0f, -1.2f, 1.65f));
+   mat4 R_model(1.0f);
+
+   shipMvpMats.model = T_model * R_model * scale(mat4(1.0f), vec3(0.1f, 0.1f, 0.1f));
+   shipMvpMats.view = view;
+   shipMvpMats.proj = proj;
 }
 
@@ -363,4 +615,6 @@
 
    VulkanUtils::copyDataToMemory(device, uniformBuffersMemory[currentImage], modelMvpMats);
+
+   VulkanUtils::copyDataToMemory(device, uniformBuffersMemory_shipPipeline[currentImage], shipMvpMats);
 }
 
@@ -465,4 +719,5 @@
    modelPipeline.cleanupBuffers();
    overlayPipeline.cleanupBuffers();
+   shipPipeline.cleanupBuffers();
 
    for (size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) {
@@ -945,4 +1200,7 @@
 
       modelPipeline.createRenderCommands(commandBuffers[i], i);
+      shipPipeline.createRenderCommands(commandBuffers[i], i);
+
+      // Always render this pipeline last
       overlayPipeline.createRenderCommands(commandBuffers[i], i);
 
@@ -1011,4 +1269,11 @@
    overlayPipeline.createDescriptorSets(swapChainImages);
 
+   createUniformBuffers<UBO_MvpMat>(uniformBuffers_shipPipeline, uniformBuffersMemory_shipPipeline, uniformBufferInfoList_shipPipeline);
+
+   shipPipeline.updateRenderPass(renderPass);
+   shipPipeline.createPipeline("shaders/ship-vert.spv", "shaders/ship-frag.spv");
+   shipPipeline.createDescriptorPool(swapChainImages);
+   shipPipeline.createDescriptorSets(swapChainImages);
+
    createCommandBuffers();
 }
@@ -1025,4 +1290,5 @@
    modelPipeline.cleanup();
    overlayPipeline.cleanup();
+   shipPipeline.cleanup();
 
    vkDestroyRenderPass(device, renderPass, nullptr);
@@ -1038,3 +1304,8 @@
       vkFreeMemory(device, uniformBuffersMemory[i], nullptr);
    }
-}
+
+   for (size_t i = 0; i < uniformBuffers_shipPipeline.size(); i++) {
+      vkDestroyBuffer(device, uniformBuffers_shipPipeline[i], nullptr);
+      vkFreeMemory(device, uniformBuffersMemory_shipPipeline[i], nullptr);
+   }
+}
