mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Update client::ActiveObjectMgr::getActiveSelectableObjects API
This commit is contained in:
parent
aaae9d5a77
commit
d7291e0600
@ -107,9 +107,9 @@ void ActiveObjectMgr::getActiveObjects(const v3f &origin, f32 max_d,
|
||||
}
|
||||
}
|
||||
|
||||
void ActiveObjectMgr::getActiveSelectableObjects(const core::line3d<f32> &shootline,
|
||||
std::vector<DistanceSortedActiveObject> &dest)
|
||||
std::vector<DistanceSortedActiveObject> ActiveObjectMgr::getActiveSelectableObjects(const core::line3d<f32> &shootline)
|
||||
{
|
||||
std::vector<DistanceSortedActiveObject> dest;
|
||||
// Imagine a not-axis-aligned cuboid oriented into the direction of the shootline,
|
||||
// with the width of the object's selection box radius * 2 and with length of the
|
||||
// shootline (+selection box radius forwards and backwards). We check whether
|
||||
@ -147,6 +147,7 @@ void ActiveObjectMgr::getActiveSelectableObjects(const core::line3d<f32> &shootl
|
||||
|
||||
dest.emplace_back(obj, d);
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
} // namespace client
|
||||
|
@ -37,12 +37,10 @@ public:
|
||||
|
||||
void getActiveObjects(const v3f &origin, f32 max_d,
|
||||
std::vector<DistanceSortedActiveObject> &dest);
|
||||
// Similar to above, but takes selection box sizes, and line direction into
|
||||
// account.
|
||||
// Objects without selectionbox are not returned.
|
||||
// Returned distances are in direction of shootline.
|
||||
// Distance check is coarse.
|
||||
void getActiveSelectableObjects(const core::line3d<f32> &shootline,
|
||||
std::vector<DistanceSortedActiveObject> &dest);
|
||||
|
||||
/// Gets all CAOs whose selection boxes may intersect the @p shootline.
|
||||
/// @note CAOs without a selection box are not returned.
|
||||
/// @note Distances are along the @p shootline.
|
||||
std::vector<DistanceSortedActiveObject> getActiveSelectableObjects(const core::line3d<f32> &shootline);
|
||||
};
|
||||
} // namespace client
|
||||
|
@ -495,8 +495,7 @@ void ClientEnvironment::getSelectedActiveObjects(
|
||||
const core::line3d<f32> &shootline_on_map,
|
||||
std::vector<PointedThing> &objects)
|
||||
{
|
||||
std::vector<DistanceSortedActiveObject> allObjects;
|
||||
m_ao_manager.getActiveSelectableObjects(shootline_on_map, allObjects);
|
||||
auto allObjects = m_ao_manager.getActiveSelectableObjects(shootline_on_map);
|
||||
const v3f line_vector = shootline_on_map.getVector();
|
||||
|
||||
for (const auto &allObject : allObjects) {
|
||||
|
Loading…
Reference in New Issue
Block a user