From 23fe9898ef592b422330801dec0a7b0f3ee4a1a8 Mon Sep 17 00:00:00 2001 From: Jacob Stewart <2606873+unitoftime@users.noreply.github.com> Date: Wed, 15 Nov 2023 17:48:40 -0500 Subject: [PATCH] Added without filter --- component.go | 42 +++++++++++++++++++++++++++++++++++- filter.go | 61 +++++++++++++++++++++++++++------------------------- 2 files changed, 73 insertions(+), 30 deletions(-) diff --git a/component.go b/component.go index 3a0377d..1ac11d0 100644 --- a/component.go +++ b/component.go @@ -44,6 +44,8 @@ func (c Box[T]) Get() T { // Note: you can increase max component size by increasing maxComponentId and archetypeMask // TODO: I should have some kind of panic if you go over maximum component size const maxComponentId = 255 + +var blankArchMask archetypeMask // Supports maximum 256 unique component types type archetypeMask [4]uint64 // TODO: can/should I make this configurable? func buildArchMask(comps ...Component) archetypeMask { @@ -57,8 +59,19 @@ func buildArchMask(comps ...Component) archetypeMask { } return mask } +func buildArchMaskFromAny(comps ...any) archetypeMask { + var mask archetypeMask + for _, comp := range comps { + // Ranges: [0, 64), [64, 128), [128, 192), [192, 256) + c := name(comp) + idx := c / 64 + offset := c - (64 * idx) + mask[idx] |= (1<