Commit Graph

5 Commits

Author SHA1 Message Date
Bill Currie 698ce157b3 [ecs] Move correct number of subpool ranges
Fixes yet another segfault when deleting the last range in the subpool.
Also, initialize the subpool's next index.
2023-07-11 00:06:21 +09:00
Bill Currie 76b6d3141b [ecs] Use correct index when deleting subpool ranges
Coming up with tests is hard. Breaking code with real code is easy.
2023-07-09 11:52:11 +09:00
Bill Currie c32ffce886 [ecs] Add a function to move a subpool to be the last
This has use when the order of components in the pool affects draw order
(or has other significance), especially at the subpool level. I plan to
use it for fixing overlapping windows in imui.
2023-07-08 19:55:37 +09:00
Bill Currie 3a2877dd9a [ecs] Adjust subpool range type to return start,end
I found I needed the subrange start as well as the end, but I liked that
the subpools themselves used only the end of the range, so switching to
just a unint32_t for the value and adding a function to return a tuple
made sense. I had kept the struct because I thought I might want to
store additional information (eg, the entity "owning" the subpool), but
found that I didn't need such information as the systems using subpools
that way would have access to the entity by other means.

Interestingly, the change found a bug in subpool creation: I really
don't know why things worked before, but they work better now :)
2022-12-20 17:56:08 +09:00
Bill Currie d67b8cdf05 [ecs] Add support for subpools
Subpools are for grouping components by some criterion. Any component
that has a rangeid callback will be grouped with other components that
return the same render id. Note that the ordering of components within a
group will be affected by adding a component into a group that comes
before that group (or removing a component).

Component pools can have multiple groups, added and removed dynamically,
but removing a group should (currently) be done only when empty.
2022-12-18 21:11:21 +09:00