Changeset a00eb06 in opengl-game for vulkan-game.cpp
- Timestamp:
- Apr 10, 2021, 12:58:17 AM (3 years ago)
- Branches:
- feature/imgui-sdl
- Children:
- 8d92284
- Parents:
- 914bb99
- git-author:
- Dmitry Portnoy <dportnoy@…> (04/10/21 00:49:42)
- git-committer:
- Dmitry Portnoy <dportnoy@…> (04/10/21 00:58:17)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-game.cpp
r914bb99 ra00eb06 117 117 modelPipeline.addAttribute(VK_FORMAT_R32G32B32_SFLOAT, offset_of(&ModelVertex::color)); 118 118 modelPipeline.addAttribute(VK_FORMAT_R32G32_SFLOAT, offset_of(&ModelVertex::texCoord)); 119 modelPipeline.addAttribute(VK_FORMAT_R32G32B32_SFLOAT, offset_of(&ModelVertex::normal)); 119 120 modelPipeline.addAttribute(VK_FORMAT_R32_UINT, offset_of(&ModelVertex::objIndex)); 120 121 … … 131 132 132 133 texturedSquare = &addObject(modelObjects, modelPipeline, 133 addObjectIndex<ModelVertex>(modelObjects.size(), { 134 {{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}, 135 {{ 0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}}, 136 {{ 0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, 137 {{ 0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, 138 {{-0.5f, 0.5f, 0.0f}, {1.0f, 1.0f, 1.0f}, {0.0f, 0.0f}}, 139 {{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}} 140 }), { 141 0, 1, 2, 3, 4, 5 142 }, { 143 mat4(1.0f) 144 }, false); 134 addObjectIndex<ModelVertex>(modelObjects.size(), 135 addVertexNormals<ModelVertex>({ 136 {{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}, 137 {{ 0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}}, 138 {{ 0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, 139 {{ 0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, 140 {{-0.5f, 0.5f, 0.0f}, {1.0f, 1.0f, 1.0f}, {0.0f, 0.0f}}, 141 {{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}} 142 })), { 143 0, 1, 2, 3, 4, 5 144 }, { 145 mat4(1.0f) 146 }, false); 145 147 146 148 texturedSquare->model_base = … … 149 151 150 152 texturedSquare = &addObject(modelObjects, modelPipeline, 151 addObjectIndex<ModelVertex>(modelObjects.size(), { 152 {{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}, 153 {{ 0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}}, 154 {{ 0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, 155 {{ 0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, 156 {{-0.5f, 0.5f, 0.0f}, {1.0f, 1.0f, 1.0f}, {0.0f, 0.0f}}, 157 {{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}} 158 }), { 159 0, 1, 2, 3, 4, 5 160 }, { 161 mat4(1.0f) 162 }, false); 153 addObjectIndex<ModelVertex>(modelObjects.size(), 154 addVertexNormals<ModelVertex>({ 155 {{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}, 156 {{ 0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}}, 157 {{ 0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, 158 {{ 0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, 159 {{-0.5f, 0.5f, 0.0f}, {1.0f, 1.0f, 1.0f}, {0.0f, 0.0f}}, 160 {{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}} 161 })), { 162 0, 1, 2, 3, 4, 5 163 }, { 164 mat4(1.0f) 165 }, false); 163 166 164 167 texturedSquare->model_base = … … 534 537 } 535 538 536 window = (SDL_Window*) 539 window = (SDL_Window*)gui->createWindow("Vulkan Game", width, height, guiFlags & GUI_FLAGS_WINDOW_FULLSCREEN); 537 540 if (window == nullptr) { 538 541 cout << "Window could not be created!" << endl; … … 703 706 SceneObject<ModelVertex, SSBO_ModelObject>& texturedSquare = 704 707 addObject(modelObjects, modelPipeline, 705 addObjectIndex<ModelVertex>(modelObjects.size(), { 706 {{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}, 707 {{ 0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}}, 708 {{ 0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, 709 {{ 0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, 710 {{-0.5f, 0.5f, 0.0f}, {1.0f, 1.0f, 1.0f}, {0.0f, 0.0f}}, 711 {{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}} 712 }), { 713 0, 1, 2, 3, 4, 5 714 }, { 715 mat4(1.0f) 716 }, true); 708 addObjectIndex<ModelVertex>(modelObjects.size(), 709 addVertexNormals<ModelVertex>({ 710 {{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}, 711 {{ 0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}}, 712 {{ 0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, 713 {{ 0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, 714 {{-0.5f, 0.5f, 0.0f}, {1.0f, 1.0f, 1.0f}, {0.0f, 0.0f}}, 715 {{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}} 716 })), { 717 0, 1, 2, 3, 4, 5 718 }, { 719 mat4(1.0f) 720 }, true); 717 721 718 722 texturedSquare.model_base =
Note:
See TracChangeset
for help on using the changeset viewer.