A way to determine whether an entity should be rendered
Posted: Mon Nov 25, 2024 10:07 am
I would like to improve the performance of a mod by not processing entities that are not in any view. These Nixie Tubes serve no other purpose than to display values, so it seems like a waste to update them when nobody is viewing them.
The only way I can think of is to check every player, check whether they are in map view, if they are on the right surface, what their zoom level, resolution and display density scale are and then manually calculate whether a given entity should be able to be seen.
This sounds very CPU intensive to do every tick, and doesn't take into account a GUI camera for example.
What I would like to see is something like LuaEntity.is_in_camera() or on_pre_entity_rendered.
The only way I can think of is to check every player, check whether they are in map view, if they are on the right surface, what their zoom level, resolution and display density scale are and then manually calculate whether a given entity should be able to be seen.
This sounds very CPU intensive to do every tick, and doesn't take into account a GUI camera for example.
What I would like to see is something like LuaEntity.is_in_camera() or on_pre_entity_rendered.