MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / shrink

Method shrink

modules/engine/runtime/src/ecs/entities.cpp:15–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13}
14
15void entity_registry_t::shrink()
16{
17 SMutexLock lock(mutex.mMutex);
18 if (entries.size() == 0)
19 return;
20 EIndex lastValid = (EIndex)(entries.size() - 1);
21 while (lastValid != 0 && entries[lastValid].chunk == nullptr)
22 --lastValid;
23 if (entries[lastValid].indexInChunk == 0)
24 {
25 entries.clear();
26 return;
27 }
28 entries.resize_default(lastValid + 1);
29 entries.shrink();
30 freeEntries.remove_all_if([&](EIndex i) {
31 return i > lastValid;
32 });
33}
34
35void entity_registry_t::new_entities(sugoi_entity_t* dst, EIndex count)
36{

Calls 4

sizeMethod · 0.45
clearMethod · 0.45
resize_defaultMethod · 0.45
remove_all_ifMethod · 0.45