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

Method match_group

modules/engine/runtime/src/ecs/query.cpp:779–817  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

777}
778
779bool sugoi_storage_t::match_group(const sugoi_filter_t& filter, const sugoi_meta_filter_t& meta, const sugoi_group_t* group)
780{
781 using namespace sugoi;
782 fixed_stack_scope_t _(localStack);
783 bool filterShared = (filter.all_shared.length + filter.none_shared.length) != 0;
784 sugoi_meta_filter_t* validatedMeta = nullptr;
785 if (meta.all_meta.length > 0 || meta.any_meta.length > 0 || meta.none_meta.length > 0)
786 {
787 validatedMeta = localStack.allocate<sugoi_meta_filter_t>();
788 auto data = (char*)localStack.allocate(data_size(meta));
789 *validatedMeta = sugoi::clone(meta, data);
790 validate(validatedMeta->all_meta);
791 validate(validatedMeta->any_meta);
792 validate(validatedMeta->none_meta);
793 }
794 else
795 {
796 validatedMeta = (sugoi_meta_filter_t*)&meta;
797 }
798 bool filterMeta = (validatedMeta->all_meta.length + validatedMeta->any_meta.length + validatedMeta->none_meta.length) != 0;
799 if (filterShared)
800 {
801 fixed_stack_scope_t _(localStack);
802 sugoi_type_set_t shared;
803 shared.length = 0;
804 // todo: is 256 enough?
805 shared.data = localStack.allocate<sugoi_type_index_t>(256);
806 group->get_shared_type(shared, localStack.allocate<sugoi_type_index_t>(256));
807 // check(shared.length < 256);
808 if (!match_group_shared(shared, filter))
809 return false;
810 }
811 if (filterMeta)
812 {
813 if (!match_group_meta(group->type, *validatedMeta))
814 return false;
815 }
816 return match_group_type(group->type, filter, group->archetype->withMask);
817}
818
819void sugoi_storage_t::query(const sugoi_group_t* group, const sugoi_filter_t& filter, const sugoi_meta_filter_t& meta, sugoi_custom_filter_callback_t customFilter, void* u1, sugoi_view_callback_t callback, void* u)
820{

Callers 1

sugoiQ_get_views_groupFunction · 0.80

Calls 7

data_sizeFunction · 0.85
match_group_sharedFunction · 0.85
match_group_metaFunction · 0.85
match_group_typeFunction · 0.85
get_shared_typeMethod · 0.80
cloneFunction · 0.70
allocateMethod · 0.45

Tested by

no test coverage detected