From a48a443f297e0a32e6816f0fd4575f3f1b5a08de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 23 Feb 2015 22:35:00 +0100 Subject: [PATCH] SceneGraph: make use of Vector::pad(). --- src/Magnum/SceneGraph/AbstractCamera.hpp | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/Magnum/SceneGraph/AbstractCamera.hpp b/src/Magnum/SceneGraph/AbstractCamera.hpp index 8691cdcc2..194f06053 100644 --- a/src/Magnum/SceneGraph/AbstractCamera.hpp +++ b/src/Magnum/SceneGraph/AbstractCamera.hpp @@ -36,21 +36,6 @@ namespace Magnum { namespace SceneGraph { namespace Implementation { -template class Camera {}; - -template class Camera<2, T> { - public: - constexpr static Math::Matrix3 aspectRatioScale(const Math::Vector2& scale) { - return Math::Matrix3::scaling({scale.x(), scale.y()}); - } -}; -template class Camera<3, T> { - public: - constexpr static Math::Matrix4 aspectRatioScale(const Math::Vector2& scale) { - return Math::Matrix4::scaling({scale.x(), scale.y(), 1.0f}); - } -}; - template MatrixTypeFor aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2& projectionScale, const Vector2i& viewport) { /* Don't divide by zero / don't preserve anything */ if(projectionScale.x() == 0 || projectionScale.y() == 0 || viewport.x() == 0 || viewport.y() == 0 || aspectRatioPolicy == AspectRatioPolicy::NotPreserved) @@ -60,10 +45,10 @@ template MatrixTypeFor aspectRat /* Extend on larger side = scale larger side down Clip on smaller side = scale smaller side up */ - return Camera::aspectRatioScale( + return MatrixTypeFor::scaling(Math::Vector::pad( (relativeAspectRatio.x() > relativeAspectRatio.y()) == (aspectRatioPolicy == AspectRatioPolicy::Extend) ? - Vector2(relativeAspectRatio.y()/relativeAspectRatio.x(), T(1.0)) : - Vector2(T(1.0), relativeAspectRatio.x()/relativeAspectRatio.y())); + Vector2(relativeAspectRatio.y()/relativeAspectRatio.x(), T(1)) : + Vector2(T(1), relativeAspectRatio.x()/relativeAspectRatio.y()), T(1))); } }