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

Method batch

modules/engine/runtime/src/ecs/storage.cpp:614–642  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

612}
613
614void sugoi_storage_t::batch(const sugoi_entity_t* ents, EIndex count, sugoi_view_callback_t callback, void* u)
615{
616 if (count == 0)
617 return;
618 else if (count == 1)
619 {
620 sugoi_chunk_view_t v = entity_view(ents[0]);
621 callback(u, &v);
622 return;
623 }
624 EIndex current = 0;
625 auto view = entity_view(ents[current++]);
626 while (current < count)
627 {
628 sugoi_chunk_view_t v = entity_view(ents[current]);
629 if (v.chunk == view.chunk && v.start == view.start + view.count)
630 {
631 view.count++;
632 }
633 else
634 {
635 callback(u, &view);
636 // v is not valid anymore
637 view = entity_view(ents[current]);
638 }
639 current++;
640 }
641 callback(u, &view);
642}
643
644void sugoi_storage_t::merge(sugoi_storage_t& src)
645{

Callers 2

sugoiS_destroy_entitiesFunction · 0.80
sugoiS_batchFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected