Changeset 2da64ef in opengl-game for vulkan-game.hpp
- Timestamp:
- Feb 19, 2020, 4:47:41 PM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 3b84bb6
- Parents:
- 860a0da
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-game.hpp
r860a0da r2da64ef 75 75 }; 76 76 77 // Have to figure out how to include an optional ssbo parameter for each object 78 // Could probably use the same approach to make indices optional 79 77 80 class VulkanGame { 78 81 public: … … 158 161 159 162 UBO_VP_mats object_VP_mats; 160 SSBO_ModelObject so_Object;161 163 162 164 GraphicsPipeline_Vulkan<ShipVertex, SSBO_ModelObject> shipPipeline; … … 168 170 169 171 UBO_VP_mats ship_VP_mats; 170 SSBO_ModelObject so_Ship;171 172 172 173 GraphicsPipeline_Vulkan<AsteroidVertex, SSBO_Asteroid> asteroidPipeline; … … 178 179 179 180 UBO_VP_mats asteroid_VP_mats; 180 SSBO_Asteroid so_Asteroid;181 181 182 182 Uint64 curTime, prevTime; … … 219 219 const vector<VertexType>& vertices, vector<uint16_t> indices, SSBOType ssbo); 220 220 221 template<class VertexType, class SSBOType> 222 void updateObject(vector<SceneObject<VertexType, SSBOType>>& objects, 223 GraphicsPipeline_Vulkan<VertexType, SSBOType>& pipeline, size_t index); 224 221 225 template<class VertexType> 222 226 vector<VertexType> addVertexNormals(vector<VertexType> vertices); … … 227 231 template<class VertexType> 228 232 vector<VertexType> centerObject(vector<VertexType> vertices); 229 230 template<class VertexType, class SSBOType>231 void transformObject(SceneObject<VertexType, SSBOType>& obj, mat4 mat);232 233 233 234 void createBufferSet(VkDeviceSize bufferSize, VkBufferUsageFlags flags, … … 258 259 259 260 pipeline.addVertices(vertices, indices, commandPool, graphicsQueue); 261 } 262 263 template<class VertexType, class SSBOType> 264 void VulkanGame::updateObject(vector<SceneObject<VertexType, SSBOType>>& objects, 265 GraphicsPipeline_Vulkan<VertexType, SSBOType>& pipeline, size_t index) { 266 SceneObject<VertexType, SSBOType>& obj = objects[index]; 267 268 obj.ssbo.model = obj.model_transform * obj.model_base; 269 270 // could probably re-calculate the object center here based on model 271 // I think the center should be calculated by using model * vec3(0, 0, 0) 272 // model_base is currently only used to set the original location of the ship and asteroids 273 274 pipeline.updateObject(index, obj.ssbo); 260 275 } 261 276 … … 326 341 } 327 342 328 template<class VertexType, class SSBOType>329 void VulkanGame::transformObject(SceneObject<VertexType, SSBOType>& obj, mat4 mat) {330 obj.model_transform = mat * obj.model_transform;331 }332 333 343 #endif // _VULKAN_GAME_H
Note:
See TracChangeset
for help on using the changeset viewer.