Filtering for rendering only specific entities #1062
MrJakobLaich
started this conversation in
General
Replies: 1 comment 1 reply
-
Flip the problem on its head then. Iterate the entities in the render area and attach a render-me component to them. Then iterate the entities that have a position, render and render-me component. Finally, clear the render-me pool for the next iteration and you're done. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've looked but not found anything related to this.
What I have / will have (currently refactoring to use enTT)
registry that stores position, render data, etc
screen window with camera that renders only the specific part the player can see (using sdl2, 2d top down tilemap, centered on player position)
each tile/chunk in the map stores the entity IDs of whatever is on top of it, the IDs are collected when rendering the tiles/chunks (the IDs would get passed to the enTT registry and then I'd only render these)
Then I would want to somehow filter all the entities inside my registry, without having to iterate over every single entity that has a position and render component and if-checking if the entity would be inside the render area
So, my question because I can't find anything related to this:
Beta Was this translation helpful? Give feedback.
All reactions