Changeset 845a2cb in opengl-game for vulkan-game.hpp
- Timestamp:
- Apr 22, 2020, 12:58:07 AM (4 years ago)
- Branches:
- points-test
- Parents:
- 73a10ca
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-game.hpp
r73a10ca r845a2cb 57 57 }; 58 58 59 struct UBO_VP_mats { 60 alignas(16) mat4 view; 61 alignas(16) mat4 proj; 59 struct ExplosionVertex { 60 vec3 particleStartVelocity; 61 float particleStartTime; 62 unsigned int objIndex; 62 63 }; 63 64 … … 76 77 alignas(4) vec3 color; 77 78 alignas(4) unsigned int deleted; 79 }; 80 81 struct SSBO_Explosion { 82 alignas(16) mat4 model; 83 alignas(4) float explosionStartTime; 84 alignas(4) float explosionDuration; 85 alignas(4) unsigned int deleted; 86 }; 87 88 struct UBO_VP_mats { 89 alignas(16) mat4 view; 90 alignas(16) mat4 proj; 91 }; 92 93 struct UBO_Explosion { 94 alignas(16) mat4 view; 95 alignas(16) mat4 proj; 96 alignas(4) float cur_time; 78 97 }; 79 98 … … 175 194 176 195 private: 196 // TODO: Make these consts static 197 177 198 const int MAX_FRAMES_IN_FLIGHT; 178 199 … … 180 201 const float FAR_CLIP = 100.0f; 181 202 const float FOV_ANGLE = 67.0f; // means the camera lens goes from -33 deg to 33 def 203 204 const int EXPLOSION_PARTICLE_COUNT = 300; 182 205 183 206 vec3 cam_pos; … … 285 308 286 309 UBO_VP_mats laser_VP_mats; 310 311 GraphicsPipeline_Vulkan<ExplosionVertex, SSBO_Explosion> explosionPipeline; 312 vector<SceneObject<ExplosionVertex, SSBO_Explosion>> explosionObjects; 313 314 vector<VkBuffer> uniformBuffers_explosionPipeline; 315 vector<VkDeviceMemory> uniformBuffersMemory_explosionPipeline; 316 vector<VkDescriptorBufferInfo> uniformBufferInfoList_explosionPipeline; 317 318 UBO_Explosion explosion_UBO; 287 319 288 320 vector<BaseEffectOverTime*> effects; … … 334 366 void createSyncObjects(); 335 367 336 void addLaser(vec3 start, vec3 end, vec3 color, float width);337 void translateLaser(size_t index, const vec3& translation);338 void updateLaserTarget(size_t index);339 bool getLaserAndAsteroidIntersection(SceneObject<AsteroidVertex, SSBO_Asteroid>& asteroid,340 vec3& start, vec3& end, vec3& intersection);341 342 368 // TODO: Since addObject() returns a reference to the new object now, 343 369 // stop using objects.back() to access the object that was just created … … 366 392 void centerObject(SceneObject<VertexType, SSBOType>& object); 367 393 394 void addLaser(vec3 start, vec3 end, vec3 color, float width); 395 void translateLaser(size_t index, const vec3& translation); 396 void updateLaserTarget(size_t index); 397 bool getLaserAndAsteroidIntersection(SceneObject<AsteroidVertex, SSBO_Asteroid>& asteroid, 398 vec3& start, vec3& end, vec3& intersection); 399 400 void addExplosion(mat4 model_mat, float duration, float cur_time); 401 368 402 void createBufferSet(VkDeviceSize bufferSize, VkBufferUsageFlags flags, 369 403 vector<VkBuffer>& buffers, vector<VkDeviceMemory>& buffersMemory, … … 380 414 void* pUserData); 381 415 }; 416 417 // Start of specialized no-op functions 418 419 template<> 420 inline void VulkanGame::centerObject(SceneObject<ExplosionVertex, SSBO_Explosion>& object) { 421 } 422 423 // End of specialized no-op functions 382 424 383 425 // TODO: Right now, it's basically necessary to pass the identity matrix in for ssbo.model … … 407 449 SceneObject<VertexType, SSBOType>& obj = objects.back(); 408 450 409 if (!is_same_v<VertexType, LaserVertex> ) {451 if (!is_same_v<VertexType, LaserVertex> && !is_same_v<VertexType, ExplosionVertex>) { 410 452 centerObject(obj); 411 453 }
Note:
See TracChangeset
for help on using the changeset viewer.