1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-27 17:28:41 +00:00

Add spatial index for objects (#14631)

This commit is contained in:
Lars Müller 2025-04-08 08:44:53 +02:00 committed by GitHub
parent bed36139db
commit a3648b0b16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 982 additions and 116 deletions

View file

@ -6,6 +6,7 @@
#include <stack>
#include <utility>
#include "serverenvironment.h"
#include "irr_aabb3d.h"
#include "settings.h"
#include "log.h"
#include "mapblock.h"
@ -1399,10 +1400,14 @@ void ServerEnvironment::getSelectedActiveObjects(
return false;
};
aabb3f search_area(shootline_on_map.start, shootline_on_map.end);
search_area.repair();
search_area.MinEdge -= 5 * BS;
search_area.MaxEdge += 5 * BS;
// Use "logic in callback" pattern to avoid useless vector filling
std::vector<ServerActiveObject*> tmp;
getObjectsInsideRadius(tmp, shootline_on_map.getMiddle(),
0.5 * shootline_on_map.getLength() + 5 * BS, process);
getObjectsInArea(tmp, search_area, process);
}
/*