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-01-25 00:35:39 +11:00
|
|
|
#include <cmath>
|
|
|
|
|
|
|
|
#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-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-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-01-21 01:36:21 +11:00
|
|
|
graphics::window::create();
|
2024-01-29 01:26:07 +11:00
|
|
|
sim::system sys;
|
2024-01-14 23:44:36 +11:00
|
|
|
|
2024-01-24 22:01:33 +11:00
|
|
|
long clock = get_now();
|
|
|
|
|
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-01-25 00:52:02 +11:00
|
|
|
|
2024-01-28 00:02:54 +11:00
|
|
|
sys.update(dt);
|
2024-01-29 22:05:12 +11:00
|
|
|
graphics::camera::update(sys, dt);
|
2024-01-28 00:02:54 +11:00
|
|
|
graphics::window::loop(sys);
|
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
|
|
|
}
|
|
|
|
|