From 3f8261830e0503cd59d8713d5c9aab12fc1491db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Juh=C3=A1sz?= Date: Wed, 4 Jan 2017 19:18:40 +0100 Subject: 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()). --- src/mapnode.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/mapnode.h') diff --git a/src/mapnode.h b/src/mapnode.h index 0bd61c554..a3c20e8ff 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include class INodeDefManager; +class Map; /* Naming scheme: @@ -246,6 +247,13 @@ struct MapNode void rotateAlongYAxis(INodeDefManager *nodemgr, Rotation rot); + /*! + * Checks which neighbors does this node connect to. + * + * \param p coordinates of the node + */ + u8 getNeighbors(v3s16 p, Map *map); + /* Gets list of node boxes (used for rendering (NDT_NODEBOX)) */ -- cgit v1.2.3