mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Optimize get_objects_inside_radius calls (#9671)
* Optimize getObjectsInsideRadius calls our previous implementation calls the ActiveObjectMgr to return ids and then lookup those ids in the same map and test each object Instead now we call the global map to return the pointers directly and we ask filtering when building the list using lamba. This drop double looping over ranges of active objects (and then filtered one) and drop x lookups on the map regarding the first call results
This commit is contained in:
parent
62ae7adab2
commit
e8ac5a31cf
7 changed files with 55 additions and 39 deletions
|
@ -35,8 +35,9 @@ public:
|
|||
bool registerObject(ServerActiveObject *obj) override;
|
||||
void removeObject(u16 id) override;
|
||||
|
||||
void getObjectsInsideRadius(
|
||||
const v3f &pos, float radius, std::vector<u16> &result);
|
||||
void getObjectsInsideRadius(const v3f &pos, float radius,
|
||||
std::vector<ServerActiveObject *> &result,
|
||||
std::function<bool(ServerActiveObject *obj)> include_obj_cb);
|
||||
|
||||
void getAddedActiveObjectsAroundPos(const v3f &player_pos, f32 radius,
|
||||
f32 player_radius, std::set<u16> ¤t_objects,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue