summaryrefslogtreecommitdiff
path: root/src/utility.cpp
diff options
context:
space:
mode:
authorKahrl <kahrl@gmx.net>2011-09-08 01:08:47 +0200
committerKahrl <kahrl@gmx.net>2011-09-08 01:08:47 +0200
commitbaf7da9d4a7fc0566840b159903999d76d99a228 (patch)
tree66ed23105449fcf51e971d5f8fcbf03d04973fb7 /src/utility.cpp
parentc0b35fa429c68b49b2d6a5124aff6dcc31400b63 (diff)
downloadminetest-baf7da9d4a7fc0566840b159903999d76d99a228.tar.gz
minetest-baf7da9d4a7fc0566840b159903999d76d99a228.tar.bz2
minetest-baf7da9d4a7fc0566840b159903999d76d99a228.zip
Collected and moved existing camera infrastructure from game.cpp to camera.cpp and camera.h. Introduced configuration settings 'fov' which chooses the camera's (vertical) field of view and 'view_bobbing' which currently does nothing. Other code refactored to not expect the FOV to be a build time constant.
Diffstat (limited to 'src/utility.cpp')
-rw-r--r--src/utility.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/utility.cpp b/src/utility.cpp
index 0721100cb..9c1edc8a9 100644
--- a/src/utility.cpp
+++ b/src/utility.cpp
@@ -162,8 +162,8 @@ void mysrand(unsigned seed)
camera_dir: an unit vector pointing to camera direction
range: viewing range
*/
-bool isBlockInSight(v3s16 blockpos_b, v3f camera_pos, v3f camera_dir, f32 range,
- f32 *distance_ptr)
+bool isBlockInSight(v3s16 blockpos_b, v3f camera_pos, v3f camera_dir,
+ f32 camera_fov, f32 range, f32 *distance_ptr)
{
v3s16 blockpos_nodes = blockpos_b * MAP_BLOCKSIZE;
@@ -211,8 +211,7 @@ bool isBlockInSight(v3s16 blockpos_b, v3f camera_pos, v3f camera_dir, f32 range,
cosangle += block_max_radius / dforward;
// If block is not in the field of view, skip it
- //if(cosangle < cos(FOV_ANGLE/2))
- if(cosangle < cos(FOV_ANGLE/2. * 4./3.))
+ if(cosangle < cos(camera_fov / 2))
return false;
}