Improve getPointedThing() (#4346)
authorDániel Juhász <juhdanad@gmail.com>
Wed, 4 Jan 2017 18:18:40 +0000 (19:18 +0100)
committerest31 <est31@users.noreply.github.com>
Wed, 4 Jan 2017 18:18:40 +0000 (19:18 +0100)
commit3f8261830e0503cd59d8713d5c9aab12fc1491db
treeb49d898815a6c2e692cfe2fc0978cfedd49cd34f
parent8aadc62856cc3789ed345ddf3870e311af60afe9
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()).
20 files changed:
src/CMakeLists.txt
src/client.cpp
src/client.h
src/clientmap.cpp
src/environment.cpp
src/environment.h
src/game.cpp
src/map.cpp
src/map.h
src/mapnode.cpp
src/mapnode.h
src/nodedef.cpp
src/nodedef.h
src/raycast.cpp [new file with mode: 0644]
src/raycast.h [new file with mode: 0644]
src/unittest/test_voxelalgorithms.cpp
src/util/pointedthing.cpp
src/util/pointedthing.h
src/voxelalgorithms.cpp
src/voxelalgorithms.h