Lots of progress on octrees

This commit is contained in:
2022-07-11 02:32:12 -04:00
parent 227de3666d
commit d54d6e4433
11 changed files with 3691 additions and 309 deletions

View File

@@ -220,26 +220,23 @@ void World::tangible_delete(int64_t id) {
LS.result();
}
util::IdVector World::get_near_unsorted(int64_t player_id, float radius, bool exclude_nowhere, bool omit_player) const {
util::IdVector World::get_near(int64_t player_id, float radius, bool exclude_nowhere, bool omit_player, bool sorted) const {
const Tangible *player = tangible_get(player_id);
if (player == nullptr) {
return IdVector();
}
// Find out where's the center of the world.
// Find out where the player is.
const AnimStep &aqback = player->anim_queue_.back();
return plane_map_.scan_radius_unsorted(aqback.plane(), aqback.xyz().x, aqback.xyz().y, radius, exclude_nowhere, player_id, omit_player);
}
util::IdVector World::get_near(int64_t player_id, float radius, bool exclude_nowhere, bool omit_player) const {
const Tangible *player = tangible_get(player_id);
if (player == nullptr) {
return IdVector();
}
// Find out where's the center of the world.
const AnimStep &aqback = player->anim_queue_.back();
return plane_map_.scan_radius(aqback.plane(), aqback.xyz().x, aqback.xyz().y, radius, exclude_nowhere, player_id, omit_player);
PlaneScan scan;
scan.set_plane(aqback.plane());
scan.set_bbox_given_center_radius(aqback.xyz(), radius);
scan.set_shape(PlaneScan::SPHEROID);
scan.set_sorted(sorted);
scan.set_omit_nowhere(exclude_nowhere);
scan.set_special(player_id, omit_player);
return plane_map_.scan(scan);
}
World::Redirects World::fetch_redirects() {