Changeset c1ec4f6 in opengl-game for vulkan-game.cpp
- Timestamp:
- Jun 11, 2021, 2:35:32 PM (3 years ago)
- Branches:
- feature/imgui-sdl
- Children:
- 6486ba8
- Parents:
- b7fc3c2
- git-author:
- Dmitry Portnoy <dportnoy@…> (06/10/21 21:37:02)
- git-committer:
- Dmitry Portnoy <dportnoy@…> (06/11/21 14:35:32)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-game.cpp
rb7fc3c2 rc1ec4f6 151 151 SceneObject<ModelVertex, SSBO_ModelObject>* texturedSquare = nullptr; 152 152 153 // TODO: Ideally, avoid having to make the squares as modified upon creation154 155 153 texturedSquare = &addObject(modelObjects, modelPipeline, 156 154 addObjectIndex<ModelVertex>(modelObjects.size(), … … 171 169 texturedSquare->model_base = 172 170 translate(mat4(1.0f), vec3(0.0f, 0.0f, -2.0f)); 173 texturedSquare->modified = true;174 171 175 172 texturedSquare = &addObject(modelObjects, modelPipeline, … … 191 188 texturedSquare->model_base = 192 189 translate(mat4(1.0f), vec3(0.0f, 0.0f, -1.5f)); 193 texturedSquare->modified = true;194 190 195 191 modelPipeline.createDescriptorSetLayout(); … … 453 449 translate(mat4(1.0f), vec3(0.0f, -1.2f, 1.65f)) * 454 450 scale(mat4(1.0f), vec3(0.1f, 0.1f, 0.1f)); 455 ship.modified = true;456 451 457 452 shipPipeline.createDescriptorSetLayout(); … … 791 786 texturedSquare.model_base = 792 787 translate(mat4(1.0f), vec3(0.0f, 0.0f, zOffset)); 793 texturedSquare.modified = true;794 788 // START UNREVIEWED SECTION 795 789 } else if (e.key.keycode == SDL_SCANCODE_Z && leftLaserIdx == -1) { … … 824 818 if (e.key.keycode == SDL_SCANCODE_Z && leftLaserIdx != -1) { 825 819 laserObjects[leftLaserIdx].ssbo.deleted = true; 826 laserObjects[leftLaserIdx].modified = true;827 820 leftLaserIdx = -1; 828 821 … … 833 826 } else if (e.key.keycode == SDL_SCANCODE_X && rightLaserIdx != -1) { 834 827 laserObjects[rightLaserIdx].ssbo.deleted = true; 835 laserObjects[rightLaserIdx].modified = true;836 828 rightLaserIdx = -1; 837 829 … … 872 864 ship.model_transform = translate(mat4(1.0f), vec3(distance, 0.0f, 0.0f)) 873 865 * shipObjects[0].model_transform; 874 ship.modified = true;875 866 876 867 if (leftLaserIdx != -1) { … … 885 876 ship.model_transform = translate(mat4(1.0f), vec3(distance, 0.0f, 0.0f)) 886 877 * shipObjects[0].model_transform; 887 ship.modified = true;888 878 889 879 if (leftLaserIdx != -1) { … … 1026 1016 rotate(mat4(1.0f), radians(60.0f), vec3(1.0f, 1.0f, -1.0f)) * 1027 1017 scale(mat4(1.0f), vec3(0.1f, 0.1f, 0.1f)); 1028 asteroid.modified = true;1029 1018 } 1030 1019 … … 1051 1040 translate(mat4(1.0f), vec3(0.0f, -2.0f, -0.0f)) * 1052 1041 rotate(mat4(1.0f), curTime * radians(90.0f), vec3(0.0f, 0.0f, 1.0f)); 1053 obj.modified = true; 1054 1055 if (obj.modified) { 1056 objData.model = obj.model_transform * obj.model_base; 1057 obj.center = vec3(objData.model * vec4(0.0f, 0.0f, 0.0f, 1.0f)); 1058 1059 obj.modified = false; 1060 1061 updateBufferSet(storageBuffers_modelPipeline, i, objData); 1062 } 1042 1043 objData.model = obj.model_transform * obj.model_base; 1044 obj.center = vec3(objData.model * vec4(0.0f, 0.0f, 0.0f, 1.0f)); 1045 1046 updateBufferSet(storageBuffers_modelPipeline, i, objData); 1063 1047 } 1064 1048 … … 1077 1061 SSBO_ModelObject& objData = obj.ssbo; 1078 1062 1079 if (obj.modified) { 1080 objData.model = obj.model_transform * obj.model_base; 1081 obj.center = vec3(objData.model * vec4(0.0f, 0.0f, 0.0f, 1.0f)); 1082 1083 obj.modified = false; 1084 1085 updateBufferSet(storageBuffers_shipPipeline, i, objData); 1086 } 1063 objData.model = obj.model_transform * obj.model_base; 1064 obj.center = vec3(objData.model * vec4(0.0f, 0.0f, 0.0f, 1.0f)); 1065 1066 updateBufferSet(storageBuffers_shipPipeline, i, objData); 1087 1067 } 1088 1068 … … 1123 1103 } 1124 1104 1125 obj.modified = true;1126 }1127 1128 if (obj.modified) {1129 1105 objData.model = obj.model_transform * obj.model_base; 1130 1106 obj.center = vec3(objData.model * vec4(0.0f, 0.0f, 0.0f, 1.0f)); 1131 1132 obj.modified = false;1133 1107 1134 1108 updateBufferSet(storageBuffers_asteroidPipeline, i, objData); … … 1156 1130 SSBO_Laser& objData = obj.ssbo; 1157 1131 1158 if (obj.modified) { 1159 objData.model = obj.model_transform * obj.model_base; 1160 obj.center = vec3(objData.model * vec4(0.0f, 0.0f, 0.0f, 1.0f)); 1161 1162 obj.modified = false; 1163 1164 updateBufferSet(storageBuffers_laserPipeline, i, objData); 1165 } 1132 objData.model = obj.model_transform * obj.model_base; 1133 obj.center = vec3(objData.model * vec4(0.0f, 0.0f, 0.0f, 1.0f)); 1134 1135 updateBufferSet(storageBuffers_laserPipeline, i, objData); 1166 1136 } 1167 1137 … … 1182 1152 if (curTime > (objData.explosionStartTime + objData.explosionDuration)) { 1183 1153 objData.deleted = true; 1184 obj.modified = true;1185 1154 } 1186 1155 } 1187 1156 1188 if (obj.modified) { 1189 objData.model = obj.model_transform * obj.model_base; 1190 obj.center = vec3(objData.model * vec4(0.0f, 0.0f, 0.0f, 1.0f)); 1191 1192 obj.modified = false; 1193 1194 updateBufferSet(storageBuffers_explosionPipeline, i, objData); 1195 } 1157 objData.model = obj.model_transform * obj.model_base; 1158 obj.center = vec3(objData.model * vec4(0.0f, 0.0f, 0.0f, 1.0f)); 1159 1160 updateBufferSet(storageBuffers_explosionPipeline, i, objData); 1196 1161 } 1197 1162 … … 2083 2048 rotate(mat4(1.0f), yAxisRotation, vec3(0.0f, 1.0f, 0.0f)) * 2084 2049 rotate(mat4(1.0f), xAxisRotation, vec3(1.0f, 0.0f, 0.0f)); 2085 2086 laser.modified = true;2087 2050 } 2088 2051 … … 2115 2078 laser.model_base = rotate(mat4(1.0f), zAxisRotation, vec3(0.0f, 0.0f, 1.0f)); 2116 2079 laser.model_transform = translate(mat4(1.0f), translation) * laser.model_transform; 2117 2118 laser.modified = true;2119 2080 } 2120 2081 … … 2270 2231 explosion.model_base = model_mat; 2271 2232 explosion.model_transform = mat4(1.0f); 2272 2273 explosion.modified = true;2274 2233 } 2275 2234
Note:
See TracChangeset
for help on using the changeset viewer.