From 4cb986b3f90ef7d3b05d2fdb11b7479cd3a4da63 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Sat, 13 Apr 2013 13:09:20 -0700 Subject: [PATCH] tweaks to ViewFrustum's default FOV, added comments --- libraries/voxels/src/ViewFrustum.cpp | 11 ++++++++++- libraries/voxels/src/ViewFrustum.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libraries/voxels/src/ViewFrustum.cpp b/libraries/voxels/src/ViewFrustum.cpp index 2d3899648d..d7e87d36b3 100644 --- a/libraries/voxels/src/ViewFrustum.cpp +++ b/libraries/voxels/src/ViewFrustum.cpp @@ -10,6 +10,8 @@ #include "ViewFrustum.h" +float ViewFrustum::fovAngleAdust=1.75; + ViewFrustum::ViewFrustum(glm::vec3 position, glm::vec3 direction, glm::vec3 up, glm::vec3 right, float screenWidth, float screenHeight) { this->calculateViewFrustum(position, direction, up, right, screenWidth, screenHeight); @@ -36,7 +38,14 @@ void ViewFrustum::calculateViewFrustum(glm::vec3 position, glm::vec3 direction, this->_screenHeight = screenHeight; glm::vec3 front = direction; - float fovHalfAngle = 0.7854f * 1.5; // 45 deg and some hackery. Still trying to figure out our correct fov + + // Calculating field of view. + // 0.7854f is 45 deg + // ViewFrustum::fovAngleAdust defaults to 1.75 + // Apparently our fov is around 1.75 times this value or 78.75 degrees + // you can adjust this in interface by using the "|" and "\" keys to tweak + // the adjustment and see effects of different FOVs + float fovHalfAngle = 0.7854f * ViewFrustum::fovAngleAdust; float ratio = screenWidth / screenHeight; this->_nearDist = 0.1; diff --git a/libraries/voxels/src/ViewFrustum.h b/libraries/voxels/src/ViewFrustum.h index 02c7c39bcc..9fb17ae339 100644 --- a/libraries/voxels/src/ViewFrustum.h +++ b/libraries/voxels/src/ViewFrustum.h @@ -61,6 +61,8 @@ public: glm::vec3 up, glm::vec3 right, float screenWidth, float screenHeight); void dump(); + + static float fovAngleAdust; };