diff options
author | Dániel Juhász <juhdanad@gmail.com> | 2016-12-01 20:15:37 +0100 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2017-12-26 21:51:32 +0000 |
commit | 2153965cf92ab61b0d7e095cf3c2755924fdc221 (patch) | |
tree | 3895bdca9684f0f94a2a9f8653e013eecc0d4e1e /src/serverenvironment.h | |
parent | ca64f564cd23dba45bc93b57a718dfe81df5ba27 (diff) | |
download | minetest-2153965cf92ab61b0d7e095cf3c2755924fdc221.tar.gz minetest-2153965cf92ab61b0d7e095cf3c2755924fdc221.tar.bz2 minetest-2153965cf92ab61b0d7e095cf3c2755924fdc221.zip |
Line_of_sight: Improve using VoxelLineIterator
This commit rewrites line_of_sight with VoxelLineIterator.
Stepsize is no longer needed, the results will be always accurate.
Diffstat (limited to 'src/serverenvironment.h')
-rw-r--r-- | src/serverenvironment.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/serverenvironment.h b/src/serverenvironment.h index a15d87ee2..ea295b919 100644 --- a/src/serverenvironment.h +++ b/src/serverenvironment.h @@ -328,8 +328,15 @@ public: // This makes stuff happen void step(f32 dtime); - //check if there's a line of sight between two positions - bool line_of_sight(v3f pos1, v3f pos2, float stepsize=1.0, v3s16 *p=NULL); + /*! + * Returns false if the given line intersects with a + * non-air node, true otherwise. + * \param pos1 start of the line + * \param pos2 end of the line + * \param p output, position of the first non-air node + * the line intersects + */ + bool line_of_sight(v3f pos1, v3f pos2, v3s16 *p = NULL); u32 getGameTime() const { return m_game_time; } |