Changeset 6486ba8 in opengl-game for sdl-game.hpp
- Timestamp:
- Jun 11, 2021, 8:12:29 PM (4 years ago)
- Branches:
- feature/imgui-sdl
- Children:
- 5ea0a37
- Parents:
- c1ec4f6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sdl-game.hpp
rc1ec4f6 r6486ba8 93 93 // TODO: Create a typedef for index type so I can easily change uin16_t to something else later 94 94 // TODO: Maybe create a typedef for each of the templated SceneObject types 95 template<class VertexType , class SSBOType>95 template<class VertexType> 96 96 struct SceneObject { 97 97 vector<VertexType> vertices; 98 98 vector<uint16_t> indices; 99 SSBOType ssbo;100 99 101 100 mat4 model_base; … … 109 108 // Move the targetAsteroid stuff out of this class since it is very specific to lasers 110 109 // and makes moving SceneObject into its own header file more problematic 111 SceneObject<ModelVertex , SSBO_Asteroid>* targetAsteroid; // currently only used for lasers112 }; 113 114 // TODO: Have to figure out how to include an optional ssbo parameter for each object110 SceneObject<ModelVertex>* targetAsteroid; // currently only used for lasers 111 }; 112 113 // TODO: Figure out how to include an optional ssbo parameter for each object 115 114 // Could probably use the same approach to make indices optional 116 115 // Figure out if there are sufficient use cases to make either of these optional or is it fine to make … … 238 237 // if there is a need to add other uniform variables to one or more of the shaders 239 238 240 vector<SceneObject<ModelVertex , SSBO_ModelObject>> modelObjects;239 vector<SceneObject<ModelVertex>> modelObjects; 241 240 242 241 UBO_VP_mats object_VP_mats; … … 307 306 // stop using objects.back() to access the object that was just created 308 307 template<class VertexType, class SSBOType> 309 SceneObject<VertexType , SSBOType>& addObject(vector<SceneObject<VertexType, SSBOType>>& objects,310 311 312 308 SceneObject<VertexType>& addObject(vector<SceneObject<VertexType>>& objects, 309 GraphicsPipeline_Vulkan<VertexType>& pipeline, 310 const vector<VertexType>& vertices, vector<uint16_t> indices, 311 VulkanBuffer<SSBOType>& objectBuffer, SSBOType ssbo); 313 312 314 313 template<class VertexType> … … 318 317 vector<VertexType> addVertexNormals(vector<VertexType> vertices); 319 318 320 template<class VertexType , class SSBOType>321 void centerObject(SceneObject<VertexType , SSBOType>& object);319 template<class VertexType> 320 void centerObject(SceneObject<VertexType>& object); 322 321 323 322 void renderFrame(ImDrawData* draw_data); … … 352 351 // Figure out a better way to allow the model matrix to be set during object creation 353 352 template<class VertexType, class SSBOType> 354 SceneObject<VertexType , SSBOType>& VulkanGame::addObject(vector<SceneObject<VertexType, SSBOType>>& objects,355 356 357 353 SceneObject<VertexType>& VulkanGame::addObject(vector<SceneObject<VertexType>>& objects, 354 GraphicsPipeline_Vulkan<VertexType>& pipeline, 355 const vector<VertexType>& vertices, vector<uint16_t> indices, 356 VulkanBuffer<SSBOType>& objectBuffer, SSBOType ssbo) { 358 357 // TODO: Use the model field of ssbo to set the object's model_base 359 358 // currently, the passed-in model is useless since it gets overridden when ssbo.model is recalculated … … 364 363 } 365 364 366 objects.push_back({ vertices, indices, ssbo,mat4(1.0f), mat4(1.0f) });365 objects.push_back({ vertices, indices, mat4(1.0f), mat4(1.0f) }); 367 366 objectBuffer.add(ssbo); 368 367 369 SceneObject<VertexType , SSBOType>& obj = objects.back();368 SceneObject<VertexType>& obj = objects.back(); 370 369 371 370 // TODO: Specify whether to center the object outside of this function or, worst case, maybe … … 410 409 } 411 410 412 template<class VertexType , class SSBOType>413 void VulkanGame::centerObject(SceneObject<VertexType , SSBOType>& object) {411 template<class VertexType> 412 void VulkanGame::centerObject(SceneObject<VertexType>& object) { 414 413 vector<VertexType>& vertices = object.vertices; 415 414
Note:
See TracChangeset
for help on using the changeset viewer.