update entt to v3.12.2

This commit is contained in:
Green Sky 2023-09-07 01:51:33 +02:00
parent 00e48f9967
commit 3a885ee250
No known key found for this signature in database
3 changed files with 19 additions and 26 deletions

2
external/entt vendored

@ -1 +1 @@
Subproject commit fef921132cae7588213d0f9bcd2fb9c8ffd8b7fc Subproject commit 344e03ac64a1f78424ab1150e2d4778e8df8431d

View File

@ -134,10 +134,10 @@ public:
e = registry.create(); e = registry.create();
// create a copy of an entity component by component // create a copy of an entity component by component
for (auto &&curr: registry.storage()) { for(auto &&curr: registry.storage()) {
if (auto &storage = curr.second; storage.contains(old_e)) { if(auto &storage = curr.second; storage.contains(old_e)) {
// TODO: do something with the return value. returns false on failure. // TODO: do something with the return value. returns false on failure.
storage.emplace(e, storage.get(old_e)); storage.push(e, storage.value(old_e));
} }
} }
} }
@ -237,11 +237,11 @@ public:
if (comp_list.empty()) { if (comp_list.empty()) {
ImGui::Text("Orphans:"); ImGui::Text("Orphans:");
registry.each([&registry](auto e){ for (EntityType e : registry.template storage<EntityType>()) {
if (registry.orphan(e)) { if (registry.orphan(e)) {
MM_IEEE_ENTITY_WIDGET(e, registry, false); MM_IEEE_ENTITY_WIDGET(e, registry, false);
} }
}); }
} else { } else {
entt::runtime_view view{}; entt::runtime_view view{};
for (const auto type : comp_list) { for (const auto type : comp_list) {
@ -264,17 +264,6 @@ public:
} }
} }
[[deprecated("Use renderEditor() instead. And manage the window yourself.")]]
void render(Registry& registry, EntityType& e)
{
if (show_window) {
if (ImGui::Begin("Entity Editor", &show_window)) {
renderEditor(registry, e);
}
ImGui::End();
}
}
// displays both, editor and list // displays both, editor and list
// uses static internally, use only as a quick way to get going! // uses static internally, use only as a quick way to get going!
void renderSimpleCombo(Registry& registry, EntityType& e) void renderSimpleCombo(Registry& registry, EntityType& e)

View File

@ -1,4 +1,5 @@
#include "./scene_tools.hpp" #include "./scene_tools.hpp"
#include "mm/engine_fwd.hpp"
#include <mm/engine.hpp> #include <mm/engine.hpp>
@ -109,16 +110,19 @@ namespace MM::Services {
if (_show_scene_metrics) { if (_show_scene_metrics) {
if (ImGui::Begin("Scene Metrics##ImGuiSceneToolsService", &_show_scene_metrics)) { if (ImGui::Begin("Scene Metrics##ImGuiSceneToolsService", &_show_scene_metrics)) {
ImGui::Text("capacity: %lu", scene.capacity()); ImGui::Text("capacity: %zu", scene.storage<::MM::Entity>().capacity());
ImGui::Text("size: %lu", scene.size()); ImGui::Text("size: %zu", scene.storage<::MM::Entity>().size());
ImGui::Text("alive: %lu", scene.alive()); ImGui::Text("alive: %zu", scene.storage<::MM::Entity>().in_use());
size_t orphans = 0; if (ImGui::CollapsingHeader("orphans")) {
scene.each([&orphans, &scene](auto entity) { // iterating all entities is expensive
if (scene.orphan(entity)) { size_t orphans = 0;
orphans++; for (const auto it : scene.storage<MM::Entity>().each()) {
if (scene.orphan(std::get<0>(it))) {
orphans++;
}
} }
}); ImGui::Text("orphans: %lu", orphans);
ImGui::Text("orphans: %lu", orphans); }
} }
ImGui::End(); ImGui::End();
} }