Commit 50f22e82 authored by Robert Menzel's avatar Robert Menzel

fixed setting of vertical FoV

parent d505364a
......@@ -148,7 +148,7 @@ class GenericCamera
/**
* Set the vertical field of view of the camera in degree.
* Aspect ratio will get changed!
* Horizontal FoV will get changed!
* @param _fovv New vertical field of view of the camera.
*/
void setVerticalFieldOfView( float _fovv );
......
......@@ -163,7 +163,10 @@ void GenericCamera::setVerticalFieldOfView(float _fovv)
// we only save the aspectRatio and the horizontal FoV
// so if we change the vertical FoV, we change the aspectRatio
mAspectRatio = tan( calcDegToRad(0.5f * mHorizontalFieldOfView) ) / tan( calcDegToRad(0.5f * _fovv) );
//mAspectRatio = tan( calcDegToRad(0.5f * mHorizontalFieldOfView) ) / tan( calcDegToRad(0.5f * _fovv) );
float x = tan( calcDegToRad(0.5f * _fovv) ) * mAspectRatio;
mHorizontalFieldOfView = calcRadToDeg( 2.0f * atan( x ) );
}
float GenericCamera::getVerticalFieldOfView() const
......@@ -215,7 +218,7 @@ glm::mat4 GenericCamera::getStereoViewMatrix( bool _leftEye, StereoMode _stereoM
// just shift the camera position to the left/right by half the eye-distance
//
ACGL::Utils::debug() << "WARNING: getStereoViewMatrix() is not tested yet" << std::endl; // remove after testing
//ACGL::Utils::debug() << "WARNING: getStereoViewMatrix() is not tested yet" << std::endl; // remove after testing
glm::mat3 inverseRotation = getInverseRotationMatrix3();
glm::vec3 eyePosition = mPosition + (inverseRotation * glm::vec3(cameraPositionShiftValue,0.0f,0.0f) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment