fast-nuclear-sim/src/main.cpp

58 lines
1.0 KiB
C++
Raw Normal View History

2024-01-13 15:21:17 +11:00
2024-01-25 00:35:39 +11:00
#include <random>
2024-01-25 00:52:02 +11:00
#include <sstream>
#include <fstream>
2024-01-25 00:35:39 +11:00
#include <cmath>
2024-02-03 23:35:59 +11:00
#include <cfenv>
2024-01-25 00:35:39 +11:00
#include "reactor/coolant/vessel.hpp"
2024-02-16 16:51:25 +11:00
#include "coolant/fluid.hpp"
2024-01-25 00:35:39 +11:00
#include "coolant/valve.hpp"
#include "coolant/pump.hpp"
2024-01-29 22:05:12 +11:00
#include "graphics/mesh/mesh.hpp"
#include "graphics/input/focus.hpp"
2024-01-29 22:05:12 +11:00
2024-01-21 01:36:21 +11:00
#include "graphics/window.hpp"
2024-01-24 22:01:33 +11:00
#include "graphics/camera.hpp"
2024-01-13 15:21:17 +11:00
2024-02-14 15:28:43 +11:00
#include "util/time.hpp"
2024-01-28 00:02:54 +11:00
#include "system.hpp"
2024-02-07 16:04:22 +11:00
#include "tests.hpp"
2024-01-26 00:30:14 +11:00
2024-01-21 01:36:21 +11:00
using namespace sim;
2024-01-13 21:54:21 +11:00
2024-01-13 15:21:17 +11:00
int main()
{
2024-02-14 15:28:43 +11:00
#ifndef _WIN32
2024-02-03 23:35:59 +11:00
feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
2024-02-14 15:28:43 +11:00
#endif
2024-02-03 23:35:59 +11:00
2024-02-07 16:04:22 +11:00
// tests::run();
// return 0;
2024-01-31 00:23:44 +11:00
graphics::window::create();
2024-01-14 23:44:36 +11:00
2024-02-14 15:28:43 +11:00
long clock = util::time::get_now();
double at = 0;
2024-01-21 01:36:21 +11:00
while(!graphics::window::should_close())
2024-01-13 15:21:17 +11:00
{
2024-02-14 15:28:43 +11:00
long now = util::time::get_now();
2024-01-24 22:01:33 +11:00
long passed = now - clock;
double dt = (double)passed / 1e6;
clock += passed;
2024-02-16 16:51:25 +11:00
at += dt * sim::System::active.speed;
2024-01-25 00:52:02 +11:00
2024-02-16 16:51:25 +11:00
sim::System::active.update(dt);
2024-01-31 00:23:44 +11:00
graphics::camera::update(dt);
graphics::window::update(dt);
2024-02-04 23:22:15 +11:00
graphics::focus::update(dt);
graphics::window::render();
2024-01-13 15:21:17 +11:00
}
2024-01-21 01:36:21 +11:00
graphics::window::destroy();
2024-01-13 15:21:17 +11:00
}