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:
parent
bed36139db
commit
a3648b0b16
17 changed files with 982 additions and 116 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue