diff --git a/assets/scene.blend b/assets/scene.blend index 47acb2d..a14daa5 100644 --- a/assets/scene.blend +++ b/assets/scene.blend @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f52d92d7183e179115b962150686f0941375e7b1c48e947ab602b8524f92da8a -size 10202465 +oid sha256:307d5523ea353ee6edbe0aa0a5bf26b88dcb1ece8eeac922f8963128842ccfff +size 10701717 diff --git a/assets/scene.glb b/assets/scene.glb index 27de43d..2580e89 100644 --- a/assets/scene.glb +++ b/assets/scene.glb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2de0ac1e7b1469a499270a6b4df4487e8a6c8d0972fd3152a2bc5a515b6a4ae3 -size 2835508 +oid sha256:338d18e7c3b6eda70612d390018c0c01bddf0c926c1c6cc38128a397977f7c8b +size 3265988 diff --git a/src/graphics/camera.cpp b/src/graphics/camera.cpp index 4595953..4e9a168 100644 --- a/src/graphics/camera.cpp +++ b/src/graphics/camera.cpp @@ -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); diff --git a/src/graphics/equipment/reactor.cpp b/src/graphics/equipment/reactor.cpp new file mode 100644 index 0000000..3d26b72 --- /dev/null +++ b/src/graphics/equipment/reactor.cpp @@ -0,0 +1,58 @@ + +#include "reactor.hpp" +#include "../../system.hpp" +#include "../../reactor/rod.hpp" +#include "../../reactor/coolant/vessel.hpp" + +#include +#include + +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() +{ +} + + diff --git a/src/graphics/equipment/reactor.hpp b/src/graphics/equipment/reactor.hpp new file mode 100644 index 0000000..72afb47 --- /dev/null +++ b/src/graphics/equipment/reactor.hpp @@ -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(); +}; + +}; + diff --git a/src/graphics/locations.cpp b/src/graphics/locations.cpp index b049123..ad9ebe6 100644 --- a/src/graphics/locations.cpp +++ b/src/graphics/locations.cpp @@ -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(-90), glm::vec3(1, 0, 0)) * glm::rotate(glm::mat4(1), glm::radians(-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(-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(-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(-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(-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(-90), glm::vec3(1, 0, 0)) * glm::rotate(glm::mat4(1), glm::radians(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(-90), glm::vec3(1, 0, 0)) * glm::rotate(glm::mat4(1), glm::radians(90), glm::vec3(0, 1, 0)) * glm::scale(glm::mat4(1), glm::vec3(1.9, 1.9, 1.9)) diff --git a/src/graphics/mesh/mesh.cpp b/src/graphics/mesh/mesh.cpp index b513541..2c4bc89 100644 --- a/src/graphics/mesh/mesh.cpp +++ b/src/graphics/mesh/mesh.cpp @@ -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) { diff --git a/src/graphics/mesh/mesh.hpp b/src/graphics/mesh/mesh.hpp index 50d603f..ed1fa55 100644 --- a/src/graphics/mesh/mesh.hpp +++ b/src/graphics/mesh/mesh.hpp @@ -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; diff --git a/src/graphics/mesh/meshgen.hpp b/src/graphics/mesh/meshgen.hpp new file mode 100644 index 0000000..b1f7b1f --- /dev/null +++ b/src/graphics/mesh/meshgen.hpp @@ -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; +}; + +}; + diff --git a/src/graphics/monitor/core.cpp b/src/graphics/monitor/core.cpp index fbae7e2..3e44a6b 100644 --- a/src/graphics/monitor/core.cpp +++ b/src/graphics/monitor/core.cpp @@ -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)); diff --git a/src/graphics/monitor/core.hpp b/src/graphics/monitor/core.hpp index 61a7993..9479aac 100644 --- a/src/graphics/monitor/core.hpp +++ b/src/graphics/monitor/core.hpp @@ -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(); }; }; diff --git a/src/graphics/monitor/primary_loop.cpp b/src/graphics/monitor/primary_loop.cpp index 8c6dd62..418cc70 100644 --- a/src/graphics/monitor/primary_loop.cpp +++ b/src/graphics/monitor/primary_loop.cpp @@ -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]; diff --git a/src/graphics/monitor/primary_loop.hpp b/src/graphics/monitor/primary_loop.hpp index f9464a7..f981f84 100644 --- a/src/graphics/monitor/primary_loop.hpp +++ b/src/graphics/monitor/primary_loop.hpp @@ -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(); }; }; diff --git a/src/graphics/monitor/secondary_loop.cpp b/src/graphics/monitor/secondary_loop.cpp index 78082d5..c9d6fc9 100644 --- a/src/graphics/monitor/secondary_loop.cpp +++ b/src/graphics/monitor/secondary_loop.cpp @@ -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]; diff --git a/src/graphics/monitor/secondary_loop.hpp b/src/graphics/monitor/secondary_loop.hpp index c1c7d72..cf20f84 100644 --- a/src/graphics/monitor/secondary_loop.hpp +++ b/src/graphics/monitor/secondary_loop.hpp @@ -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(); }; }; diff --git a/src/graphics/monitor/turbine.cpp b/src/graphics/monitor/turbine.cpp index c8e0eeb..39e2ec5 100644 --- a/src/graphics/monitor/turbine.cpp +++ b/src/graphics/monitor/turbine.cpp @@ -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]; diff --git a/src/graphics/monitor/turbine.hpp b/src/graphics/monitor/turbine.hpp index 659d1f3..48dade3 100644 --- a/src/graphics/monitor/turbine.hpp +++ b/src/graphics/monitor/turbine.hpp @@ -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(); }; }; diff --git a/src/graphics/monitor/vessel.cpp b/src/graphics/monitor/vessel.cpp index 8ffea21..9549e95 100644 --- a/src/graphics/monitor/vessel.cpp +++ b/src/graphics/monitor/vessel.cpp @@ -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]; diff --git a/src/graphics/monitor/vessel.hpp b/src/graphics/monitor/vessel.hpp index c8e078f..ef814e1 100644 --- a/src/graphics/monitor/vessel.hpp +++ b/src/graphics/monitor/vessel.hpp @@ -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(); }; }; diff --git a/src/graphics/window.cpp b/src/graphics/window.cpp index 3dce591..483b3bd 100644 --- a/src/graphics/window.cpp +++ b/src/graphics/window.cpp @@ -7,6 +7,8 @@ #include // glm::perspective #include +#include +#include #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 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> monitors; +static std::vector> 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(model, m_scene)); + monitors.push_back(std::make_unique(model, m_scene)); + monitors.push_back(std::make_unique(model, m_scene)); + monitors.push_back(std::make_unique(model, m_scene)); + monitors.push_back(std::make_unique(model, m_scene)); + + equipment.push_back(std::make_unique(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]);