more models
This commit is contained in:
parent
48ffb8f1b2
commit
1a3c72685b
BIN
assets/scene.blend (Stored with Git LFS)
BIN
assets/scene.blend (Stored with Git LFS)
Binary file not shown.
BIN
assets/scene.glb (Stored with Git LFS)
BIN
assets/scene.glb (Stored with Git LFS)
Binary file not shown.
|
@ -123,11 +123,10 @@ void Camera::update(double dt)
|
|||
velocity.z += 3.5;
|
||||
}
|
||||
|
||||
glm::vec<3, double> normal_last(0);
|
||||
glm::vec<3, double> velocity2;
|
||||
|
||||
velocity2 = collision_scene.calc_intersect(pos, velocity * dt, normal_last);
|
||||
velocity2 = collision_scene.calc_intersect(pos + glm::vec<3, double>(0, 0, -1.5), velocity2, normal_last) / dt;
|
||||
velocity2 = collision_scene.calc_intersect(pos, velocity * dt);
|
||||
velocity2 = collision_scene.calc_intersect(pos + glm::vec<3, double>(0, 0, -1.5), velocity2) / dt;
|
||||
|
||||
pos += velocity2 * dt;
|
||||
on_ground = ((velocity * dt / dt).z != velocity2.z);
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
|
||||
#include "reactor.hpp"
|
||||
#include "../../system.hpp"
|
||||
#include "../../reactor/rod.hpp"
|
||||
#include "../../reactor/coolant/vessel.hpp"
|
||||
|
||||
#include <glm/matrix.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
using namespace Sim::Graphics::Equipment;
|
||||
|
||||
Reactor::Reactor(const Model& model, Mesh& rmesh)
|
||||
{
|
||||
g_control_rod = model.load("visual_control_rod");
|
||||
}
|
||||
|
||||
void Reactor::update(double dt)
|
||||
{
|
||||
}
|
||||
|
||||
void Reactor::remesh_slow(Mesh& rmesh)
|
||||
{
|
||||
Sim::System& sys = *Sim::System::active;
|
||||
|
||||
double t_step = sys.reactor.cell_width;
|
||||
double t_sx = -(sys.reactor.width - 1) * t_step / 2.0;
|
||||
double t_sy = -(sys.reactor.height - 1) * t_step / 2.0;
|
||||
|
||||
for(int i = 0; i < sys.reactor.size; i++)
|
||||
{
|
||||
int x = i % sys.reactor.width;
|
||||
int y = i / sys.reactor.width;
|
||||
double ox = t_sx + x * t_step;
|
||||
double oy = t_sy + y * t_step;
|
||||
|
||||
Sim::Reactor::Rod* r = sys.reactor.rods[i].get();
|
||||
|
||||
if(!r->should_display())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(r->get_colour()[3] != 0)
|
||||
{
|
||||
rmesh.add(g_control_rod, glm::translate(glm::mat4(1), glm::vec3(ox, oy, (1 - r->get_colour().r) * sys.reactor.cell_height)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Reactor::remesh_fast(Mesh& rmesh)
|
||||
{
|
||||
}
|
||||
|
||||
void Reactor::render()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../mesh/meshgen.hpp"
|
||||
|
||||
namespace Sim::Graphics::Equipment
|
||||
{
|
||||
|
||||
class Reactor : public MeshGen
|
||||
{
|
||||
Mesh g_control_rod;
|
||||
|
||||
public:
|
||||
|
||||
Reactor(const Model& model, Mesh& rmesh);
|
||||
virtual void update(double dt);
|
||||
virtual void remesh_slow(Mesh& rmesh);
|
||||
virtual void remesh_fast(Mesh& rmesh);
|
||||
virtual void render();
|
||||
};
|
||||
|
||||
};
|
||||
|
|
@ -6,39 +6,39 @@ using namespace Sim::Graphics;
|
|||
|
||||
const glm::mat4 Locations::monitors[7] = {
|
||||
(
|
||||
glm::translate(glm::mat4(1), glm::vec3(-2.949, -1.7778 + 0.05, 3 - 0.05)) *
|
||||
glm::translate(glm::mat4(1), glm::vec3(-2.9475, -1.7778 + 0.05, 3 - 0.05)) *
|
||||
glm::rotate(glm::mat4(1), glm::radians<float>(-90), glm::vec3(1, 0, 0)) *
|
||||
glm::rotate(glm::mat4(1), glm::radians<float>(-90), glm::vec3(0, 1, 0)) *
|
||||
glm::scale(glm::mat4(1), glm::vec3(1.9, 1.9, 1.9))
|
||||
),
|
||||
(
|
||||
glm::translate(glm::mat4(1), glm::vec3(-1.5 + 0.05, 3.949, 3 - 0.05)) *
|
||||
glm::translate(glm::mat4(1), glm::vec3(-1.5 + 0.05, 3.9475, 3 - 0.05)) *
|
||||
glm::rotate(glm::mat4(1), glm::radians<float>(-90), glm::vec3(1, 0, 0)) *
|
||||
glm::scale(glm::mat4(1), glm::vec3(1.9, 1.9, 1.9))
|
||||
),
|
||||
(
|
||||
glm::translate(glm::mat4(1), glm::vec3(1 + 0.05, 3.949, 3 - 0.05)) *
|
||||
glm::translate(glm::mat4(1), glm::vec3(1 + 0.05, 3.9475, 3 - 0.05)) *
|
||||
glm::rotate(glm::mat4(1), glm::radians<float>(-90), glm::vec3(1, 0, 0)) *
|
||||
glm::scale(glm::mat4(1), glm::vec3(1.9, 1.9, 1.9))
|
||||
),
|
||||
(
|
||||
glm::translate(glm::mat4(1), glm::vec3(3.5 + 0.05, 3.949, 3 - 0.05)) *
|
||||
glm::translate(glm::mat4(1), glm::vec3(3.5 + 0.05, 3.9475, 3 - 0.05)) *
|
||||
glm::rotate(glm::mat4(1), glm::radians<float>(-90), glm::vec3(1, 0, 0)) *
|
||||
glm::scale(glm::mat4(1), glm::vec3(1.9, 1.9, 1.9))
|
||||
),
|
||||
(
|
||||
glm::translate(glm::mat4(1), glm::vec3(6 + 0.05, 3.949, 3 - 0.05)) *
|
||||
glm::translate(glm::mat4(1), glm::vec3(6 + 0.05, 3.9475, 3 - 0.05)) *
|
||||
glm::rotate(glm::mat4(1), glm::radians<float>(-90), glm::vec3(1, 0, 0)) *
|
||||
glm::scale(glm::mat4(1), glm::vec3(1.9, 1.9, 1.9))
|
||||
),
|
||||
(
|
||||
glm::translate(glm::mat4(1), glm::vec3(8.949, 7.0/3.0 - 0.05, 3 - 0.05)) *
|
||||
glm::translate(glm::mat4(1), glm::vec3(8.9475, 7.0/3.0 - 0.05, 3 - 0.05)) *
|
||||
glm::rotate(glm::mat4(1), glm::radians<float>(-90), glm::vec3(1, 0, 0)) *
|
||||
glm::rotate(glm::mat4(1), glm::radians<float>(90), glm::vec3(0, 1, 0)) *
|
||||
glm::scale(glm::mat4(1), glm::vec3(1.9, 1.9, 1.9))
|
||||
),
|
||||
(
|
||||
glm::translate(glm::mat4(1), glm::vec3(8.949, -1.0/3.0 - 0.05, 3 - 0.05)) *
|
||||
glm::translate(glm::mat4(1), glm::vec3(8.9475, -1.0/3.0 - 0.05, 3 - 0.05)) *
|
||||
glm::rotate(glm::mat4(1), glm::radians<float>(-90), glm::vec3(1, 0, 0)) *
|
||||
glm::rotate(glm::mat4(1), glm::radians<float>(90), glm::vec3(0, 1, 0)) *
|
||||
glm::scale(glm::mat4(1), glm::vec3(1.9, 1.9, 1.9))
|
||||
|
|
|
@ -155,17 +155,11 @@ bool Mesh::check_intersect(vec3 pos, vec3 path) const
|
|||
return false;
|
||||
}
|
||||
|
||||
vec3 Mesh::calc_intersect(vec3 pos, vec3 path) const
|
||||
{
|
||||
vec3 normal_last(0);
|
||||
return calc_intersect(pos, path, normal_last);
|
||||
}
|
||||
|
||||
static bool calc_intercept_vert(vec3 v[3], vec3 pos, vec3& path, vec3& path_n, vec3& normal_last, double& l)
|
||||
static bool calc_intercept_vert(vec3 v[3], vec3 pos, vec3& path, vec3& path_n, double& l)
|
||||
{
|
||||
vec3 ipoint;
|
||||
vec3 normal = glm::normalize(glm::cross(v[1] - v[0], v[2] - v[0]));
|
||||
double d = glm::dot(normal, path);
|
||||
double d = glm::dot(path, normal);
|
||||
|
||||
if(d >= 0)
|
||||
return false;
|
||||
|
@ -174,20 +168,11 @@ static bool calc_intercept_vert(vec3 v[3], vec3 pos, vec3& path, vec3& path_n, v
|
|||
if(l < glm::length(ipoint - pos))
|
||||
return false;
|
||||
|
||||
if(normal_last != vec3(0))
|
||||
if(d < 0)
|
||||
{
|
||||
vec3 n = glm::cross(normal_last, normal);
|
||||
|
||||
if(glm::length(n) > 0)
|
||||
{
|
||||
normal = glm::normalize(glm::cross(glm::cross(normal_last, normal), normal_last));
|
||||
d = glm::dot(normal, path);
|
||||
}
|
||||
path -= normal * d;
|
||||
l = glm::length(path);
|
||||
}
|
||||
|
||||
path -= normal * d;
|
||||
normal_last = normal;
|
||||
l = glm::length(path);
|
||||
|
||||
if(l > 0)
|
||||
{
|
||||
|
@ -197,7 +182,7 @@ static bool calc_intercept_vert(vec3 v[3], vec3 pos, vec3& path, vec3& path_n, v
|
|||
return true;
|
||||
}
|
||||
|
||||
vec3 Mesh::calc_intersect(vec3 pos, vec3 path, vec3& normal_last) const
|
||||
vec3 Mesh::calc_intersect(vec3 pos, vec3 path) const
|
||||
{
|
||||
double l = glm::length(path);
|
||||
|
||||
|
@ -217,7 +202,7 @@ vec3 Mesh::calc_intersect(vec3 pos, vec3 path, vec3& normal_last) const
|
|||
vec3(this->vertices[indices[i + 2]].pos)
|
||||
};
|
||||
|
||||
if(calc_intercept_vert(v, pos, path, path_n, normal_last, l))
|
||||
if(calc_intercept_vert(v, pos, path, path_n, l))
|
||||
{
|
||||
i_found = i;
|
||||
}
|
||||
|
@ -236,7 +221,7 @@ vec3 Mesh::calc_intersect(vec3 pos, vec3 path, vec3& normal_last) const
|
|||
vec3(this->vertices[indices[i + 2]].pos)
|
||||
};
|
||||
|
||||
calc_intercept_vert(v, pos, path, path_n, normal_last, l);
|
||||
calc_intercept_vert(v, pos, path, path_n, l);
|
||||
|
||||
if(l == 0)
|
||||
{
|
||||
|
|
|
@ -34,7 +34,6 @@ struct Mesh
|
|||
bool check_focus(double len) const;
|
||||
bool check_intersect(glm::vec<3, double> pos, glm::vec<3, double> path) const;
|
||||
glm::vec<3, double> calc_intersect(glm::vec<3, double> pos, glm::vec<3, double> path) const;
|
||||
glm::vec<3, double> calc_intersect(glm::vec<3, double> pos, glm::vec<3, double> path, glm::vec<3, double>& normal_last) const;
|
||||
|
||||
bool operator==(const Mesh&) const = default;
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../mesh/model.hpp"
|
||||
|
||||
namespace Sim::Graphics
|
||||
{
|
||||
|
||||
class MeshGen
|
||||
{
|
||||
public:
|
||||
virtual ~MeshGen() {}
|
||||
virtual void update(double dt) = 0;
|
||||
virtual void remesh_slow(Mesh& rmesh) = 0;
|
||||
virtual void remesh_fast(Mesh& rmesh) = 0;
|
||||
virtual void render() = 0;
|
||||
};
|
||||
|
||||
};
|
||||
|
|
@ -116,11 +116,7 @@ struct CoreJoystick : public Focus::FocusType
|
|||
}
|
||||
};
|
||||
|
||||
Core::Core()
|
||||
{
|
||||
}
|
||||
|
||||
void Core::init(const Model& model, Mesh& rmesh)
|
||||
Core::Core(const Model& model, Mesh& rmesh)
|
||||
{
|
||||
Mesh mesh = model.load("translation_monitor_3");
|
||||
mat = Locations::monitors[2];
|
||||
|
@ -204,7 +200,7 @@ void Core::remesh(Mesh& rmesh, bool fast)
|
|||
double step = 1 / (sys.vessel.diameter / sys.reactor.cell_width * 0.8);
|
||||
double sx = 0.5 - (sys.reactor.width - 1) * step / 2.0;
|
||||
double sy = 0.5 - (sys.reactor.height - 1) * step / 2.0;
|
||||
|
||||
|
||||
glm::mat4 mat_scale = glm::scale(glm::mat4(1), glm::vec3(step * 0.4, step * 0.4, 1));
|
||||
glm::mat4 mat_select = glm::translate(glm::mat4(1), glm::vec3(-0.8, -0.8, -0.001)) * glm::scale(glm::mat4(1), glm::vec3(0.25, 0.25, 1));
|
||||
glm::mat4 mat_cursor = glm::translate(glm::mat4(1), glm::vec3(-0.8, 0.8, -0.001)) * glm::scale(glm::mat4(1), glm::vec3(0.25, 0.25, 1));
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
#pragma once
|
||||
|
||||
#include "../mesh/model.hpp"
|
||||
#include "../mesh/meshgen.hpp"
|
||||
|
||||
namespace Sim::Graphics::Monitor
|
||||
{
|
||||
|
||||
class Core
|
||||
class Core : public MeshGen
|
||||
{
|
||||
glm::mat4 mat;
|
||||
|
||||
Mesh m_monitor;
|
||||
Mesh m_buttons[9];
|
||||
Mesh m_joystick;
|
||||
|
@ -16,13 +18,12 @@ class Core
|
|||
|
||||
public:
|
||||
|
||||
Core();
|
||||
void init(const Model& model, Mesh& rmesh);
|
||||
void update(double dt);
|
||||
void remesh_slow(Mesh& rmesh);
|
||||
void remesh_fast(Mesh& rmesh);
|
||||
Core(const Model& model, Mesh& rmesh);
|
||||
void remesh(Mesh& rmesh, bool fast);
|
||||
void render();
|
||||
virtual void update(double dt);
|
||||
virtual void remesh_slow(Mesh& rmesh);
|
||||
virtual void remesh_fast(Mesh& rmesh);
|
||||
virtual void render();
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -49,13 +49,7 @@ struct ValveJoystick : public Focus::FocusType
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
PrimaryLoop::PrimaryLoop()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PrimaryLoop::init(const Model& model, Mesh& rmesh)
|
||||
PrimaryLoop::PrimaryLoop(const Model& model, Mesh& rmesh)
|
||||
{
|
||||
mat = Locations::monitors[3];
|
||||
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "../mesh/model.hpp"
|
||||
#include "../mesh/meshgen.hpp"
|
||||
|
||||
namespace Sim::Graphics::Monitor
|
||||
{
|
||||
|
||||
class PrimaryLoop
|
||||
class PrimaryLoop : public MeshGen
|
||||
{
|
||||
glm::mat4 mat;
|
||||
|
||||
|
@ -23,12 +24,11 @@ class PrimaryLoop
|
|||
|
||||
public:
|
||||
|
||||
PrimaryLoop();
|
||||
void init(const Model& model, Mesh& rmesh);
|
||||
void update(double dt);
|
||||
void remesh_slow(Mesh& rmesh);
|
||||
void remesh_fast(Mesh& rmesh);
|
||||
void render();
|
||||
PrimaryLoop(const Model& model, Mesh& rmesh);
|
||||
virtual void update(double dt);
|
||||
virtual void remesh_slow(Mesh& rmesh);
|
||||
virtual void remesh_fast(Mesh& rmesh);
|
||||
virtual void render();
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -16,12 +16,8 @@ using namespace Sim::Graphics;
|
|||
using namespace Sim::Graphics::Monitor;
|
||||
using namespace Sim::Util::Streams;
|
||||
|
||||
SecondaryLoop::SecondaryLoop()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SecondaryLoop::init(const Model& model, Mesh& rmesh)
|
||||
SecondaryLoop::SecondaryLoop(const Model& model, Mesh& rmesh)
|
||||
{
|
||||
mat = Locations::monitors[5];
|
||||
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "../mesh/model.hpp"
|
||||
#include "../mesh/meshgen.hpp"
|
||||
|
||||
namespace Sim::Graphics::Monitor
|
||||
{
|
||||
|
||||
class SecondaryLoop
|
||||
class SecondaryLoop : public MeshGen
|
||||
{
|
||||
glm::mat4 mat;
|
||||
|
||||
|
@ -20,12 +21,11 @@ class SecondaryLoop
|
|||
|
||||
public:
|
||||
|
||||
SecondaryLoop();
|
||||
void init(const Model& model, Mesh& rmesh);
|
||||
void update(double dt);
|
||||
void remesh_slow(Mesh& rmesh);
|
||||
void remesh_fast(Mesh& rmesh);
|
||||
void render();
|
||||
SecondaryLoop(const Model& model, Mesh& rmesh);
|
||||
virtual void update(double dt);
|
||||
virtual void remesh_slow(Mesh& rmesh);
|
||||
virtual void remesh_fast(Mesh& rmesh);
|
||||
virtual void render();
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -16,12 +16,7 @@ using namespace Sim::Graphics;
|
|||
using namespace Sim::Graphics::Monitor;
|
||||
using namespace Sim::Util::Streams;
|
||||
|
||||
Turbine::Turbine()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Turbine::init(const Model& model, Mesh& rmesh)
|
||||
Turbine::Turbine(const Model& model, Mesh& rmesh)
|
||||
{
|
||||
mat = Locations::monitors[4];
|
||||
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
|
||||
#include "../mesh/model.hpp"
|
||||
#include "../mesh/glmesh.hpp"
|
||||
#include "../mesh/meshgen.hpp"
|
||||
|
||||
namespace Sim::Graphics::Monitor
|
||||
{
|
||||
|
||||
class Turbine
|
||||
class Turbine : public MeshGen
|
||||
{
|
||||
glm::mat4 mat;
|
||||
|
||||
|
@ -17,12 +18,11 @@ class Turbine
|
|||
|
||||
public:
|
||||
|
||||
Turbine();
|
||||
void init(const Model& model, Mesh& rmesh);
|
||||
void update(double dt);
|
||||
void remesh_slow(Mesh& rmesh);
|
||||
void remesh_fast(Mesh& rmesh);
|
||||
void render();
|
||||
Turbine(const Model& model, Mesh& rmesh);
|
||||
virtual void update(double dt);
|
||||
virtual void remesh_slow(Mesh& rmesh);
|
||||
virtual void remesh_fast(Mesh& rmesh);
|
||||
virtual void render();
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -15,12 +15,7 @@
|
|||
using namespace Sim::Graphics::Monitor;
|
||||
using namespace Sim::Util::Streams;
|
||||
|
||||
Vessel::Vessel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Vessel::init(const Model& model, Mesh& rmesh)
|
||||
Vessel::Vessel(const Model& model, Mesh& rmesh)
|
||||
{
|
||||
mat = Locations::monitors[1];
|
||||
|
||||
|
|
|
@ -2,22 +2,22 @@
|
|||
#pragma once
|
||||
|
||||
#include "../mesh/model.hpp"
|
||||
#include "../mesh/meshgen.hpp"
|
||||
|
||||
namespace Sim::Graphics::Monitor
|
||||
{
|
||||
|
||||
class Vessel
|
||||
class Vessel : public MeshGen
|
||||
{
|
||||
glm::mat4 mat;
|
||||
|
||||
public:
|
||||
|
||||
Vessel();
|
||||
void init(const Model& model, Mesh& rmesh);
|
||||
void update(double dt);
|
||||
void remesh_slow(Mesh& rmesh);
|
||||
void remesh_fast(Mesh& rmesh);
|
||||
void render();
|
||||
Vessel(const Model& model, Mesh& rmesh);
|
||||
virtual void update(double dt);
|
||||
virtual void remesh_slow(Mesh& rmesh);
|
||||
virtual void remesh_fast(Mesh& rmesh);
|
||||
virtual void render();
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include <glm/ext/matrix_clip_space.hpp> // glm::perspective
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include "mesh/mesh.hpp"
|
||||
#include "mesh/arrays.hpp"
|
||||
|
@ -27,6 +29,8 @@
|
|||
#include "mesh/texture.hpp"
|
||||
#include "mesh/model.hpp"
|
||||
#include "mesh/gllight.hpp"
|
||||
#include "mesh/meshgen.hpp"
|
||||
#include "equipment/reactor.hpp"
|
||||
#include "../system.hpp"
|
||||
#include "../util/streams.hpp"
|
||||
#include "ui.hpp"
|
||||
|
@ -43,17 +47,14 @@ static double secs_wait_now = 0;
|
|||
static int gm_dynamic_slow_at = 0;
|
||||
|
||||
static GLMesh gm_scene;
|
||||
static GLMesh gm_transparent;
|
||||
static GLMesh gm_dynamic_slow[2];
|
||||
static GLMesh gm_dynamic_fast;
|
||||
static Mesh m_dynamic_fast;
|
||||
|
||||
static std::vector<GLLight> lights;
|
||||
|
||||
static Monitor::Vessel monitor_vessel;
|
||||
static Monitor::Core monitor_core;
|
||||
static Monitor::PrimaryLoop monitor_primary_loop;
|
||||
static Monitor::SecondaryLoop monitor_secondary_loop;
|
||||
static Monitor::Turbine monitor_turbine;
|
||||
static std::vector<std::unique_ptr<MeshGen>> monitors;
|
||||
static std::vector<std::unique_ptr<MeshGen>> equipment;
|
||||
|
||||
glm::mat4 Window::projection_matrix;
|
||||
|
||||
|
@ -132,9 +133,10 @@ void Window::create()
|
|||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
Sim::System& sys = *System::active;
|
||||
Mesh m_scene;
|
||||
Mesh m_scene, m_transparent;
|
||||
|
||||
Model model("../assets", "scene.glb");
|
||||
m_transparent = model.load("visual_water");
|
||||
m_scene = model.load("scene");
|
||||
|
||||
Camera::init(model);
|
||||
|
@ -147,15 +149,20 @@ void Window::create()
|
|||
|
||||
glUniform1i(Shader::MAIN["lights_count"], model.lights.size());
|
||||
|
||||
monitor_core.init(model, m_scene);
|
||||
monitor_vessel.init(model, m_scene);
|
||||
monitor_primary_loop.init(model, m_scene);
|
||||
monitor_secondary_loop.init(model, m_scene);
|
||||
monitor_turbine.init(model, m_scene);
|
||||
monitors.push_back(std::make_unique<Monitor::Core>(model, m_scene));
|
||||
monitors.push_back(std::make_unique<Monitor::Vessel>(model, m_scene));
|
||||
monitors.push_back(std::make_unique<Monitor::PrimaryLoop>(model, m_scene));
|
||||
monitors.push_back(std::make_unique<Monitor::SecondaryLoop>(model, m_scene));
|
||||
monitors.push_back(std::make_unique<Monitor::Turbine>(model, m_scene));
|
||||
|
||||
equipment.push_back(std::make_unique<Equipment::Reactor>(model, m_scene));
|
||||
|
||||
gm_scene.bind();
|
||||
gm_scene.set(m_scene, GL_STATIC_DRAW);
|
||||
|
||||
gm_transparent.bind();
|
||||
gm_transparent.set(m_transparent, GL_STATIC_DRAW);
|
||||
|
||||
glfwShowWindow(win);
|
||||
|
||||
// setup lighting and prerender shadows
|
||||
|
@ -189,11 +196,15 @@ void update_slow()
|
|||
{
|
||||
Mesh mesh;
|
||||
|
||||
monitor_core.remesh_slow(mesh);
|
||||
monitor_vessel.remesh_slow(mesh);
|
||||
monitor_primary_loop.remesh_slow(mesh);
|
||||
monitor_secondary_loop.remesh_slow(mesh);
|
||||
monitor_turbine.remesh_slow(mesh);
|
||||
for(auto& monitor : monitors)
|
||||
{
|
||||
monitor->remesh_slow(mesh);
|
||||
}
|
||||
|
||||
for(auto& equipment : equipment)
|
||||
{
|
||||
equipment->remesh_slow(mesh);
|
||||
}
|
||||
|
||||
gm_dynamic_slow[gm_dynamic_slow_at].bind();
|
||||
gm_dynamic_slow[gm_dynamic_slow_at].set(mesh, GL_DYNAMIC_DRAW);
|
||||
|
@ -208,19 +219,27 @@ void Window::update(double dt)
|
|||
|
||||
glfwPollEvents();
|
||||
|
||||
monitor_core.update(dt);
|
||||
monitor_vessel.update(dt);
|
||||
monitor_primary_loop.update(dt);
|
||||
monitor_secondary_loop.update(dt);
|
||||
monitor_turbine.update(dt);
|
||||
for(auto& monitor : monitors)
|
||||
{
|
||||
monitor->update(dt);
|
||||
}
|
||||
|
||||
for(auto& equipment : equipment)
|
||||
{
|
||||
equipment->update(dt);
|
||||
}
|
||||
|
||||
UI::update(dt);
|
||||
|
||||
monitor_core.remesh_fast(mesh);
|
||||
monitor_vessel.remesh_fast(mesh);
|
||||
monitor_primary_loop.remesh_fast(mesh);
|
||||
monitor_secondary_loop.remesh_fast(mesh);
|
||||
monitor_turbine.remesh_fast(mesh);
|
||||
|
||||
for(auto& monitor : monitors)
|
||||
{
|
||||
monitor->remesh_fast(mesh);
|
||||
}
|
||||
|
||||
for(auto& equipment : equipment)
|
||||
{
|
||||
equipment->remesh_fast(mesh);
|
||||
}
|
||||
|
||||
if(mesh != m_dynamic_fast)
|
||||
{
|
||||
|
@ -251,11 +270,19 @@ void Window::render_scene()
|
|||
gm_dynamic_fast.uniform();
|
||||
gm_dynamic_fast.render();
|
||||
|
||||
monitor_core.render();
|
||||
monitor_vessel.render();
|
||||
monitor_primary_loop.render();
|
||||
monitor_secondary_loop.render();
|
||||
monitor_turbine.render();
|
||||
for(auto& monitor : monitors)
|
||||
{
|
||||
monitor->render();
|
||||
}
|
||||
|
||||
for(auto& equipment : equipment)
|
||||
{
|
||||
equipment->render();
|
||||
}
|
||||
|
||||
gm_transparent.bind();
|
||||
gm_transparent.uniform();
|
||||
gm_transparent.render();
|
||||
|
||||
Focus::render();
|
||||
}
|
||||
|
@ -263,16 +290,15 @@ void Window::render_scene()
|
|||
void Window::render()
|
||||
{
|
||||
glm::vec<2, int> size = Resize::get_size();
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glViewport(0, 0, size.x, size.y);
|
||||
|
||||
glm::vec3 camera_pos = Camera::get_pos();
|
||||
glm::mat4 mat_camera = Camera::get_matrix();
|
||||
|
||||
Shader::MAIN.use();
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glViewport(0, 0, size.x, size.y);
|
||||
|
||||
glm::vec3 brightness = glm::vec3(System::active->grid.get_light_intensity());
|
||||
glm::mat4 mat_projection = glm::perspective(glm::radians(90.0f), Resize::get_aspect(), 0.01f, 50.f);
|
||||
glm::mat4 mat_projection = glm::perspective(glm::radians(90.0f), Resize::get_aspect(), 0.01f, 100.f);
|
||||
glUniformMatrix4fv(Shader::MAIN["projection"], 1, false, &mat_projection[0][0]);
|
||||
glUniformMatrix4fv(Shader::MAIN["camera"], 1, false, &mat_camera[0][0]);
|
||||
glUniform3fv(Shader::MAIN["camera_pos"], 1, &camera_pos[0]);
|
||||
|
|
Loading…
Reference in New Issue