Gave up on that fucking bug for today

This commit is contained in:
2024-07-12 03:22:10 +02:00
commit 0528cfb93e
15 changed files with 515 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
#include "Simulator.h"
#include "Renderer.h"
#include <chrono>
#include <thread>
int main() {
Simulator simulator;
Renderer renderer(1024, 768); // Increased window size for better visibility
// Sun
simulator.addBody(CelestialBody(1.989e30f, glm::vec3(0, 0, 0), glm::vec3(0, 0, 0)));
// Mercury
simulator.addBody(CelestialBody(3.285e23f, glm::vec3(57.9e9f, 0, 0), glm::vec3(0, 47.36e3f, 0)));
// Venus
simulator.addBody(CelestialBody(4.867e24f, glm::vec3(108.2e9f, 0, 0), glm::vec3(0, 35.02e3f, 0)));
// Earth
simulator.addBody(CelestialBody(5.972e24f, glm::vec3(149.6e9f, 0, 0), glm::vec3(0, 29.78e3f, 0)));
// Mars
simulator.addBody(CelestialBody(6.39e23f, glm::vec3(227.9e9f, 0, 0), glm::vec3(0, 24.07e3f, 0)));
const float dt = 3600.0f; // Time step of 1 hour
while (!renderer.shouldClose()) {
simulator.update(dt);
renderer.render(simulator);
renderer.swapBuffers();
std::this_thread::sleep_for(std::chrono::milliseconds(16)); // Aim for roughly 60 FPS
}
return 0;
}