diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index fbf1bd3..2a6df4e 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -26,8 +26,6 @@ jobs: with: submodules: recursive - # TODO: cache - - name: Install Dependencies run: sudo apt update && sudo apt -y install libsdl2-dev xserver-xorg-video-dummy @@ -62,8 +60,6 @@ jobs: with: submodules: recursive - # TODO: cache - - name: Install Dependencies run: sudo apt update && sudo apt -y install libsdl2-dev @@ -102,9 +98,6 @@ jobs: with: submodules: recursive - #- name: Install Dependencies - #run: sudo apt update && sudo apt -y install libsdl2-dev - - name: Setup emsdk uses: mymindstorm/setup-emsdk@v11 with: @@ -134,8 +127,6 @@ jobs: with: submodules: recursive - # TODO: cache - - name: Install Dependencies run: brew install sdl2 @@ -156,7 +147,6 @@ jobs: submodules: recursive # TODO: cache - - name: Install Dependencies run: vcpkg install sdl2[core,vulkan]:x64-windows diff --git a/external/entt b/external/entt index e4ccb87..fef9211 160000 --- a/external/entt +++ b/external/entt @@ -1 +1 @@ -Subproject commit e4ccb878f47245a319704912435d3c89f34ad6be +Subproject commit fef921132cae7588213d0f9bcd2fb9c8ffd8b7fc diff --git a/framework/imgui/src/mm/imgui/imgui_entt_entity_editor.hpp b/framework/imgui/src/mm/imgui/imgui_entt_entity_editor.hpp index f5e49bc..ac13d4f 100644 --- a/framework/imgui/src/mm/imgui/imgui_entt_entity_editor.hpp +++ b/framework/imgui/src/mm/imgui/imgui_entt_entity_editor.hpp @@ -85,8 +85,8 @@ private: bool entityHasComponent(Registry& registry, EntityType& entity, ComponentTypeID type_id) { - const auto storage_it = registry.storage(type_id); - return storage_it != registry.storage().end() && storage_it->second.contains(entity); + const auto* storage_ptr = registry.storage(type_id); + return storage_ptr != nullptr && storage_ptr->contains(entity); } public: @@ -243,11 +243,11 @@ public: } }); } else { - entt::basic_runtime_view> view{}; + entt::runtime_view view{}; for (const auto type : comp_list) { - auto storage_it = registry.storage(type); - if (storage_it != registry.storage().end()) { - view.iterate(registry.storage(type)->second); + auto* storage_ptr = registry.storage(type); + if (storage_ptr != nullptr) { + view.iterate(*storage_ptr); } } diff --git a/framework/imgui/src/mm/imgui/widgets/camera.cpp b/framework/imgui/src/mm/imgui/widgets/camera.cpp index 768fb19..e619012 100644 --- a/framework/imgui/src/mm/imgui/widgets/camera.cpp +++ b/framework/imgui/src/mm/imgui/widgets/camera.cpp @@ -20,7 +20,7 @@ void Camera3D(MM::Scene& scene) { ImGui::TextUnformatted("NO CAMERA!"); return; } - auto& camera = scene.ctx().at(); + auto& camera = scene.ctx().get(); static bool follow_entity = false; static MM::Entity tracking = entt::null; diff --git a/framework/imgui/src/mm/services/scene_tools.cpp b/framework/imgui/src/mm/services/scene_tools.cpp index cc680b1..290dfb4 100644 --- a/framework/imgui/src/mm/services/scene_tools.cpp +++ b/framework/imgui/src/mm/services/scene_tools.cpp @@ -157,7 +157,7 @@ namespace MM::Services { if (_show_time_delta_ctx) { if (ImGui::Begin("Scene TimeDelta Context", &_show_time_delta_ctx)) { if (scene.ctx().contains()) { - auto& td = scene.ctx().at(); + auto& td = scene.ctx().get(); ImGui::Value("tickDelta", td.tickDelta); ImGui::SliderFloat("deltaFactor", &td.deltaFactor, 0.f, 10.f, "%.5f", ImGuiSliderFlags_Logarithmic); } else { diff --git a/framework/opengl_renderer/src/mm/opengl/render_tasks/batched_spritesheet.cpp b/framework/opengl_renderer/src/mm/opengl/render_tasks/batched_spritesheet.cpp index 885dad0..2a8d21a 100644 --- a/framework/opengl_renderer/src/mm/opengl/render_tasks/batched_spritesheet.cpp +++ b/framework/opengl_renderer/src/mm/opengl/render_tasks/batched_spritesheet.cpp @@ -117,7 +117,7 @@ void BatchedSpriteSheet::render(Services::OpenGLRenderer& rs, Engine& engine) { _vertexBuffer->bind(GL_ARRAY_BUFFER); _vao->bind(); - auto& cam = scene.ctx().at(); + auto& cam = scene.ctx().get(); auto vp = cam.getViewProjection(); _shader->setUniformMat4f("_VP", vp); diff --git a/framework/opengl_renderer/src/mm/opengl/render_tasks/fast_sky_render_task.cpp b/framework/opengl_renderer/src/mm/opengl/render_tasks/fast_sky_render_task.cpp index ca3c48f..c591e19 100644 --- a/framework/opengl_renderer/src/mm/opengl/render_tasks/fast_sky_render_task.cpp +++ b/framework/opengl_renderer/src/mm/opengl/render_tasks/fast_sky_render_task.cpp @@ -78,7 +78,7 @@ void FastSky::render(MM::Services::OpenGLRenderer& rs, MM::Engine& engine) { _vao->bind(); { - auto& cam = scene.ctx().at(); + auto& cam = scene.ctx().get(); MM::OpenGL::Camera3D tmp_cam = cam; // create cam with y up, bc shader says so tmp_cam.up = {0, 1, 0}; @@ -95,7 +95,7 @@ void FastSky::render(MM::Services::OpenGLRenderer& rs, MM::Engine& engine) { //} auto* ctx_ptr = &_default_context; if (scene.ctx().contains()) { - ctx_ptr = &scene.ctx().at(); + ctx_ptr = &scene.ctx().get(); } _shader->setUniform1f("time", ctx_ptr->time); diff --git a/framework/opengl_renderer/src/mm/opengl/render_tasks/lite_particles2d.cpp b/framework/opengl_renderer/src/mm/opengl/render_tasks/lite_particles2d.cpp index 7dd5060..b6fe495 100644 --- a/framework/opengl_renderer/src/mm/opengl/render_tasks/lite_particles2d.cpp +++ b/framework/opengl_renderer/src/mm/opengl/render_tasks/lite_particles2d.cpp @@ -138,7 +138,7 @@ void LiteParticles2D::uploadParticles(Services::OpenGLRenderer&, Scene& scene) { return; // nothing to upload } - auto& queue = scene.ctx().at(); + auto& queue = scene.ctx().get(); while (!queue.queue.empty()) { // get range @@ -200,7 +200,7 @@ void LiteParticles2D::computeParticles(Services::OpenGLRenderer&, Scene& scene) std::chrono::duration> deltaTime = newNow - _last_time; _last_time = newNow; - float time_delta = deltaTime.count() * scene.ctx().at().deltaFactor; + float time_delta = deltaTime.count() * scene.ctx().get().deltaFactor; _time += time_delta; _tf_shader->setUniform1f("_time_delta", time_delta); _tf_shader->setUniform1f("_time", _time); @@ -269,7 +269,7 @@ void LiteParticles2D::renderParticles(Services::OpenGLRenderer& rs, Scene& scene auto& rm_t = MM::ResourceManager::ref(); rm_t.get("MM::LiteParticles2DTypes::Render"_hs)->bind(0); - Camera3D& cam = scene.ctx().at(); + Camera3D& cam = scene.ctx().get(); _points_shader->setUniformMat4f("_vp", cam.getViewProjection()); GLint view_port[4]; diff --git a/framework/opengl_renderer/src/mm/opengl/render_tasks/simple_rect.cpp b/framework/opengl_renderer/src/mm/opengl/render_tasks/simple_rect.cpp index 1cc25c8..ccd29a8 100644 --- a/framework/opengl_renderer/src/mm/opengl/render_tasks/simple_rect.cpp +++ b/framework/opengl_renderer/src/mm/opengl/render_tasks/simple_rect.cpp @@ -72,7 +72,7 @@ void SimpleRect::render(Services::OpenGLRenderer& rs, Engine& engine) { _shader->bind(); _vao->bind(); - Camera3D& cam = scene.ctx().at(); + Camera3D& cam = scene.ctx().get(); auto vp = cam.getViewProjection(); scene.view().each([this, &scene, &vp](entt::entity e, const auto& t) { diff --git a/framework/opengl_renderer/src/mm/opengl/render_tasks/simple_sprite.cpp b/framework/opengl_renderer/src/mm/opengl/render_tasks/simple_sprite.cpp index 2284c35..c3c5547 100644 --- a/framework/opengl_renderer/src/mm/opengl/render_tasks/simple_sprite.cpp +++ b/framework/opengl_renderer/src/mm/opengl/render_tasks/simple_sprite.cpp @@ -80,7 +80,7 @@ void SimpleSprite::render(Services::OpenGLRenderer& rs, Engine& engine) { _vao->bind(); - Camera3D& cam = scene.ctx().at(); + Camera3D& cam = scene.ctx().get(); auto vp = cam.getViewProjection(); scene.view().each([this, &scene, &vp](entt::entity e, const auto& t, auto& tex) { diff --git a/framework/opengl_renderer/src/mm/opengl/render_tasks/simple_spritesheet.cpp b/framework/opengl_renderer/src/mm/opengl/render_tasks/simple_spritesheet.cpp index e55d750..42beb81 100644 --- a/framework/opengl_renderer/src/mm/opengl/render_tasks/simple_spritesheet.cpp +++ b/framework/opengl_renderer/src/mm/opengl/render_tasks/simple_spritesheet.cpp @@ -81,7 +81,7 @@ void SimpleSpriteSheet::render(Services::OpenGLRenderer& rs, Engine& engine) { _vertexBuffer->bind(GL_ARRAY_BUFFER); _vao->bind(); - Camera3D& cam = scene.ctx().at(); + Camera3D& cam = scene.ctx().get(); auto vp = cam.getViewProjection(); scene.view().each([this, &scene, &vp](entt::entity e, const auto& t, auto& spr) { diff --git a/framework/opengl_renderer/src/mm/opengl/render_tasks/tilemap.cpp b/framework/opengl_renderer/src/mm/opengl/render_tasks/tilemap.cpp index 7dd144b..ea4e906 100644 --- a/framework/opengl_renderer/src/mm/opengl/render_tasks/tilemap.cpp +++ b/framework/opengl_renderer/src/mm/opengl/render_tasks/tilemap.cpp @@ -96,7 +96,7 @@ void Tilemap::render(MM::Services::OpenGLRenderer& rs, MM::Engine& engine) { _vertexBuffer->bind(GL_ARRAY_BUFFER); _vao->bind(); - MM::OpenGL::Camera3D& cam = scene.ctx().at(); + MM::OpenGL::Camera3D& cam = scene.ctx().get(); auto vp = cam.getViewProjection(); _shader->setUniform3f("_ambient_color", ambient_color); diff --git a/framework/organizer_scene/src/mm/services/organizer_scene.cpp b/framework/organizer_scene/src/mm/services/organizer_scene.cpp index 36868d9..f72a5ba 100644 --- a/framework/organizer_scene/src/mm/services/organizer_scene.cpp +++ b/framework/organizer_scene/src/mm/services/organizer_scene.cpp @@ -81,7 +81,7 @@ void OrganizerSceneService::sceneFixedUpdate(Engine&) { _accumulator -= f_delta; continuous_counter++; - for (auto&& v : _scene->ctx().at>()) { + for (auto&& v : _scene->ctx().get>()) { v.callback()(v.data(), *_scene); } @@ -126,7 +126,8 @@ void OrganizerSceneService::updateOrganizerVertices(Scene& scene) { scene.ctx().emplace(); } - SPDLOG_DEBUG("graph:\n{}", scene.ctx().at>()); + // TODO: use entt::dot instead + SPDLOG_DEBUG("graph:\n{}", scene.ctx().get>()); } void OrganizerSceneService::resetTime(void) { diff --git a/framework/resource_manager/src/mm/resource_manager.hpp b/framework/resource_manager/src/mm/resource_manager.hpp index 41ea03c..9db976c 100644 --- a/framework/resource_manager/src/mm/resource_manager.hpp +++ b/framework/resource_manager/src/mm/resource_manager.hpp @@ -75,13 +75,13 @@ class ResourceManager { return reload(entt::hashed_string{id}.value(), std::forward(args)...); } - void discard(const res_id_type id) ENTT_NOEXCEPT { + void discard(const res_id_type id) noexcept { if (auto it = _storage.find(id); it != _storage.end()) { _storage.erase(it); } } - void discard(const char* id) ENTT_NOEXCEPT { + void discard(const char* id) noexcept { discard(entt::hashed_string{id}.value()); } @@ -100,11 +100,11 @@ class ResourceManager { return _storage.empty(); } - void clear(void) ENTT_NOEXCEPT { + void clear(void) noexcept { _storage.clear(); } - bool contains(const res_id_type id) const ENTT_NOEXCEPT { + bool contains(const res_id_type id) const noexcept { return (_storage.find(id) != _storage.cend()); }