ecs: allow components to have type void #359

Merged
dweiller merged 1 commit from void-components into main 2022-06-19 03:56:36 +00:00
dweiller commented 2022-06-19 02:38:39 +00:00 (Migrated from github.com)

Allow size 0 (void) components. These can be used as flags allowing to iterate over entities with certain flags, but without the need to branch on the value of a bool/bitset, but there is an extra branch in the get/set functions the new branch in get/set should be comptime evaluated and not impose any overhead at runtime. This also doesn't add any per-entity storage overhead, but does add the overhead of new archetypes for each combination of void-components used.

  • By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right.
Allow size 0 (void) components. These can be used as flags allowing to iterate over entities with certain flags, but without the need to branch on the value of a bool/bitset, ~but there is an extra branch in the get/set functions~ the new branch in get/set should be comptime evaluated and not impose any overhead at runtime. This also doesn't add any per-entity storage overhead, but does add the overhead of new archetypes for each combination of void-components used. - [x] By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right.
emidoots (Migrated from github.com) approved these changes 2022-06-19 03:56:21 +00:00
emidoots (Migrated from github.com) left a comment

OK nice, I like this, it's exactly how I was envisioning this would work. Great work, thanks!

OK nice, I like this, it's exactly how I was envisioning this would work. Great work, thanks!
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hexops/mach!359
No description provided.