Changeset 7297892 in opengl-game for vulkan-game.cpp
- Timestamp:
- Apr 19, 2020, 4:06:03 AM (4 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 73a10ca
- Parents:
- 3950236
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-game.cpp
r3950236 r7297892 707 707 laserObjects[leftLaserIdx].modified = true; 708 708 leftLaserIdx = -1; 709 710 if (leftLaserEffect != nullptr) { 711 leftLaserEffect->deleted = true; 712 leftLaserEffect = nullptr; 713 } 709 714 } else if (e.key.keycode == SDL_SCANCODE_X && rightLaserIdx != -1) { 710 715 laserObjects[rightLaserIdx].ssbo.deleted = true; 711 716 laserObjects[rightLaserIdx].modified = true; 712 717 rightLaserIdx = -1; 718 719 if (rightLaserEffect != nullptr) { 720 rightLaserEffect->deleted = true; 721 rightLaserEffect = nullptr; 722 } 713 723 } 714 724 break; … … 786 796 } 787 797 798 for (vector<BaseEffectOverTime*>::iterator it = effects.begin(); it != effects.end(); ) { 799 if ((*it)->deleted) { 800 delete *it; 801 it = effects.erase(it); 802 } else { 803 BaseEffectOverTime* eot = *it; 804 805 eot->applyEffect(); 806 807 it++; 808 } 809 } 810 788 811 for (SceneObject<AsteroidVertex, SSBO_Asteroid>& asteroid : this->asteroidObjects) { 789 812 if (!asteroid.ssbo.deleted) { 790 813 vec3 objCenter = vec3(viewMat * vec4(asteroid.center, 1.0f)); 791 814 792 if ((objCenter.z - asteroid.radius) > -NEAR_CLIP ) {815 if ((objCenter.z - asteroid.radius) > -NEAR_CLIP || asteroid.ssbo.hp <= 0.0f) { 793 816 asteroid.ssbo.deleted = true; 794 817 … … 1663 1686 1664 1687 if (laser.targetAsteroid != closestAsteroid) { 1688 if (laser.targetAsteroid != nullptr) { 1689 if (index == leftLaserIdx && leftLaserEffect != nullptr) { 1690 leftLaserEffect->deleted = true; 1691 } else if (index == rightLaserIdx && rightLaserEffect != nullptr) { 1692 rightLaserEffect->deleted = true; 1693 } 1694 } 1695 1696 EffectOverTime<AsteroidVertex, SSBO_Asteroid>* eot = nullptr; 1697 1698 if (closestAsteroid != nullptr) { 1699 // TODO: Use some sort of smart pointer instead 1700 eot = new EffectOverTime(asteroidPipeline, asteroidObjects, closestAsteroidIndex, 1701 offset_of(&SSBO_Asteroid::hp), -20.0f); 1702 effects.push_back(eot); 1703 } 1704 1705 if (index == leftLaserIdx) { 1706 leftLaserEffect = eot; 1707 } else if (index == rightLaserIdx) { 1708 rightLaserEffect = eot; 1709 } 1710 1665 1711 laser.targetAsteroid = closestAsteroid; 1666 1712 }
Note:
See TracChangeset
for help on using the changeset viewer.