Changeset 0fe8433 in opengl-game for vulkan-game.cpp
- Timestamp:
- Dec 24, 2019, 2:57:03 AM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 3e8cc8b
- Parents:
- cd1cb0f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-game.cpp
rcd1cb0f r0fe8433 207 207 VK_SHADER_STAGE_FRAGMENT_BIT, &floorTextureImageDescriptor); 208 208 209 modelPipeline.addObject({ 209 addObject(modelObjects, modelPipeline, 210 { 210 211 {{-0.5f, -0.5f, -2.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}, 211 212 {{ 0.5f, -0.5f, -2.0f}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}}, … … 214 215 }, { 215 216 0, 1, 2, 2, 3, 0 216 }, commandPool, graphicsQueue); 217 218 modelPipeline.addObject({ 217 }); 218 219 addObject(modelObjects, modelPipeline, 220 { 219 221 {{-0.5f, -0.5f, -1.5f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}, 220 222 {{ 0.5f, -0.5f, -1.5f}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}}, … … 223 225 }, { 224 226 0, 1, 2, 2, 3, 0 225 } , commandPool, graphicsQueue);227 }); 226 228 227 229 modelPipeline.createDescriptorSetLayout(); … … 236 238 VK_SHADER_STAGE_FRAGMENT_BIT, &sdlOverlayImageDescriptor); 237 239 238 overlayPipeline.addObject({ 240 addObject(overlayObjects, overlayPipeline, 241 { 239 242 {{-1.0f, 1.0f, 0.0f}, {0.0f, 1.0f}}, 240 243 {{ 1.0f, 1.0f, 0.0f}, {1.0f, 1.0f}}, … … 243 246 }, { 244 247 0, 1, 2, 2, 3, 0 245 } , commandPool, graphicsQueue);248 }); 246 249 247 250 overlayPipeline.createDescriptorSetLayout(); … … 267 270 // TODO: With the normals, indexing basically becomes pointless since no vertices will have exactly 268 271 // the same data. Add an option to make some pipelines not use indexing 269 shipPipeline.addObject(272 addObject(shipObjects, shipPipeline, 270 273 centerObject<ShipVertex>( 271 addObjectIndex<ShipVertex>(ship Pipeline.getObjects().size(),274 addObjectIndex<ShipVertex>(shipObjects.size(), 272 275 addVertexNormals<ShipVertex>({ 273 276 //back … … 496 499 132, 133, 134, 497 500 135, 136, 137, 498 } , commandPool, graphicsQueue);501 }); 499 502 500 503 shipPipeline.createDescriptorSetLayout(); … … 509 512 createSyncObjects(); 510 513 511 ship Pipeline.getObjects()[0].model_base =514 shipObjects[0].model_base = 512 515 translate(mat4(1.0f), vec3(0.0f, -1.2f, 1.65f)) * 513 516 scale(mat4(1.0f), vec3(0.1f, 0.1f, 0.1f)); … … 575 578 } else if (e.key.keycode == SDL_SCANCODE_SPACE) { 576 579 cout << "Adding a plane" << endl; 577 float zOffset = -2.0f + (0.5f * model Pipeline.getObjects().size());580 float zOffset = -2.0f + (0.5f * modelObjects.size()); 578 581 579 582 vkDeviceWaitIdle(device); 580 583 vkFreeCommandBuffers(device, commandPool, static_cast<uint32_t>(commandBuffers.size()), commandBuffers.data()); 581 584 582 modelPipeline.addObject({ 583 {{-0.5f, -0.5f, zOffset}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}, 584 {{ 0.5f, -0.5f, zOffset}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}}, 585 {{ 0.5f, 0.5f, zOffset}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, 586 {{-0.5f, 0.5f, zOffset}, {1.0f, 1.0f, 1.0f}, {0.0f, 0.0f}} 587 }, { 588 0, 1, 2, 2, 3, 0 589 }, commandPool, graphicsQueue); 585 addObject(modelObjects, modelPipeline, 586 { 587 {{-0.5f, -0.5f, zOffset}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}, 588 {{ 0.5f, -0.5f, zOffset}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}}, 589 {{ 0.5f, 0.5f, zOffset}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, 590 {{-0.5f, 0.5f, zOffset}, {1.0f, 1.0f, 1.0f}, {0.0f, 0.0f}} 591 }, { 592 0, 1, 2, 2, 3, 0 593 }); 590 594 591 595 createCommandBuffers(); … … 615 619 616 620 if (gui->keyPressed(SDL_SCANCODE_LEFT)) { 617 transformObject(ship Pipeline.getObjects()[0], translate(mat4(1.0f), vec3(-0.01f, 0.0f, 0.0f)));621 transformObject(shipObjects[0], translate(mat4(1.0f), vec3(-0.01f, 0.0f, 0.0f))); 618 622 } else if (gui->keyPressed(SDL_SCANCODE_RIGHT)) { 619 transformObject(ship Pipeline.getObjects()[0], translate(mat4(1.0f), vec3(0.01f, 0.0f, 0.0f)));623 transformObject(shipObjects[0], translate(mat4(1.0f), vec3(0.01f, 0.0f, 0.0f))); 620 624 } 621 625 … … 641 645 rotate(mat4(1.0f), time * radians(90.0f), vec3(0.0f, 0.0f, 1.0f)); 642 646 643 so_Ship.model = ship Pipeline.getObjects()[0].model_transform * shipPipeline.getObjects()[0].model_base;647 so_Ship.model = shipObjects[0].model_transform * shipObjects[0].model_base; 644 648 645 649 VulkanUtils::copyDataToMemory(device, uniformBuffersMemory_scenePipeline[currentImage], object_VP_mats);
Note:
See TracChangeset
for help on using the changeset viewer.