mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-17 10:25:21 +02: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:
@@ -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();
|
||||
|
Reference in New Issue
Block a user