2024-01-13 15:21:17 +11:00
|
|
|
|
2024-01-24 22:01:33 +11:00
|
|
|
#include <sys/time.h>
|
|
|
|
|
2024-01-25 00:35:39 +11:00
|
|
|
#include <random>
|
2024-01-25 00:52:02 +11:00
|
|
|
#include <sstream>
|
2024-02-09 21:31:36 +11:00
|
|
|
#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"
|
|
|
|
#include "coolant/fluid_t.hpp"
|
|
|
|
#include "coolant/valve.hpp"
|
|
|
|
#include "coolant/pump.hpp"
|
|
|
|
|
2024-01-29 22:05:12 +11:00
|
|
|
#include "graphics/mesh/mesh.hpp"
|
2024-01-30 19:39:19 +11:00
|
|
|
#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-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-24 22:01:33 +11:00
|
|
|
unsigned long get_now()
|
|
|
|
{
|
|
|
|
struct timeval tv;
|
|
|
|
gettimeofday(&tv, nullptr);
|
|
|
|
return (unsigned long)tv.tv_sec * 1000000 + tv.tv_usec;
|
|
|
|
}
|
|
|
|
|
2024-01-13 15:21:17 +11:00
|
|
|
int main()
|
|
|
|
{
|
2024-02-03 23:35:59 +11:00
|
|
|
feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
|
|
|
|
|
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-01-24 22:01:33 +11:00
|
|
|
long clock = get_now();
|
2024-02-09 21:31:36 +11:00
|
|
|
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-01-24 22:01:33 +11:00
|
|
|
long now = get_now();
|
|
|
|
long passed = now - clock;
|
|
|
|
double dt = (double)passed / 1e6;
|
|
|
|
clock += passed;
|
2024-02-09 21:31:36 +11:00
|
|
|
at += dt * sim::system::active.speed;
|
2024-01-25 00:52:02 +11:00
|
|
|
|
2024-01-31 00:23:44 +11:00
|
|
|
sim::system::active.update(dt);
|
2024-02-02 13:05:28 +11:00
|
|
|
|
2024-01-31 00:23:44 +11:00
|
|
|
graphics::camera::update(dt);
|
2024-02-02 13:05:28 +11:00
|
|
|
graphics::window::update(dt);
|
2024-02-04 23:22:15 +11:00
|
|
|
graphics::focus::update(dt);
|
2024-02-02 13:05:28 +11:00
|
|
|
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
|
|
|
}
|
|
|
|
|