diff --git a/src/Math/Matrix4.h b/src/Math/Matrix4.h index c72dc52a9..757ebab21 100644 --- a/src/Math/Matrix4.h +++ b/src/Math/Matrix4.h @@ -216,15 +216,15 @@ template class Matrix4: public Matrix<4, T> { /** * @brief 3D perspective projection matrix - * @param fov Field of view angle (horizontal, in radians) + * @param fov Field of view angle (horizontal) * @param aspectRatio Aspect ratio * @param near Near clipping plane * @param far Far clipping plane * * @see orthographicProjection(), Matrix3::projection() */ - static Matrix4 perspectiveProjection(T fov, T aspectRatio, T near, T far) { - T xyScale = 2*std::tan(fov/2)*near; + static Matrix4 perspectiveProjection(Rad fov, T aspectRatio, T near, T far) { + T xyScale = 2*std::tan(T(fov)/2)*near; return perspectiveProjection(Vector2(xyScale, xyScale/aspectRatio), near, far); } diff --git a/src/Math/Test/Matrix4Test.cpp b/src/Math/Test/Matrix4Test.cpp index c1d815587..951b4b0c9 100644 --- a/src/Math/Test/Matrix4Test.cpp +++ b/src/Math/Test/Matrix4Test.cpp @@ -200,7 +200,7 @@ void Matrix4Test::perspectiveProjectionFov() { { 0.0f, 9.788454f, 0.0f, 0.0f}, { 0.0f, 0.0f, -1.9411764f, -1.0f}, { 0.0f, 0.0f, -94.1176452f, 0.0f}); - CORRADE_COMPARE(Matrix4::perspectiveProjection(deg(27.0f), 2.35f, 32.0f, 100), expected); + CORRADE_COMPARE(Matrix4::perspectiveProjection(Deg(27.0f), 2.35f, 32.0f, 100), expected); } void Matrix4Test::fromParts() { diff --git a/src/SceneGraph/Camera3D.h b/src/SceneGraph/Camera3D.h index 91c8a6cd2..d10124ac2 100644 --- a/src/SceneGraph/Camera3D.h +++ b/src/SceneGraph/Camera3D.h @@ -83,7 +83,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Camera3D: public AbstractCamera<3, T> { /** * @brief Set perspective projection - * @param fov Field of view angle (horizontal, in radians) + * @param fov Field of view angle (horizontal) * @param aspectRatio Aspect ratio * @param near Near clipping plane * @param far Far clipping plane @@ -91,7 +91,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Camera3D: public AbstractCamera<3, T> { * * @see setOrthographic(), Matrix4::perspectiveProjection() */ - Camera3D* setPerspective(T fov, T aspectRatio, T near, T far); + Camera3D* setPerspective(Math::Rad fov, T aspectRatio, T near, T far); /** @brief Near clipping plane */ inline T near() const { return _near; } diff --git a/src/SceneGraph/Camera3D.hpp b/src/SceneGraph/Camera3D.hpp index 7bfe41db8..a64537345 100644 --- a/src/SceneGraph/Camera3D.hpp +++ b/src/SceneGraph/Camera3D.hpp @@ -46,7 +46,7 @@ template Camera3D* Camera3D::setPerspective(const Math::Vector2 Camera3D* Camera3D::setPerspective(T fov, T aspectRatio, T near, T far) { +template Camera3D* Camera3D::setPerspective(Math::Rad fov, T aspectRatio, T near, T far) { /** @todo Get near/far from the matrix */ _near = near; _far = far;