mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-12 16:58:39 +00:00
Improve getPointedThing() (#4346)
* Improved getPointedThing() The new algorithm checks every node exactly once. Now the point and normal vector of the collision is also returned in the PointedThing (currently they are not used outside of the function). Now the CNodeDefManager keeps the union of all possible nodeboxes, so the raycast won't miss any nodes. Also if there are only small nodeboxes, getPointedThing() is exceptionally fast. Also adds unit test for VoxelLineIterator. * Cleanup, code move This commit moves getPointedThing() and Client::getSelectedActiveObject() to ClientEnvironment. The map nodes now can decide which neighbors they are connecting to (MapNode::getNeighbors()).
This commit is contained in:
parent
8aadc62856
commit
3f8261830e
20 changed files with 1046 additions and 433 deletions
|
@ -349,6 +349,11 @@ public:
|
|||
virtual void pendNodeResolve(NodeResolver *nr)=0;
|
||||
virtual bool cancelNodeResolveCallback(NodeResolver *nr)=0;
|
||||
virtual bool nodeboxConnects(const MapNode from, const MapNode to, u8 connect_face)=0;
|
||||
/*!
|
||||
* Returns the smallest box in node coordinates that
|
||||
* contains all nodes' selection boxes.
|
||||
*/
|
||||
virtual core::aabbox3d<s16> getSelectionBoxIntUnion() const=0;
|
||||
};
|
||||
|
||||
class IWritableNodeDefManager : public INodeDefManager {
|
||||
|
@ -406,6 +411,7 @@ public:
|
|||
virtual void runNodeResolveCallbacks()=0;
|
||||
virtual void resetNodeResolveState()=0;
|
||||
virtual void mapNodeboxConnections()=0;
|
||||
virtual core::aabbox3d<s16> getSelectionBoxIntUnion() const=0;
|
||||
};
|
||||
|
||||
IWritableNodeDefManager *createNodeDefManager();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue