From 4a4768a12aa703b756a2c576d65c4efc7697e688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 24 May 2014 16:17:18 +0200 Subject: [PATCH] Use template aliases where possible. Because with GCC 4.7 we can. --- src/Magnum/Math/Complex.h | 8 ++-- src/Magnum/Math/Matrix3.h | 34 ++++++++-------- src/Magnum/Math/Matrix4.h | 39 +++++++++---------- src/Magnum/Math/Quaternion.h | 12 +++--- src/Magnum/Math/Test/ComplexTest.cpp | 2 +- src/Magnum/Math/Test/Matrix3Test.cpp | 2 +- .../AbstractTranslationRotation2D.h | 5 +-- .../AbstractTranslationRotation3D.h | 5 +-- src/Magnum/SceneGraph/Camera2D.h | 8 ++-- src/Magnum/SceneGraph/Camera2D.hpp | 8 ++-- src/Magnum/SceneGraph/Camera3D.h | 8 ++-- src/Magnum/SceneGraph/Camera3D.hpp | 16 ++++---- .../Test/TranslationTransformationTest.cpp | 2 +- 13 files changed, 70 insertions(+), 79 deletions(-) diff --git a/src/Magnum/Math/Complex.h b/src/Magnum/Math/Complex.h index 6e79309c1..515e76857 100644 --- a/src/Magnum/Math/Complex.h +++ b/src/Magnum/Math/Complex.h @@ -41,7 +41,7 @@ namespace Magnum { namespace Math { namespace Implementation { /* No assertions fired, for internal use. Not private member because used from outside the class. */ - template constexpr static Complex complexFromMatrix(const Matrix<2, T>& matrix) { + template constexpr static Complex complexFromMatrix(const Matrix2x2& matrix) { return {matrix[0][0], matrix[0][1]}; } } @@ -106,7 +106,7 @@ template class Complex { * @see @ref toMatrix(), @ref DualComplex::fromMatrix(), * @ref Matrix::isOrthogonal() */ - static Complex fromMatrix(const Matrix<2, T>& matrix) { + static Complex fromMatrix(const Matrix2x2& matrix) { CORRADE_ASSERT(matrix.isOrthogonal(), "Math::Complex::fromMatrix(): the matrix is not orthogonal", {}); return Implementation::complexFromMatrix(matrix); @@ -203,9 +203,9 @@ template class Complex { * \end{pmatrix} * @f] * @see @ref fromMatrix(), @ref DualComplex::toMatrix(), - * @ref Matrix3::from(const Matrix<2, T>&, const Vector2&) + * @ref Matrix3::from(const Matrix2x2&, const Vector2&) */ - Matrix<2, T> toMatrix() const { + Matrix2x2 toMatrix() const { return {Vector<2, T>(_real, _imaginary), Vector<2, T>(-_imaginary, _real)}; } diff --git a/src/Magnum/Math/Matrix3.h b/src/Magnum/Math/Matrix3.h index ef536c9b3..bf00f5b2d 100644 --- a/src/Magnum/Math/Matrix3.h +++ b/src/Magnum/Math/Matrix3.h @@ -43,7 +43,7 @@ See @ref matrix-vector and @ref transformations for brief introduction. @ref DualComplex, @ref SceneGraph::MatrixTransformation2D @configurationvalueref{Magnum::Math::Matrix3} */ -template class Matrix3: public Matrix<3, T> { +template class Matrix3: public Matrix3x3 { public: /** * @brief 2D translation matrix @@ -95,7 +95,7 @@ template class Matrix3: public Matrix<3, T> { static Matrix3 reflection(const Vector2& normal) { CORRADE_ASSERT(normal.isNormalized(), "Math::Matrix3::reflection(): normal must be normalized", {}); - return from(Matrix<2, T>() - T(2)*normal*RectangularMatrix<1, 2, T>(normal).transposed(), {}); + return from(Matrix2x2() - T(2)*normal*RectangularMatrix<1, 2, T>(normal).transposed(), {}); } /** @@ -119,14 +119,14 @@ template class Matrix3: public Matrix<3, T> { * @see @ref rotationScaling(), translation() const * @todoc Explicit reference when Doxygen can handle const */ - constexpr static Matrix3 from(const Matrix<2, T>& rotationScaling, const Vector2& translation) { + constexpr static Matrix3 from(const Matrix2x2& rotationScaling, const Vector2& translation) { return {{rotationScaling[0], T(0)}, {rotationScaling[1], T(0)}, { translation, T(1)}}; } /** @copydoc Matrix::Matrix(ZeroType) */ - constexpr explicit Matrix3(typename Matrix<3, T>::ZeroType): Matrix<3, T>(Matrix<3, T>::Zero) {} + constexpr explicit Matrix3(typename Matrix3x3::ZeroType): Matrix3x3(Matrix3x3::Zero) {} /** * @brief Default constructor @@ -135,19 +135,19 @@ template class Matrix3: public Matrix<3, T> { * constructor with `%Matrix3 m(Matrix3::Identity);`. Optional * parameter @p value allows you to specify value on diagonal. */ - constexpr /*implicit*/ Matrix3(typename Matrix<3, T>::IdentityType = (Matrix<3, T>::Identity), T value = T(1)): Matrix<3, T>(Matrix<3, T>::Identity, value) {} + constexpr /*implicit*/ Matrix3(typename Matrix3x3::IdentityType = (Matrix3x3::Identity), T value = T(1)): Matrix3x3(Matrix3x3::Identity, value) {} /** @brief %Matrix from column vectors */ - constexpr /*implicit*/ Matrix3(const Vector3& first, const Vector3& second, const Vector3& third): Matrix<3, T>(first, second, third) {} + constexpr /*implicit*/ Matrix3(const Vector3& first, const Vector3& second, const Vector3& third): Matrix3x3(first, second, third) {} /** @copydoc Matrix::Matrix(const RectangularMatrix&) */ - template constexpr explicit Matrix3(const RectangularMatrix<3, 3, U>& other): Matrix<3, T>(other) {} + template constexpr explicit Matrix3(const RectangularMatrix<3, 3, U>& other): Matrix3x3(other) {} /** @brief Construct matrix from external representation */ - template::from(std::declval()))> constexpr explicit Matrix3(const U& other): Matrix<3, T>(Implementation::RectangularMatrixConverter<3, 3, T, U>::from(other)) {} + template::from(std::declval()))> constexpr explicit Matrix3(const U& other): Matrix3x3(Implementation::RectangularMatrixConverter<3, 3, T, U>::from(other)) {} /** @brief Copy constructor */ - constexpr Matrix3(const RectangularMatrix<3, 3, T>& other): Matrix<3, T>(other) {} + constexpr Matrix3(const RectangularMatrix<3, 3, T>& other): Matrix3x3(other) {} /** * @brief Check whether the matrix represents rigid transformation @@ -164,13 +164,13 @@ template class Matrix3: public Matrix<3, T> { * @brief 2D rotation and scaling part of the matrix * * Upper-left 2x2 part of the matrix. - * @see @ref from(const Matrix<2, T>&, const Vector2&), + * @see @ref from(const Matrix2x2&, const Vector2&), * rotation() const, @ref rotationNormalized(), * @ref uniformScaling(), @ref rotation(Rad), * @ref Matrix4::rotationScaling() * @todoc Explicit reference when Doxygen can handle const */ - constexpr Matrix<2, T> rotationScaling() const { + constexpr Matrix2x2 rotationScaling() const { return {(*this)[0].xy(), (*this)[1].xy()}; } @@ -185,7 +185,7 @@ template class Matrix3: public Matrix<3, T> { * @todo assert also orthogonality or this is good enough? * @todoc Explicit reference when Doxygen can handle const */ - Matrix<2, T> rotationNormalized() const { + Matrix2x2 rotationNormalized() const { CORRADE_ASSERT((*this)[0].xy().isNormalized() && (*this)[1].xy().isNormalized(), "Math::Matrix3::rotationNormalized(): the rotation part is not normalized", {}); return {(*this)[0].xy(), @@ -202,7 +202,7 @@ template class Matrix3: public Matrix<3, T> { * Matrix4::rotation() const * @todoc Explicit reference when Doxygen can handle const */ - Matrix<2, T> rotation() const { + Matrix2x2 rotation() const { CORRADE_ASSERT(TypeTraits::equals((*this)[0].xy().dot(), (*this)[1].xy().dot()), "Math::Matrix3::rotation(): the matrix doesn't have uniform scaling", {}); return {(*this)[0].xy().normalized(), @@ -263,7 +263,7 @@ template class Matrix3: public Matrix<3, T> { * @brief 2D translation part of the matrix * * First two elements of third column. - * @see @ref from(const Matrix<2, T>&, const Vector2&), + * @see @ref from(const Matrix2x2&, const Vector2&), * @ref translation(const Vector2&), * @ref Matrix4::translation() */ @@ -323,7 +323,7 @@ MAGNUM_MATRIXn_OPERATOR_IMPLEMENTATION(3, Matrix3) /** @debugoperator{Magnum::Math::Matrix3} */ template inline Corrade::Utility::Debug operator<<(Corrade::Utility::Debug debug, const Matrix3& value) { - return debug << static_cast&>(value); + return debug << static_cast&>(value); } template Matrix3 Matrix3::rotation(const Rad angle) { @@ -339,7 +339,7 @@ template inline Matrix3 Matrix3::invertedRigid() const { CORRADE_ASSERT(isRigidTransformation(), "Math::Matrix3::invertedRigid(): the matrix doesn't represent rigid transformation", {}); - Matrix<2, T> inverseRotation = rotationScaling().transposed(); + Matrix2x2 inverseRotation = rotationScaling().transposed(); return from(inverseRotation, inverseRotation*-translation()); } @@ -347,7 +347,7 @@ template inline Matrix3 Matrix3::invertedRigid() const { namespace Corrade { namespace Utility { /** @configurationvalue{Magnum::Math::Matrix3} */ - template struct ConfigurationValue>: public ConfigurationValue> {}; + template struct ConfigurationValue>: public ConfigurationValue> {}; }} #endif diff --git a/src/Magnum/Math/Matrix4.h b/src/Magnum/Math/Matrix4.h index 1c7736b56..46e34b665 100644 --- a/src/Magnum/Math/Matrix4.h +++ b/src/Magnum/Math/Matrix4.h @@ -48,7 +48,7 @@ See @ref matrix-vector and @ref transformations for brief introduction. @ref DualQuaternion, @ref SceneGraph::MatrixTransformation3D @configurationvalueref{Magnum::Math::Matrix4} */ -template class Matrix4: public Matrix<4, T> { +template class Matrix4: public Matrix4x4 { public: /** * @brief 3D translation @@ -187,7 +187,7 @@ template class Matrix4: public Matrix<4, T> { * @see @ref rotationScaling(), translation() const * @todoc Explicit reference when Doxygen can handle const */ - constexpr static Matrix4 from(const Matrix<3, T>& rotationScaling, const Vector3& translation) { + constexpr static Matrix4 from(const Matrix3x3& rotationScaling, const Vector3& translation) { return {{rotationScaling[0], T(0)}, {rotationScaling[1], T(0)}, {rotationScaling[2], T(0)}, @@ -195,7 +195,7 @@ template class Matrix4: public Matrix<4, T> { } /** @copydoc Matrix::Matrix(ZeroType) */ - constexpr explicit Matrix4(typename Matrix<4, T>::ZeroType): Matrix<4, T>(Matrix<4, T>::Zero) {} + constexpr explicit Matrix4(typename Matrix4x4::ZeroType): Matrix4x4(Matrix4x4::Zero) {} /** * @brief Default constructor @@ -204,19 +204,19 @@ template class Matrix4: public Matrix<4, T> { * constructor with `%Matrix4 m(Matrix4::Identity);`. Optional * parameter @p value allows you to specify value on diagonal. */ - constexpr /*implicit*/ Matrix4(typename Matrix<4, T>::IdentityType = (Matrix<4, T>::Identity), T value = T(1)): Matrix<4, T>(Matrix<4, T>::Identity, value) {} + constexpr /*implicit*/ Matrix4(typename Matrix4x4::IdentityType = (Matrix4x4::Identity), T value = T(1)): Matrix4x4(Matrix4x4::Identity, value) {} /** @brief %Matrix from column vectors */ - constexpr /*implicit*/ Matrix4(const Vector4& first, const Vector4& second, const Vector4& third, const Vector4& fourth): Matrix<4, T>(first, second, third, fourth) {} + constexpr /*implicit*/ Matrix4(const Vector4& first, const Vector4& second, const Vector4& third, const Vector4& fourth): Matrix4x4(first, second, third, fourth) {} /** @copydoc Matrix::Matrix(const RectangularMatrix&) */ - template constexpr explicit Matrix4(const RectangularMatrix<4, 4, U>& other): Matrix<4, T>(other) {} + template constexpr explicit Matrix4(const RectangularMatrix<4, 4, U>& other): Matrix4x4(other) {} /** @brief Construct matrix from external representation */ - template::from(std::declval()))> constexpr explicit Matrix4(const U& other): Matrix<4, T>(Implementation::RectangularMatrixConverter<4, 4, T, U>::from(other)) {} + template::from(std::declval()))> constexpr explicit Matrix4(const U& other): Matrix4x4(Implementation::RectangularMatrixConverter<4, 4, T, U>::from(other)) {} /** @brief Copy constructor */ - constexpr Matrix4(const RectangularMatrix<4, 4, T>& other): Matrix<4, T>(other) {} + constexpr Matrix4(const RectangularMatrix<4, 4, T>& other): Matrix4x4(other) {} /** * @brief Check whether the matrix represents rigid transformation @@ -233,14 +233,13 @@ template class Matrix4: public Matrix<4, T> { * @brief 3D rotation and scaling part of the matrix * * Upper-left 3x3 part of the matrix. - * @see @ref from(const Matrix<3, T>&, const Vector3&), + * @see @ref from(const Matrix3x3&, const Vector3&), * rotation() const, @ref rotationNormalized(), * @ref uniformScaling(), @ref rotation(Rad, const Vector3&), * Matrix3::rotationScaling() const * @todoc Explicit reference when Doxygen can handle const */ - /* Not Matrix3, because it is for affine 2D transformations */ - constexpr Matrix<3, T> rotationScaling() const { + constexpr Matrix3x3 rotationScaling() const { return {(*this)[0].xyz(), (*this)[1].xyz(), (*this)[2].xyz()}; @@ -256,8 +255,7 @@ template class Matrix4: public Matrix<4, T> { * @todo assert also orthogonality or this is good enough? * @todoc Explicit reference when Doxygen can handle const */ - /* Not Matrix3, because it is for affine 2D transformations */ - Matrix<3, T> rotationNormalized() const { + Matrix3x3 rotationNormalized() const { CORRADE_ASSERT((*this)[0].xyz().isNormalized() && (*this)[1].xyz().isNormalized() && (*this)[2].xyz().isNormalized(), "Math::Matrix4::rotationNormalized(): the rotation part is not normalized", {}); return {(*this)[0].xyz(), @@ -275,8 +273,7 @@ template class Matrix4: public Matrix<4, T> { * Matrix3::rotation() const * @todoc Explicit reference when Doxygen can handle const */ - /* Not Matrix3, because it is for affine 2D transformations */ - Matrix<3, T> rotation() const; + Matrix3x3 rotation() const; /** * @brief Uniform scaling part of the matrix, squared @@ -338,7 +335,7 @@ template class Matrix4: public Matrix<4, T> { * @brief 3D translation part of the matrix * * First three elements of fourth column. - * @see @ref from(const Matrix<3, T>&, const Vector3&), + * @see @ref from(const Matrix3x3&, const Vector3&), * @ref translation(const Vector3&), * @ref Matrix3::translation() */ @@ -398,7 +395,7 @@ MAGNUM_MATRIXn_OPERATOR_IMPLEMENTATION(4, Matrix4) /** @debugoperator{Magnum::Math::Matrix4} */ template inline Corrade::Utility::Debug operator<<(Corrade::Utility::Debug debug, const Matrix4& value) { - return debug << static_cast&>(value); + return debug << static_cast&>(value); } template Matrix4 Matrix4::rotation(const Rad angle, const Vector3& normalizedAxis) { @@ -466,7 +463,7 @@ template Matrix4 Matrix4::rotationZ(const Rad angle) { template Matrix4 Matrix4::reflection(const Vector3& normal) { CORRADE_ASSERT(normal.isNormalized(), "Math::Matrix4::reflection(): normal must be normalized", {}); - return from(Matrix<3, T>() - T(2)*normal*RectangularMatrix<1, 3, T>(normal).transposed(), {}); + return from(Matrix3x3() - T(2)*normal*RectangularMatrix<1, 3, T>(normal).transposed(), {}); } template Matrix4 Matrix4::orthographicProjection(const Vector2& size, const T near, const T far) { @@ -489,7 +486,7 @@ template Matrix4 Matrix4::perspectiveProjection(const Vector2& { T(0), T(0), T(2)*far*near*zScale, T(0)}}; } -template inline Matrix<3, T> Matrix4::rotation() const { +template inline Matrix3x3 Matrix4::rotation() const { CORRADE_ASSERT(TypeTraits::equals((*this)[0].xyz().dot(), (*this)[1].xyz().dot()) && TypeTraits::equals((*this)[1].xyz().dot(), (*this)[2].xyz().dot()), "Math::Matrix4::rotation(): the matrix doesn't have uniform scaling", {}); @@ -510,7 +507,7 @@ template Matrix4 Matrix4::invertedRigid() const { CORRADE_ASSERT(isRigidTransformation(), "Math::Matrix4::invertedRigid(): the matrix doesn't represent rigid transformation", {}); - Matrix<3, T> inverseRotation = rotationScaling().transposed(); + Matrix3x3 inverseRotation = rotationScaling().transposed(); return from(inverseRotation, inverseRotation*-translation()); } @@ -518,7 +515,7 @@ template Matrix4 Matrix4::invertedRigid() const { namespace Corrade { namespace Utility { /** @configurationvalue{Magnum::Math::Matrix4} */ - template struct ConfigurationValue>: public ConfigurationValue> {}; + template struct ConfigurationValue>: public ConfigurationValue> {}; }} #endif diff --git a/src/Magnum/Math/Quaternion.h b/src/Magnum/Math/Quaternion.h index ef08eb062..00d4d0d18 100644 --- a/src/Magnum/Math/Quaternion.h +++ b/src/Magnum/Math/Quaternion.h @@ -126,7 +126,7 @@ template class Quaternion { * @see @ref toMatrix(), @ref DualComplex::fromMatrix(), * @ref Matrix::isOrthogonal() */ - static Quaternion fromMatrix(const Matrix<3, T>& matrix); + static Quaternion fromMatrix(const Matrix3x3& matrix); /** * @brief Default constructor @@ -210,9 +210,9 @@ template class Quaternion { * @brief Convert quaternion to rotation matrix * * @see @ref fromMatrix(), @ref DualQuaternion::toMatrix(), - * @ref Matrix4::from(const Matrix<3, T>&, const Vector3&) + * @ref Matrix4::from(const Matrix3x3&, const Vector3&) */ - Matrix<3, T> toMatrix() const; + Matrix3x3 toMatrix() const; /** * @brief Add and assign quaternion @@ -474,7 +474,7 @@ namespace Implementation { /* No assertions fired, for internal use. Not private member because used from outside the class. */ -template Quaternion quaternionFromMatrix(const Matrix<3, T>& m) { +template Quaternion quaternionFromMatrix(const Matrix3x3& m) { const Vector<3, T> diagonal = m.diagonal(); const T trace = diagonal.sum(); @@ -530,7 +530,7 @@ template inline Quaternion Quaternion::rotation(const Rad angl return {normalizedAxis*std::sin(T(angle)/2), std::cos(T(angle)/2)}; } -template inline Quaternion Quaternion::fromMatrix(const Matrix<3, T>& matrix) { +template inline Quaternion Quaternion::fromMatrix(const Matrix3x3& matrix) { CORRADE_ASSERT(matrix.isOrthogonal(), "Math::Quaternion::fromMatrix(): the matrix is not orthogonal", {}); return Implementation::quaternionFromMatrix(matrix); } @@ -546,7 +546,7 @@ template inline Vector3 Quaternion::axis() const { return _vector/std::sqrt(1-pow2(_scalar)); } -template Matrix<3, T> Quaternion::toMatrix() const { +template Matrix3x3 Quaternion::toMatrix() const { return { Vector<3, T>(T(1) - 2*pow2(_vector.y()) - 2*pow2(_vector.z()), 2*_vector.x()*_vector.y() + 2*_vector.z()*_scalar, diff --git a/src/Magnum/Math/Test/ComplexTest.cpp b/src/Magnum/Math/Test/ComplexTest.cpp index 52d9d1c62..387d85966 100644 --- a/src/Magnum/Math/Test/ComplexTest.cpp +++ b/src/Magnum/Math/Test/ComplexTest.cpp @@ -101,7 +101,7 @@ typedef Math::Rad Rad; typedef Math::Complex Complex; typedef Math::Vector2 Vector2; typedef Math::Matrix3 Matrix3; -typedef Math::Matrix<2, Float> Matrix2x2; +typedef Math::Matrix2x2 Matrix2x2; void ComplexTest::construct() { constexpr Complex a(0.5f, -3.7f); diff --git a/src/Magnum/Math/Test/Matrix3Test.cpp b/src/Magnum/Math/Test/Matrix3Test.cpp index 2a5c724ff..61274b772 100644 --- a/src/Magnum/Math/Test/Matrix3Test.cpp +++ b/src/Magnum/Math/Test/Matrix3Test.cpp @@ -91,7 +91,7 @@ class Matrix3Test: public Corrade::TestSuite::Tester { typedef Math::Deg Deg; typedef Math::Matrix3 Matrix3; typedef Math::Matrix3 Matrix3i; -typedef Math::Matrix<2, Float> Matrix2x2; +typedef Math::Matrix2x2 Matrix2x2; typedef Math::Vector3 Vector3; typedef Math::Vector2 Vector2; diff --git a/src/Magnum/SceneGraph/AbstractTranslationRotation2D.h b/src/Magnum/SceneGraph/AbstractTranslationRotation2D.h index 8064916d9..bdd8a56bf 100644 --- a/src/Magnum/SceneGraph/AbstractTranslationRotation2D.h +++ b/src/Magnum/SceneGraph/AbstractTranslationRotation2D.h @@ -39,9 +39,8 @@ namespace Magnum { namespace SceneGraph { @see @ref AbstractTranslationRotation2D, @ref scenegraph, @ref AbstractBasicTranslationRotation3D, @ref BasicRigidMatrixTransformation2D, @ref BasicDualComplexTransformation -@todo Use AbstractBasicTransformation2D when support for GCC 4.6 is dropped */ -template class AbstractBasicTranslationRotation2D: public AbstractTranslation<2, T> { +template class AbstractBasicTranslationRotation2D: public AbstractBasicTranslation2D { public: explicit AbstractBasicTranslationRotation2D() = default; @@ -59,7 +58,7 @@ template class AbstractBasicTranslationRotation2D: public AbstractTrans /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT AbstractBasicTranslationRotation2D& resetTransformation() { - AbstractTransformation<2, T>::resetTransformation(); + AbstractBasicTranslation2D::resetTransformation(); return *this; } #endif diff --git a/src/Magnum/SceneGraph/AbstractTranslationRotation3D.h b/src/Magnum/SceneGraph/AbstractTranslationRotation3D.h index 58afc7e47..5a59e1b06 100644 --- a/src/Magnum/SceneGraph/AbstractTranslationRotation3D.h +++ b/src/Magnum/SceneGraph/AbstractTranslationRotation3D.h @@ -40,9 +40,8 @@ namespace Magnum { namespace SceneGraph { @ref AbstractBasicTranslationRotation2D, @ref BasicRigidMatrixTransformation3D, @ref BasicDualQuaternionTransformation -@todo Use AbstractBasicTransformation3D when support for GCC 4.6 is dropped */ -template class AbstractBasicTranslationRotation3D: public AbstractTranslation<3, T> { +template class AbstractBasicTranslationRotation3D: public AbstractBasicTranslation3D { public: explicit AbstractBasicTranslationRotation3D() = default; @@ -110,7 +109,7 @@ template class AbstractBasicTranslationRotation3D: public AbstractTrans /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT AbstractBasicTranslationRotation3D& resetTransformation() { - AbstractTransformation<3, T>::resetTransformation(); + AbstractBasicTranslation3D::resetTransformation(); return *this; } #endif diff --git a/src/Magnum/SceneGraph/Camera2D.h b/src/Magnum/SceneGraph/Camera2D.h index 8b26d3e75..2706d403a 100644 --- a/src/Magnum/SceneGraph/Camera2D.h +++ b/src/Magnum/SceneGraph/Camera2D.h @@ -58,7 +58,7 @@ class documentation or @ref compilation-speedup-hpp for more information. @see @ref scenegraph, @ref Camera2D, @ref BasicCamera3D, @ref Drawable, @ref DrawableGroup */ -template class BasicCamera2D: public AbstractCamera<2, T> { +template class BasicCamera2D: public AbstractBasicCamera2D { public: /** * @brief Constructor @@ -67,13 +67,13 @@ template class BasicCamera2D: public AbstractCamera<2, T> { * Sets orthographic projection to the default OpenGL cube (range @f$ [-1; 1] @f$ in all directions). * @see @ref setProjection() */ - explicit BasicCamera2D(AbstractObject<2, T>& object); + explicit BasicCamera2D(AbstractBasicObject2D& object); #ifndef DOXYGEN_GENERATING_OUTPUT /* This is here to avoid ambiguity with deleted copy constructor when passing `*this` from class subclassing both BasicCamera2D and AbstractObject */ - template, U>::value>::type> BasicCamera2D(U& object): BasicCamera2D(static_cast&>(object)) {} + template, U>::value>::type> BasicCamera2D(U& object): BasicCamera2D(static_cast&>(object)) {} #endif /** @@ -88,7 +88,7 @@ template class BasicCamera2D: public AbstractCamera<2, T> { /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT BasicCamera2D& setAspectRatioPolicy(AspectRatioPolicy policy) { - AbstractCamera<2, T>::setAspectRatioPolicy(policy); + AbstractBasicCamera2D::setAspectRatioPolicy(policy); return *this; } #endif diff --git a/src/Magnum/SceneGraph/Camera2D.hpp b/src/Magnum/SceneGraph/Camera2D.hpp index c399c0964..d4a91d688 100644 --- a/src/Magnum/SceneGraph/Camera2D.hpp +++ b/src/Magnum/SceneGraph/Camera2D.hpp @@ -32,16 +32,14 @@ #include "Magnum/SceneGraph/AbstractCamera.hpp" #include "Magnum/SceneGraph/Camera2D.h" -/** @todo Use AbstractBasicCamera2D when support for GCC 4.6 is dropped (also in header) */ - namespace Magnum { namespace SceneGraph { -template BasicCamera2D::BasicCamera2D(AbstractObject<2, T>& object): AbstractCamera<2, T>(object) {} +template BasicCamera2D::BasicCamera2D(AbstractBasicObject2D& object): AbstractBasicCamera2D(object) {} template BasicCamera2D& BasicCamera2D::setProjection(const Math::Vector2& size) { - AbstractCamera<2, T>::rawProjectionMatrix = Math::Matrix3::projection(size); + AbstractBasicCamera2D::rawProjectionMatrix = Math::Matrix3::projection(size); - AbstractCamera<2, T>::fixAspectRatio(); + AbstractBasicCamera2D::fixAspectRatio(); return *this; } diff --git a/src/Magnum/SceneGraph/Camera3D.h b/src/Magnum/SceneGraph/Camera3D.h index 0c2511d83..a90507241 100644 --- a/src/Magnum/SceneGraph/Camera3D.h +++ b/src/Magnum/SceneGraph/Camera3D.h @@ -63,19 +63,19 @@ class documentation or @ref compilation-speedup-hpp for more information. @see @ref scenegraph, @ref Camera3D, @ref BasicCamera2D, @ref Drawable, @ref DrawableGroup */ -template class BasicCamera3D: public AbstractCamera<3, T> { +template class BasicCamera3D: public AbstractBasicCamera3D { public: /** * @brief Constructor * @param object %Object holding this feature */ - explicit BasicCamera3D(AbstractObject<3, T>& object); + explicit BasicCamera3D(AbstractBasicObject3D& object); #ifndef DOXYGEN_GENERATING_OUTPUT /* This is here to avoid ambiguity with deleted copy constructor when passing `*this` from class subclassing both BasicCamera3D and AbstractObject */ - template, U>::value>::type> BasicCamera3D(U& object): BasicCamera3D(static_cast&>(object)) {} + template, U>::value>::type> BasicCamera3D(U& object): BasicCamera3D(static_cast&>(object)) {} #endif /** @@ -121,7 +121,7 @@ template class BasicCamera3D: public AbstractCamera<3, T> { /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT BasicCamera3D& setAspectRatioPolicy(AspectRatioPolicy policy) { - AbstractCamera<3, T>::setAspectRatioPolicy(policy); + AbstractBasicCamera3D::setAspectRatioPolicy(policy); return *this; } #endif diff --git a/src/Magnum/SceneGraph/Camera3D.hpp b/src/Magnum/SceneGraph/Camera3D.hpp index d4a385104..72887f260 100644 --- a/src/Magnum/SceneGraph/Camera3D.hpp +++ b/src/Magnum/SceneGraph/Camera3D.hpp @@ -32,19 +32,17 @@ #include "Magnum/SceneGraph/AbstractCamera.hpp" #include "Magnum/SceneGraph/Camera3D.h" -/** @todo Use AbstractBasicCamera3D when support for GCC 4.6 is dropped (also in header) */ - namespace Magnum { namespace SceneGraph { -template BasicCamera3D::BasicCamera3D(AbstractObject<3, T>& object): AbstractCamera<3, T>(object), _near(T(0)), _far(T(0)) {} +template BasicCamera3D::BasicCamera3D(AbstractBasicObject3D& object): AbstractBasicCamera3D(object), _near(T(0)), _far(T(0)) {} template BasicCamera3D& BasicCamera3D::setOrthographic(const Math::Vector2& size, T near, T far) { /** @todo Get near/far from the matrix */ _near = near; _far = far; - AbstractCamera<3, T>::rawProjectionMatrix = Math::Matrix4::orthographicProjection(size, near, far); - AbstractCamera<3, T>::fixAspectRatio(); + AbstractBasicCamera3D::rawProjectionMatrix = Math::Matrix4::orthographicProjection(size, near, far); + AbstractBasicCamera3D::fixAspectRatio(); return *this; } @@ -53,8 +51,8 @@ template BasicCamera3D& BasicCamera3D::setPerspective(const Math: _near = near; _far = far; - AbstractCamera<3, T>::rawProjectionMatrix = Math::Matrix4::perspectiveProjection(size, near, far); - AbstractCamera<3, T>::fixAspectRatio(); + AbstractBasicCamera3D::rawProjectionMatrix = Math::Matrix4::perspectiveProjection(size, near, far); + AbstractBasicCamera3D::fixAspectRatio(); return *this; } @@ -63,8 +61,8 @@ template BasicCamera3D& BasicCamera3D::setPerspective(Math::Rad::rawProjectionMatrix = Math::Matrix4::perspectiveProjection(fov, aspectRatio, near, far); - AbstractCamera<3, T>::fixAspectRatio(); + AbstractBasicCamera3D::rawProjectionMatrix = Math::Matrix4::perspectiveProjection(fov, aspectRatio, near, far); + AbstractBasicCamera3D::fixAspectRatio(); return *this; } diff --git a/src/Magnum/SceneGraph/Test/TranslationTransformationTest.cpp b/src/Magnum/SceneGraph/Test/TranslationTransformationTest.cpp index 4fec5fbe2..49cf7a945 100644 --- a/src/Magnum/SceneGraph/Test/TranslationTransformationTest.cpp +++ b/src/Magnum/SceneGraph/Test/TranslationTransformationTest.cpp @@ -133,7 +133,7 @@ void TranslationTransformationTest::translate() { } void TranslationTransformationTest::integral() { - typedef Object> Object2Di; + typedef Object> Object2Di; Object2Di o; o.translate({3, -7});