Changeset 6104594 in opengl-game
- Timestamp:
- Apr 19, 2020, 2:13:02 AM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 237cbec
- Parents:
- 5ba732a
- git-author:
- Dmitry Portnoy <dmitry.portnoy@…> (04/19/20 02:03:38)
- git-committer:
- Dmitry Portnoy <dmitry.portnoy@…> (04/19/20 02:13:02)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-game.cpp
r5ba732a r6104594 598 598 599 599 this->startTime = high_resolution_clock::now(); 600 this->curTime = duration<float, seconds::period>(high_resolution_clock::now() - this->startTime).count();601 602 lastSpawn_asteroid = this->curTime;600 curTime = duration<float, seconds::period>(high_resolution_clock::now() - this->startTime).count(); 601 602 lastSpawn_asteroid = curTime; 603 603 604 604 while (!quit) { 605 605 606 this->prevTime = this->curTime;607 this->curTime = duration<float, seconds::period>(high_resolution_clock::now() - this->startTime).count();608 this->elapsedTime = this->curTime - this->prevTime;606 this->prevTime = curTime; 607 curTime = duration<float, seconds::period>(high_resolution_clock::now() - this->startTime).count(); 608 this->elapsedTime = curTime - this->prevTime; 609 609 610 610 gui->processEvents(); … … 705 705 model.model_transform = 706 706 translate(mat4(1.0f), vec3(0.0f, -2.0f, -0.0f)) * 707 rotate(mat4(1.0f), this->curTime * radians(90.0f), vec3(0.0f, 0.0f, 1.0f));707 rotate(mat4(1.0f), curTime * radians(90.0f), vec3(0.0f, 0.0f, 1.0f)); 708 708 model.modified = true; 709 709 } … … 727 727 } 728 728 729 if ( this->curTime - this->lastSpawn_asteroid > this->spawnRate_asteroid) {730 this->lastSpawn_asteroid = this->curTime;729 if (curTime - this->lastSpawn_asteroid > this->spawnRate_asteroid) { 730 this->lastSpawn_asteroid = curTime; 731 731 732 732 SceneObject<AsteroidVertex, SSBO_Asteroid>& asteroid = addObject( 733 733 asteroidObjects, asteroidPipeline, 734 734 addObjectIndex<AsteroidVertex>(asteroidObjects.size(), 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 735 addVertexNormals<AsteroidVertex>({ 736 737 // front 738 {{ 1.0f, 1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 739 {{-1.0f, 1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 740 {{-1.0f, -1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 741 {{ 1.0f, 1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 742 {{-1.0f, -1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 743 {{ 1.0f, -1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 744 745 // top 746 {{ 1.0f, 1.0f, -1.0f}, {0.4f, 0.4f, 0.4f}}, 747 {{-1.0f, 1.0f, -1.0f}, {0.4f, 0.4f, 0.4f}}, 748 {{-1.0f, 1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 749 {{ 1.0f, 1.0f, -1.0f}, {0.4f, 0.4f, 0.4f}}, 750 {{-1.0f, 1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 751 {{ 1.0f, 1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 752 753 // bottom 754 {{ 1.0f, -1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 755 {{-1.0f, -1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 756 {{-1.0f, -1.0f, -1.0f}, {0.4f, 0.4f, 0.4f}}, 757 {{ 1.0f, -1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 758 {{-1.0f, -1.0f, -1.0f}, {0.4f, 0.4f, 0.4f}}, 759 {{ 1.0f, -1.0f, -1.0}, {0.4f, 0.4f, 0.4f}}, 760 761 // back 762 {{ 1.0f, 1.0f, -1.0f}, {0.4f, 0.4f, 0.4f}}, 763 {{-1.0f, -1.0f, -1.0f}, {0.4f, 0.4f, 0.4f}}, 764 {{-1.0f, 1.0f, -1.0f}, {0.4f, 0.4f, 0.4f}}, 765 {{ 1.0f, 1.0f, -1.0f}, {0.4f, 0.4f, 0.4f}}, 766 {{ 1.0f, -1.0f, -1.0f}, {0.4f, 0.4f, 0.4f}}, 767 {{-1.0f, -1.0f, -1.0f}, {0.4f, 0.4f, 0.4f}}, 768 769 // right 770 {{ 1.0f, 1.0f, -1.0f}, {0.4f, 0.4f, 0.4f}}, 771 {{ 1.0f, 1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 772 {{ 1.0f, -1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 773 {{ 1.0f, 1.0f, -1.0f}, {0.4f, 0.4f, 0.4f}}, 774 {{ 1.0f, -1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 775 {{ 1.0f, -1.0f, -1.0f}, {0.4f, 0.4f, 0.4f}}, 776 777 // left 778 {{-1.0f, 1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 779 {{-1.0f, 1.0f, -1.0f}, {0.4f, 0.4f, 0.4f}}, 780 {{-1.0f, -1.0f, -1.0f}, {0.4f, 0.4f, 0.4f}}, 781 {{-1.0f, 1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 782 {{-1.0f, -1.0f, -1.0f}, {0.4f, 0.4f, 0.4f}}, 783 {{-1.0f, -1.0f, 1.0f}, {0.4f, 0.4f, 0.4f}}, 784 })), { 785 0, 1, 2, 3, 4, 5, 786 6, 7, 8, 9, 10, 11, 787 12, 13, 14, 15, 16, 17, 788 18, 19, 20, 21, 22, 23, 789 24, 25, 26, 27, 28, 29, 790 30, 31, 32, 33, 34, 35, 791 791 }, { 792 792 mat4(1.0f), -
vulkan-game.hpp
r5ba732a r6104594 91 91 // them mamdatory 92 92 93 // TODO: Make a singleton timer class instead 94 static float curTime; 95 93 96 class VulkanGame { 94 97 public: … … 199 202 200 203 time_point<steady_clock> startTime; 201 float curTime,prevTime, elapsedTime;204 float prevTime, elapsedTime; 202 205 203 206 float shipSpeed = 0.5f;
Note:
See TracChangeset
for help on using the changeset viewer.