From 346ea2feb699876ee18d00655d8732b52ea30be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 3 Jul 2013 17:39:54 +0200 Subject: [PATCH] Getting rid of <>, part 6: SceneGraph transformations. --- src/SceneGraph/AbstractTransformation.h | 50 ++++--------- .../AbstractTranslationRotation2D.h | 30 ++++---- .../AbstractTranslationRotation3D.h | 36 ++++----- .../AbstractTranslationRotationScaling2D.h | 36 ++++----- .../AbstractTranslationRotationScaling3D.h | 46 ++++++------ src/SceneGraph/DualComplexTransformation.h | 58 +++++++------- src/SceneGraph/DualQuaternionTransformation.h | 58 +++++++------- src/SceneGraph/MatrixTransformation2D.h | 53 +++++++------ src/SceneGraph/MatrixTransformation3D.h | 64 ++++++++-------- src/SceneGraph/Object.hpp | 4 +- src/SceneGraph/RigidMatrixTransformation2D.h | 63 ++++++++-------- src/SceneGraph/RigidMatrixTransformation3D.h | 75 ++++++++++--------- src/SceneGraph/SceneGraph.h | 39 ++++++---- src/SceneGraph/Test/AnimableTest.cpp | 2 +- src/SceneGraph/Test/CameraTest.cpp | 6 +- .../Test/DualComplexTransformationTest.cpp | 12 +-- .../Test/DualQuaternionTransformationTest.cpp | 12 +-- .../Test/MatrixTransformation2DTest.cpp | 12 +-- .../Test/MatrixTransformation3DTest.cpp | 12 +-- src/SceneGraph/Test/ObjectTest.cpp | 4 +- .../Test/RigidMatrixTransformation2DTest.cpp | 14 ++-- .../Test/RigidMatrixTransformation3DTest.cpp | 14 ++-- src/SceneGraph/Test/SceneTest.cpp | 4 +- src/SceneGraph/instantiation.cpp | 16 ++-- src/Shapes/Test/ShapeTest.cpp | 8 +- 25 files changed, 362 insertions(+), 366 deletions(-) diff --git a/src/SceneGraph/AbstractTransformation.h b/src/SceneGraph/AbstractTransformation.h index 5f828a7a1..95dfbbeff 100644 --- a/src/SceneGraph/AbstractTransformation.h +++ b/src/SceneGraph/AbstractTransformation.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::AbstractTransformation, enum Magnum::SceneGraph::TransformationType, alias Magnum::SceneGraph::AbstractTransformation2D, Magnum::SceneGraph::AbstractTransformation3D + * @brief Class Magnum::SceneGraph::AbstractBasicTransformation, enum Magnum::SceneGraph::TransformationType, typedef Magnum::SceneGraph::AbstractTransformation2D, Magnum::SceneGraph::AbstractTransformation3D */ #include @@ -50,14 +50,10 @@ When subclassing, you have to: - Implement all members listed in **Subclass implementation** group above - Provide implicit (parameterless) constructor -@see @ref scenegraph, AbstractTransformation2D, AbstractTransformation3D +@see @ref AbstractTransformation2D, @ref AbstractTransformation3D, + @ref scenegraph */ -#ifndef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -class MAGNUM_SCENEGRAPH_EXPORT AbstractTransformation { +template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicTransformation { public: /** @brief Underlying floating-point type */ typedef T Type; @@ -65,8 +61,8 @@ class MAGNUM_SCENEGRAPH_EXPORT AbstractTransformation { /** @brief Dimension count */ static const UnsignedInt Dimensions = dimensions; - explicit AbstractTransformation(); - virtual ~AbstractTransformation() = 0; + explicit AbstractBasicTransformation(); + virtual ~AbstractBasicTransformation() = 0; #ifdef DOXYGEN_GENERATING_OUTPUT /** @@ -142,7 +138,7 @@ class MAGNUM_SCENEGRAPH_EXPORT AbstractTransformation { * @brief Reset object transformation * @return Pointer to self (for method chaining) */ - AbstractTransformation* resetTransformation() { + AbstractBasicTransformation* resetTransformation() { doResetTransformation(); return this; } @@ -165,39 +161,19 @@ enum class TransformationType: UnsignedByte { Local = 0x01 }; -#ifndef CORRADE_GCC46_COMPATIBILITY /** -@brief Base for two-dimensional transformations +@brief Base transformation for two-dimensional float scenes -Convenience alternative to %AbstractTransformation<2, T>. See -AbstractTransformation for more information. -@note Not available on GCC < 4.7. Use %AbstractTransformation<2, T> - instead. -@see AbstractTransformation3D +@see @ref AbstractTransformation3D */ -#ifdef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -using AbstractTransformation2D = AbstractTransformation<2, T>; +typedef AbstractBasicTransformation<2, Float> AbstractTransformation2D; /** -@brief Base for three-dimensional transformations +@brief Base transformation for three-dimensional float scenes -Convenience alternative to %AbstractTransformation<3, T>. See -AbstractTransformation for more information. -@note Not available on GCC < 4.7. Use %AbstractTransformation<3, T> - instead. -@see AbstractTransformation2D +@see @ref AbstractTransformation2D */ -#ifdef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -using AbstractTransformation3D = AbstractTransformation<3, T>; -#endif +typedef AbstractBasicTransformation<3, Float> AbstractTransformation3D; }} diff --git a/src/SceneGraph/AbstractTranslationRotation2D.h b/src/SceneGraph/AbstractTranslationRotation2D.h index 1d1e48560..995cb6c60 100644 --- a/src/SceneGraph/AbstractTranslationRotation2D.h +++ b/src/SceneGraph/AbstractTranslationRotation2D.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::AbstractTranslationRotation2D + * @brief Class Magnum::SceneGraph::AbstractBasicTranslationRotation2D, typedef Magnum::SceneGraph::AbstractTranslationRotation2D */ #include "AbstractTransformation.h" @@ -33,18 +33,13 @@ namespace Magnum { namespace SceneGraph { /** -@brief Base for two-dimensional transformations supporting translation and rotation +@brief Base translation for two-dimensional scenes supporting translation and rotation -@see @ref scenegraph, AbstractTranslationRotation3D +@see @ref AbstractTranslationRotation2D, @ref scenegraph, @ref AbstractBasicTranslationRotation3D */ -#ifndef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -class AbstractTranslationRotation2D: public AbstractTransformation<2, T> { +template class AbstractBasicTranslationRotation2D: public AbstractBasicTransformation<2, T> { public: - explicit AbstractTranslationRotation2D() = default; + explicit AbstractBasicTranslationRotation2D() = default; /** * @brief Translate object @@ -54,7 +49,7 @@ class AbstractTranslationRotation2D: public AbstractTransformation<2, T> { * * @see Vector2::xAxis(), Vector2::yAxis() */ - AbstractTranslationRotation2D* translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation2D* translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { doTranslate(vector, type); return this; } @@ -65,15 +60,15 @@ class AbstractTranslationRotation2D: public AbstractTransformation<2, T> { * @param type Transformation type * @return Pointer to self (for method chaining) */ - AbstractTranslationRotation2D* rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation2D* rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { doRotate(angle, type); return this; } /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT - AbstractTranslationRotation2D* resetTransformation() { - AbstractTransformation<2, T>::resetTransformation(); + AbstractBasicTranslationRotation2D* resetTransformation() { + AbstractBasicTransformation<2, T>::resetTransformation(); return this; } #endif @@ -90,6 +85,13 @@ class AbstractTranslationRotation2D: public AbstractTransformation<2, T> { virtual void doRotate(Math::Rad angle, TransformationType type) = 0; }; +/** +@brief Base transformation for two-dimensional float scenes supporting translation and rotation + +@see @ref AbstractTranslationRotation3D +*/ +typedef AbstractBasicTranslationRotation2D AbstractTranslationRotation2D; + }} #endif diff --git a/src/SceneGraph/AbstractTranslationRotation3D.h b/src/SceneGraph/AbstractTranslationRotation3D.h index fd132c250..d26e34cbc 100644 --- a/src/SceneGraph/AbstractTranslationRotation3D.h +++ b/src/SceneGraph/AbstractTranslationRotation3D.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::AbstractTranslationRotation3D + * @brief Class Magnum::SceneGraph::AbstractBasicTranslationRotation3D, typedef Magnum::SceneGraph::AbstractTranslationRotation3D */ #include "AbstractTransformation.h" @@ -34,18 +34,13 @@ namespace Magnum { namespace SceneGraph { /** -@brief Base for three-dimensional transformations supporting translation and rotation +@brief Base translation for three-dimensional scenes supporting translation and rotation -@see @ref scenegraph, AbstractTranslationRotation2D +@see @ref AbstractTranslationRotation3D @ref scenegraph, @ref AbstractBasicTranslationRotation2D */ -#ifndef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -class AbstractTranslationRotation3D: public AbstractTransformation<3, T> { +template class AbstractBasicTranslationRotation3D: public AbstractBasicTransformation<3, T> { public: - explicit AbstractTranslationRotation3D() = default; + explicit AbstractBasicTranslationRotation3D() = default; /** * @brief Translate object @@ -55,7 +50,7 @@ class AbstractTranslationRotation3D: public AbstractTransformation<3, T> { * * @see Vector3::xAxis(), Vector3::yAxis(), Vector3::zAxis() */ - AbstractTranslationRotation3D* translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation3D* translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { doTranslate(vector, type); return this; } @@ -70,7 +65,7 @@ class AbstractTranslationRotation3D: public AbstractTransformation<3, T> { * @see rotateX(), rotateY(), rotateZ(), Vector3::xAxis(), * Vector3::yAxis(), Vector3::zAxis() */ - AbstractTranslationRotation3D* rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation3D* rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { doRotate(angle, normalizedAxis, type); return this; } @@ -84,7 +79,7 @@ class AbstractTranslationRotation3D: public AbstractTransformation<3, T> { * In some implementations faster than calling * `rotate(angle, Vector3::xAxis())`. */ - AbstractTranslationRotation3D* rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation3D* rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { doRotateX(angle, type); return this; } @@ -98,7 +93,7 @@ class AbstractTranslationRotation3D: public AbstractTransformation<3, T> { * In some implementations faster than calling * `rotate(angle, Vector3::yAxis())`. */ - AbstractTranslationRotation3D* rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation3D* rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { doRotateX(angle, type); return this; } @@ -112,15 +107,15 @@ class AbstractTranslationRotation3D: public AbstractTransformation<3, T> { * In some implementations faster than calling * `rotate(angle, Vector3::zAxis())`. */ - AbstractTranslationRotation3D* rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation3D* rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { doRotateZ(angle, type); return this; } /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT - AbstractTranslationRotation3D* resetTransformation() { - AbstractTransformation<3, T>::resetTransformation(); + AbstractBasicTranslationRotation3D* resetTransformation() { + AbstractBasicTransformation<3, T>::resetTransformation(); return this; } #endif @@ -164,6 +159,13 @@ class AbstractTranslationRotation3D: public AbstractTransformation<3, T> { } }; +/** +@brief Base transformation for three-dimensional float scenes supporting translation and rotation + +@see @ref AbstractTranslationRotation2D +*/ +typedef AbstractBasicTranslationRotation3D AbstractTranslationRotation3D; + }} #endif diff --git a/src/SceneGraph/AbstractTranslationRotationScaling2D.h b/src/SceneGraph/AbstractTranslationRotationScaling2D.h index 5f2f5cc40..5be4b55ec 100644 --- a/src/SceneGraph/AbstractTranslationRotationScaling2D.h +++ b/src/SceneGraph/AbstractTranslationRotationScaling2D.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::AbstractTranslationRotationScaling2D + * @brief Class Magnum::SceneGraph::AbstractBasicTranslationRotationScaling2D, typedef Magnum::SceneGraph::AbstractTranslationRotationScaling2D */ #include "AbstractTranslationRotation2D.h" @@ -33,18 +33,13 @@ namespace Magnum { namespace SceneGraph { /** -@brief Base for two-dimensional transformations supporting translation, rotation and scaling +@brief Base transformation for two-dimensional scenes supporting translation, rotation and scaling -@see @ref scenegraph, AbstractTranslationRotationScaling2D +@see @ref AbstractTranslationRotationScaling2D, @ref scenegraph, @ref AbstractBasicTranslationRotationScaling2D */ -#ifndef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -class AbstractTranslationRotationScaling2D: public AbstractTranslationRotation2D { +template class AbstractBasicTranslationRotationScaling2D: public AbstractBasicTranslationRotation2D { public: - explicit AbstractTranslationRotationScaling2D() = default; + explicit AbstractBasicTranslationRotationScaling2D() = default; /** * @brief Scale object @@ -54,23 +49,23 @@ class AbstractTranslationRotationScaling2D: public AbstractTranslationRotation2D * * @see Vector2::xScale(), Vector2::yScale() */ - AbstractTranslationRotationScaling2D* scale(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotationScaling2D* scale(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { doScale(vector, type); return this; } /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT - AbstractTranslationRotationScaling2D* resetTransformation() { - AbstractTranslationRotation2D::resetTransformation(); + AbstractBasicTranslationRotationScaling2D* resetTransformation() { + AbstractBasicTranslationRotation2D::resetTransformation(); return this; } - AbstractTranslationRotationScaling2D* translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { - AbstractTranslationRotation2D::translate(vector, type); + AbstractBasicTranslationRotationScaling2D* translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation2D::translate(vector, type); return this; } - AbstractTranslationRotationScaling2D* rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { - AbstractTranslationRotation2D::rotate(angle, type); + AbstractBasicTranslationRotationScaling2D* rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation2D::rotate(angle, type); return this; } #endif @@ -84,6 +79,13 @@ class AbstractTranslationRotationScaling2D: public AbstractTranslationRotation2D virtual void doScale(const Math::Vector2& vector, TransformationType type) = 0; }; +/** +@brief Base transformation for two-dimensional float scenes supporting translation, rotation and scaling + +@see @ref AbstractTranslationRotationScaling3D +*/ +typedef AbstractBasicTranslationRotationScaling2D AbstractTranslationRotationScaling2D; + }} #endif diff --git a/src/SceneGraph/AbstractTranslationRotationScaling3D.h b/src/SceneGraph/AbstractTranslationRotationScaling3D.h index 2852632c4..c9164190f 100644 --- a/src/SceneGraph/AbstractTranslationRotationScaling3D.h +++ b/src/SceneGraph/AbstractTranslationRotationScaling3D.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::AbstractTranslationRotationScaling3D + * @brief Class Magnum::SceneGraph::AbstractBasicTranslationRotationScaling3D, typedef Magnum::SceneGraph::AbstractTranslationRotationScaling3D */ #include "AbstractTranslationRotation3D.h" @@ -35,16 +35,11 @@ namespace Magnum { namespace SceneGraph { /** @brief Base for three-dimensional transformations supporting translation, rotation and scaling -@see @ref scenegraph, AbstractTranslationRotationScaling2D +@see @ref AbstractTranslationRotationScaling3D, @ref scenegraph, @ref AbstractBasicTranslationRotationScaling2D */ -#ifndef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -class AbstractTranslationRotationScaling3D: public AbstractTranslationRotation3D { +template class AbstractBasicTranslationRotationScaling3D: public AbstractBasicTranslationRotation3D { public: - explicit AbstractTranslationRotationScaling3D() = default; + explicit AbstractBasicTranslationRotationScaling3D() = default; /** * @brief Scale object @@ -54,35 +49,35 @@ class AbstractTranslationRotationScaling3D: public AbstractTranslationRotation3D * * @see Vector3::xScale(), Vector3::yScale(), Vector3::zScale() */ - AbstractTranslationRotationScaling3D* scale(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotationScaling3D* scale(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { doScale(vector, type); return this; } /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT - AbstractTranslationRotationScaling3D* resetTransformation() { - AbstractTranslationRotation3D::resetTransformation(); + AbstractBasicTranslationRotationScaling3D* resetTransformation() { + AbstractBasicTranslationRotation3D::resetTransformation(); return this; } - AbstractTranslationRotationScaling3D* translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { - AbstractTranslationRotation3D::translate(vector, type); + AbstractBasicTranslationRotationScaling3D* translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation3D::translate(vector, type); return this; } - AbstractTranslationRotationScaling3D* rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { - AbstractTranslationRotation3D::rotate(angle, normalizedAxis, type); + AbstractBasicTranslationRotationScaling3D* rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation3D::rotate(angle, normalizedAxis, type); return this; } - AbstractTranslationRotationScaling3D* rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { - AbstractTranslationRotation3D::rotateX(angle, type); + AbstractBasicTranslationRotationScaling3D* rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation3D::rotateX(angle, type); return this; } - AbstractTranslationRotationScaling3D* rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { - AbstractTranslationRotation3D::rotateY(angle, type); + AbstractBasicTranslationRotationScaling3D* rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation3D::rotateY(angle, type); return this; } - AbstractTranslationRotationScaling3D* rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { - AbstractTranslationRotation3D::rotateZ(angle, type); + AbstractBasicTranslationRotationScaling3D* rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation3D::rotateZ(angle, type); return this; } #endif @@ -96,6 +91,13 @@ class AbstractTranslationRotationScaling3D: public AbstractTranslationRotation3D virtual void doScale(const Math::Vector3& vector, TransformationType type) = 0; }; +/** +@brief Base transformation for three-dimensional float scenes supporting translation, rotation and scaling + +@see @ref AbstractTranslationRotationScaling2D +*/ +typedef AbstractBasicTranslationRotationScaling3D AbstractTranslationRotationScaling3D; + }} #endif diff --git a/src/SceneGraph/DualComplexTransformation.h b/src/SceneGraph/DualComplexTransformation.h index 8cd00b8ff..67cc7e07c 100644 --- a/src/SceneGraph/DualComplexTransformation.h +++ b/src/SceneGraph/DualComplexTransformation.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::DualComplexTransformation + * @brief Class Magnum::SceneGraph::BasicDualComplexTransformation, typedef Magnum::SceneGraph::DualComplexTransformation */ #include "Math/DualComplex.h" @@ -39,14 +39,9 @@ namespace Magnum { namespace SceneGraph { This class allows only rigid transformation (i.e. only rotation and translation). -@see @ref scenegraph, Math::DualComplex, DualQuaternionTransformation +@see @ref DualComplexTransformation, @ref scenegraph, Math::DualComplex, @ref BasicDualQuaternionTransformation */ -#ifndef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -class DualComplexTransformation: public AbstractTranslationRotation2D { +template class BasicDualComplexTransformation: public AbstractBasicTranslationRotation2D { public: /** @brief Transformation type */ typedef Math::DualComplex DataType; @@ -81,9 +76,9 @@ class DualComplexTransformation: public AbstractTranslationRotation2D { * the object subsequently. * @see DualComplex::normalized() */ - Object>* normalizeRotation() { + Object>* normalizeRotation() { setTransformationInternal(_transformation.normalized()); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -93,18 +88,18 @@ class DualComplexTransformation: public AbstractTranslationRotation2D { * Expects that the dual complex number is normalized. * @see DualComplex::isNormalized() */ - Object>* setTransformation(const Math::DualComplex& transformation) { + Object>* setTransformation(const Math::DualComplex& transformation) { CORRADE_ASSERT(transformation.isNormalized(), "SceneGraph::DualComplexTransformation::setTransformation(): the dual complex number is not normalized", - static_cast>*>(this)); + static_cast>*>(this)); setTransformationInternal(transformation); - return static_cast>*>(this); + return static_cast>*>(this); } /** @copydoc AbstractTranslationRotationScaling2D::resetTransformation() */ - Object>* resetTransformation() { + Object>* resetTransformation() { setTransformationInternal({}); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -116,21 +111,21 @@ class DualComplexTransformation: public AbstractTranslationRotation2D { * Expects that the dual complex number is normalized. * @see DualComplex::isNormalized() */ - Object>* transform(const Math::DualComplex& transformation, TransformationType type = TransformationType::Global) { + Object>* transform(const Math::DualComplex& transformation, TransformationType type = TransformationType::Global) { CORRADE_ASSERT(transformation.isNormalized(), "SceneGraph::DualComplexTransformation::transform(): the dual complex number is not normalized", - static_cast>*>(this)); + static_cast>*>(this)); transformInternal(transformation, type); - return static_cast>*>(this); + return static_cast>*>(this); } /** * @copydoc AbstractTranslationRotationScaling2D::translate() * Same as calling transform() with DualComplex::translation(). */ - Object>* translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { + Object>* translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { transformInternal(Math::DualComplex::translation(vector), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -142,9 +137,9 @@ class DualComplexTransformation: public AbstractTranslationRotation2D { * Same as calling transform() with DualComplex::rotation(). * @see normalizeRotation() */ - Object>* rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>* rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { transformInternal(Math::DualComplex::rotation(angle), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -153,14 +148,14 @@ class DualComplexTransformation: public AbstractTranslationRotation2D { * if you want to move it above all. * @return Pointer to self (for method chaining) */ - Object>* move(Object>* under) { - static_cast*>(this)->Containers::template LinkedList>>::move(this, under); - return static_cast>*>(this); + Object>* move(Object>* under) { + static_cast*>(this)->Containers::template LinkedList>>::move(this, under); + return static_cast>*>(this); } protected: /* Allow construction only from Object */ - explicit DualComplexTransformation() = default; + explicit BasicDualComplexTransformation() = default; private: void doResetTransformation() override final { resetTransformation(); } @@ -178,9 +173,9 @@ class DualComplexTransformation: public AbstractTranslationRotation2D { /* Setting transformation is forbidden for the scene */ /** @todo Assert for this? */ /** @todo Do this in some common code so we don't need to include Object? */ - if(!static_cast>*>(this)->isScene()) { + if(!static_cast>*>(this)->isScene()) { _transformation = transformation; - static_cast>*>(this)->setDirty(); + static_cast>*>(this)->setDirty(); } } @@ -193,6 +188,13 @@ class DualComplexTransformation: public AbstractTranslationRotation2D { Math::DualComplex _transformation; }; +/** +@brief Two-dimensional transformation for float scenes implemented using dual complex numbers + +@see @ref DualQuaternionTransformation +*/ +typedef BasicDualComplexTransformation DualComplexTransformation; + }} #endif diff --git a/src/SceneGraph/DualQuaternionTransformation.h b/src/SceneGraph/DualQuaternionTransformation.h index 03d3e59b9..0fe666b5d 100644 --- a/src/SceneGraph/DualQuaternionTransformation.h +++ b/src/SceneGraph/DualQuaternionTransformation.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::DualQuaternionTransformation + * @brief Class Magnum::SceneGraph::BasicDualQuaternionTransformation, typedef Magnum::SceneGraph::DualQuaternionTransformation */ #include "Math/DualQuaternion.h" @@ -39,14 +39,9 @@ namespace Magnum { namespace SceneGraph { This class allows only rigid transformation (i.e. only rotation and translation). -@see @ref scenegraph, Math::DualQuaternion, DualComplexTransformation +@see @ref DualQuaternionTransformation @ref scenegraph, Math::DualQuaternion, @ref BasicDualComplexTransformation */ -#ifndef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -class DualQuaternionTransformation: public AbstractTranslationRotation3D { +template class BasicDualQuaternionTransformation: public AbstractBasicTranslationRotation3D { public: /** @brief Underlying transformation type */ typedef Math::DualQuaternion DataType; @@ -83,9 +78,9 @@ class DualQuaternionTransformation: public AbstractTranslationRotation3D { * the object subsequently. * @see DualQuaternion::normalized() */ - Object>* normalizeRotation() { + Object>* normalizeRotation() { setTransformation(_transformation.normalized()); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -95,18 +90,18 @@ class DualQuaternionTransformation: public AbstractTranslationRotation3D { * Expects that the dual quaternion is normalized. * @see DualQuaternion::isNormalized() */ - Object>* setTransformation(const Math::DualQuaternion& transformation) { + Object>* setTransformation(const Math::DualQuaternion& transformation) { CORRADE_ASSERT(transformation.isNormalized(), "SceneGraph::DualQuaternionTransformation::setTransformation(): the dual quaternion is not normalized", - static_cast>*>(this)); + static_cast>*>(this)); setTransformationInternal(transformation); - return static_cast>*>(this); + return static_cast>*>(this); } /** @copydoc AbstractTranslationRotationScaling3D::resetTransformation() */ - Object>* resetTransformation() { + Object>* resetTransformation() { setTransformation({}); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -118,21 +113,21 @@ class DualQuaternionTransformation: public AbstractTranslationRotation3D { * Expects that the dual quaternion is normalized. * @see DualQuaternion::isNormalized() */ - Object>* transform(const Math::DualQuaternion& transformation, TransformationType type = TransformationType::Global) { + Object>* transform(const Math::DualQuaternion& transformation, TransformationType type = TransformationType::Global) { CORRADE_ASSERT(transformation.isNormalized(), "SceneGraph::DualQuaternionTransformation::transform(): the dual quaternion is not normalized", - static_cast>*>(this)); + static_cast>*>(this)); transformInternal(transformation, type); - return static_cast>*>(this); + return static_cast>*>(this); } /** * @copydoc AbstractTranslationRotationScaling3D::translate() * Same as calling transform() with DualQuaternion::translation(). */ - Object>* translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { + Object>* translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { transformInternal(Math::DualQuaternion::translation(vector), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -146,27 +141,27 @@ class DualQuaternionTransformation: public AbstractTranslationRotation3D { * @see Vector3::xAxis(), Vector3::yAxis(), Vector3::zAxis(), * normalizeRotation() */ - Object>* rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { + Object>* rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { transformInternal(Math::DualQuaternion::rotation(angle, normalizedAxis), type); - return static_cast>*>(this); + return static_cast>*>(this); } /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT - Object>* rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>* rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { return rotate(angle, Math::Vector3::xAxis(), type); } - Object>* rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>* rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { return rotate(angle, Math::Vector3::yAxis(), type); } - Object>* rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>* rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { return rotate(angle, Math::Vector3::zAxis(), type); } #endif protected: /* Allow construction only from Object */ - explicit DualQuaternionTransformation() = default; + explicit BasicDualQuaternionTransformation() = default; private: void doResetTransformation() override final { resetTransformation(); } @@ -184,9 +179,9 @@ class DualQuaternionTransformation: public AbstractTranslationRotation3D { /* Setting transformation is forbidden for the scene */ /** @todo Assert for this? */ /** @todo Do this in some common code so we don't need to include Object? */ - if(!static_cast>*>(this)->isScene()) { + if(!static_cast>*>(this)->isScene()) { _transformation = transformation; - static_cast>*>(this)->setDirty(); + static_cast>*>(this)->setDirty(); } } @@ -199,6 +194,13 @@ class DualQuaternionTransformation: public AbstractTranslationRotation3D { Math::DualQuaternion _transformation; }; +/** +@brief Three-dimensional transformation for float scenes implemented using dual quaternions + +@see @ref DualComplexTransformation +*/ +typedef BasicDualQuaternionTransformation DualQuaternionTransformation; + }} #endif diff --git a/src/SceneGraph/MatrixTransformation2D.h b/src/SceneGraph/MatrixTransformation2D.h index 4f82dab87..530aef688 100644 --- a/src/SceneGraph/MatrixTransformation2D.h +++ b/src/SceneGraph/MatrixTransformation2D.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::MatrixTransformation2D + * @brief Class Magnum::SceneGraph::BasicMatrixTransformation2D, typedef Magnum::SceneGraph::MatrixTransformation2D */ #include "Math/Matrix3.h" @@ -38,14 +38,9 @@ namespace Magnum { namespace SceneGraph { @brief Two-dimensional transformation implemented using matrices Uses Math::Matrix3 as underlying type. -@see @ref scenegraph, RigidMatrixTransformation2D, MatrixTransformation3D +@see @ref MatrixTransformation2D, @ref scenegraph, @ref RigidBasicMatrixTransformation2D, @ref BasicMatrixTransformation3D */ -#ifndef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -class MatrixTransformation2D: public AbstractTranslationRotationScaling2D { +template class BasicMatrixTransformation2D: public AbstractBasicTranslationRotationScaling2D { public: /** @brief Underlying transformation type */ typedef Math::Matrix3 DataType; @@ -76,16 +71,16 @@ class MatrixTransformation2D: public AbstractTranslationRotationScaling2D { * @brief Set transformation * @return Pointer to self (for method chaining) */ - Object>* setTransformation(const Math::Matrix3& transformation) { + Object>* setTransformation(const Math::Matrix3& transformation) { /* Setting transformation is forbidden for the scene */ /** @todo Assert for this? */ /** @todo Do this in some common code so we don't need to include Object? */ - if(!static_cast>*>(this)->isScene()) { + if(!static_cast>*>(this)->isScene()) { _transformation = transformation; - static_cast>*>(this)->setDirty(); + static_cast>*>(this)->setDirty(); } - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -94,43 +89,43 @@ class MatrixTransformation2D: public AbstractTranslationRotationScaling2D { * @param type Transformation type * @return Pointer to self (for method chaining) */ - Object>* transform(const Math::Matrix3& transformation, TransformationType type = TransformationType::Global) { + Object>* transform(const Math::Matrix3& transformation, TransformationType type = TransformationType::Global) { setTransformation(type == TransformationType::Global ? transformation*_transformation : _transformation*transformation); - return static_cast>*>(this); + return static_cast>*>(this); } /** @copydoc AbstractTranslationRotationScaling2D::resetTransformation() */ - Object>* resetTransformation() { + Object>* resetTransformation() { setTransformation({}); - return static_cast>*>(this); + return static_cast>*>(this); } /** * @copydoc AbstractTranslationRotationScaling2D::translate() * Same as calling transform() with Matrix3::translation(). */ - Object>* translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { + Object>* translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { transform(Math::Matrix3::translation(vector), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** * @copydoc AbstractTranslationRotationScaling2D::rotate() * Same as calling transform() with Matrix3::rotation(). */ - Object>* rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>* rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { transform(Math::Matrix3::rotation(angle), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** * @copydoc AbstractTranslationRotationScaling2D::scale() * Same as calling transform() with Matrix3::scaling(). */ - Object>* scale(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { + Object>* scale(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { transform(Math::Matrix3::scaling(vector), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -142,9 +137,9 @@ class MatrixTransformation2D: public AbstractTranslationRotationScaling2D { * * Same as calling transform() with Matrix3::reflection(). */ - Object>* reflect(const Math::Vector2& normal, TransformationType type = TransformationType::Global) { + Object>* reflect(const Math::Vector2& normal, TransformationType type = TransformationType::Global) { transform(Math::Matrix3::reflection(normal), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -153,14 +148,14 @@ class MatrixTransformation2D: public AbstractTranslationRotationScaling2D { * if you want to move it above all. * @return Pointer to self (for method chaining) */ - Object>* move(Object>* under) { - static_cast*>(this)->Containers::template LinkedList>>::move(this, under); - return static_cast>*>(this); + Object>* move(Object>* under) { + static_cast*>(this)->Containers::template LinkedList>>::move(this, under); + return static_cast>*>(this); } protected: /* Allow construction only from Object */ - explicit MatrixTransformation2D() = default; + explicit BasicMatrixTransformation2D() = default; private: void doResetTransformation() override final { resetTransformation(); } @@ -180,6 +175,8 @@ class MatrixTransformation2D: public AbstractTranslationRotationScaling2D { Math::Matrix3 _transformation; }; + + }} #endif diff --git a/src/SceneGraph/MatrixTransformation3D.h b/src/SceneGraph/MatrixTransformation3D.h index 2c3527eef..88ea61e47 100644 --- a/src/SceneGraph/MatrixTransformation3D.h +++ b/src/SceneGraph/MatrixTransformation3D.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::MatrixTransformation3D + * @brief Class Magnum::SceneGraph::BasicMatrixTransformation3D, typedef Magnum::SceneGraph::MatrixTransformation3D */ #include "Math/Matrix4.h" @@ -38,14 +38,9 @@ namespace Magnum { namespace SceneGraph { @brief Three-dimensional transformation implemented using matrices Uses Math::Matrix4 as underlying type. -@see @ref scenegraph, RigidMatrixTransformation3D, MatrixTransformation2D +@see @ref MatrixTransformation3D, @ref scenegraph, @ref BasicRigidMatrixTransformation3D, @ref BasicMatrixTransformation2D */ -#ifndef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -class MatrixTransformation3D: public AbstractTranslationRotationScaling3D { +template class BasicMatrixTransformation3D: public AbstractBasicTranslationRotationScaling3D { public: /** @brief Underlying transformation type */ typedef Math::Matrix4 DataType; @@ -76,22 +71,22 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D { * @brief Set transformation * @return Pointer to self (for method chaining) */ - Object>* setTransformation(const Math::Matrix4& transformation) { + Object>* setTransformation(const Math::Matrix4& transformation) { /* Setting transformation is forbidden for the scene */ /** @todo Assert for this? */ /** @todo Do this in some common code so we don't need to include Object? */ - if(!static_cast>*>(this)->isScene()) { + if(!static_cast>*>(this)->isScene()) { _transformation = transformation; - static_cast>*>(this)->setDirty(); + static_cast>*>(this)->setDirty(); } - return static_cast>*>(this); + return static_cast>*>(this); } /** @copydoc AbstractTranslationRotationScaling3D::resetTransformation() */ - Object>* resetTransformation() { + Object>* resetTransformation() { setTransformation({}); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -100,28 +95,28 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D { * @param type Transformation type * @return Pointer to self (for method chaining) */ - Object>* transform(const Math::Matrix4& transformation, TransformationType type = TransformationType::Global) { + Object>* transform(const Math::Matrix4& transformation, TransformationType type = TransformationType::Global) { setTransformation(type == TransformationType::Global ? transformation*_transformation : _transformation*transformation); - return static_cast>*>(this); + return static_cast>*>(this); } /** * @copydoc AbstractTranslationRotationScaling3D::translate() * Same as calling transform() with Matrix4::translation(). */ - Object>* translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { + Object>* translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { transform(Math::Matrix4::translation(vector), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** * @copydoc AbstractTranslationRotationScaling3D::rotate() * Same as calling transform() with Matrix4::rotation(). */ - Object>* rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { + Object>* rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { transform(Math::Matrix4::rotation(angle, normalizedAxis), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -132,9 +127,9 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D { * * Same as calling transform() with Matrix4::rotationX(). */ - Object>* rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>* rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { transform(Math::Matrix4::rotationX(angle), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -145,9 +140,9 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D { * * Same as calling transform() with Matrix4::rotationY(). */ - Object>* rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>* rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { transform(Math::Matrix4::rotationY(angle), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -158,18 +153,18 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D { * * Same as calling transform() with Matrix4::rotationZ(). */ - Object>* rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>* rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { transform(Math::Matrix4::rotationZ(angle), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** * @copydoc AbstractTranslationRotationScaling3D::scale() * Same as calling transform() with Matrix4::scaling(). */ - Object>* scale(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { + Object>* scale(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { transform(Math::Matrix4::scaling(vector), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -181,14 +176,14 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D { * * Same as calling transform() with Matrix4::reflection(). */ - Object>* reflect(const Math::Vector3& normal, TransformationType type = TransformationType::Global) { + Object>* reflect(const Math::Vector3& normal, TransformationType type = TransformationType::Global) { transform(Math::Matrix4::reflection(normal), type); - return static_cast>*>(this); + return static_cast>*>(this); } protected: /* Allow construction only from Object */ - explicit MatrixTransformation3D() = default; + explicit BasicMatrixTransformation3D() = default; private: void doResetTransformation() override final { resetTransformation(); } @@ -220,6 +215,13 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D { Math::Matrix4 _transformation; }; +/** +@brief Three-dimensional transformation for float scenes implemented using matrices + +@see @ref MatrixTransformation2D +*/ +typedef BasicMatrixTransformation3D MatrixTransformation3D; + }} #endif diff --git a/src/SceneGraph/Object.hpp b/src/SceneGraph/Object.hpp index ce05dedd4..fc30805bc 100644 --- a/src/SceneGraph/Object.hpp +++ b/src/SceneGraph/Object.hpp @@ -41,8 +41,8 @@ namespace Magnum { namespace SceneGraph { template AbstractBasicObject::AbstractBasicObject() {} template AbstractBasicObject::~AbstractBasicObject() {} -template AbstractTransformation::AbstractTransformation() {} -template AbstractTransformation::~AbstractTransformation() {} +template AbstractBasicTransformation::AbstractBasicTransformation() {} +template AbstractBasicTransformation::~AbstractBasicTransformation() {} template Object::~Object() = default; diff --git a/src/SceneGraph/RigidMatrixTransformation2D.h b/src/SceneGraph/RigidMatrixTransformation2D.h index 74dd96428..9b8807011 100644 --- a/src/SceneGraph/RigidMatrixTransformation2D.h +++ b/src/SceneGraph/RigidMatrixTransformation2D.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::RigidMatrixTransformation2D + * @brief Class Magnum::SceneGraph::BasicRigidMatrixTransformation2D, typedef Magnum::SceneGraph::RigidMatrixTransformation2D */ #include "Math/Matrix3.h" @@ -38,17 +38,13 @@ namespace Magnum { namespace SceneGraph { /** @brief Two-dimensional rigid transformation implemented using matrices -Unlike MatrixTransformation2D this class allows only rotation, reflection and -translation (no scaling or setting arbitrary transformations). This allows to -use Matrix3::invertedRigid() for faster computation of inverse transformations. -@see @ref scenegraph, RigidMatrixTransformation3D +Unlike BasicMatrixTransformation2D this class allows only rotation, reflection +and translation (no scaling or setting arbitrary transformations). This allows +to use Matrix3::invertedRigid() for faster computation of inverse +transformations. +@see @ref RigidMatrixTransformation2D, @ref scenegraph, @ref BasicRigidMatrixTransformation3D */ -#ifndef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -class RigidMatrixTransformation2D: public AbstractTranslationRotation2D { +template class BasicRigidMatrixTransformation2D: public AbstractBasicTranslationRotation2D { public: /** @brief Underlying transformation type */ typedef Math::Matrix3 DataType; @@ -84,11 +80,11 @@ class RigidMatrixTransformation2D: public AbstractTranslationRotation2D { * Normalizes the rotation part using Math::Algorithms::gramSchmidt() * to prevent rounding errors when rotating the object subsequently. */ - Object>* normalizeRotation() { + Object>* normalizeRotation() { setTransformationInternal(Math::Matrix3::from( Math::Algorithms::gramSchmidtOrthonormalize(_transformation.rotationScaling()), _transformation.translation())); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -98,18 +94,18 @@ class RigidMatrixTransformation2D: public AbstractTranslationRotation2D { * Expects that the matrix represents rigid transformation. * @see Matrix3::isRigidTransformation() */ - Object>* setTransformation(const Math::Matrix3& transformation) { + Object>* setTransformation(const Math::Matrix3& transformation) { CORRADE_ASSERT(transformation.isRigidTransformation(), "SceneGraph::RigidMatrixTransformation2D::setTransformation(): the matrix doesn't represent rigid transformation", - static_cast>*>(this)); + static_cast>*>(this)); setTransformationInternal(transformation); - return static_cast>*>(this); + return static_cast>*>(this); } /** @copydoc AbstractTranslationRotationScaling2D::resetTransformation() */ - Object>* resetTransformation() { + Object>* resetTransformation() { setTransformationInternal({}); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -121,21 +117,21 @@ class RigidMatrixTransformation2D: public AbstractTranslationRotation2D { * Expects that the matrix represents rigid transformation. * @see Matrix3::isRigidTransformation() */ - Object>* transform(const Math::Matrix3& transformation, TransformationType type = TransformationType::Global) { + Object>* transform(const Math::Matrix3& transformation, TransformationType type = TransformationType::Global) { CORRADE_ASSERT(transformation.isRigidTransformation(), "SceneGraph::RigidMatrixTransformation2D::transform(): the matrix doesn't represent rigid transformation", - static_cast>*>(this)); + static_cast>*>(this)); transformInternal(transformation, type); - return static_cast>*>(this); + return static_cast>*>(this); } /** * @copydoc AbstractTranslationRotationScaling2D::translate() * Same as calling transform() with Matrix3::translation(). */ - Object>* translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { + Object>* translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix3::translation(vector), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -147,9 +143,9 @@ class RigidMatrixTransformation2D: public AbstractTranslationRotation2D { * Same as calling transform() with Matrix3::rotation(). * @see normalizeRotation() */ - Object>* rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>* rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix3::rotation(angle), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -161,9 +157,9 @@ class RigidMatrixTransformation2D: public AbstractTranslationRotation2D { * * Same as calling transform() with Matrix3::reflection(). */ - Object>* reflect(const Math::Vector2& normal, TransformationType type = TransformationType::Global) { + Object>* reflect(const Math::Vector2& normal, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix3::reflection(normal), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -172,14 +168,14 @@ class RigidMatrixTransformation2D: public AbstractTranslationRotation2D { * if you want to move it above all. * @return Pointer to self (for method chaining) */ - Object>* move(Object>* under) { - static_cast*>(this)->Containers::template LinkedList>>::move(this, under); - return static_cast>*>(this); + Object>* move(Object>* under) { + static_cast*>(this)->Containers::template LinkedList>>::move(this, under); + return static_cast>*>(this); } protected: /* Allow construction only from Object */ - explicit RigidMatrixTransformation2D() = default; + explicit BasicRigidMatrixTransformation2D() = default; private: void doResetTransformation() override final { resetTransformation(); } @@ -197,9 +193,9 @@ class RigidMatrixTransformation2D: public AbstractTranslationRotation2D { /* Setting transformation is forbidden for the scene */ /** @todo Assert for this? */ /** @todo Do this in some common code so we don't need to include Object? */ - if(!static_cast>*>(this)->isScene()) { + if(!static_cast>*>(this)->isScene()) { _transformation = transformation; - static_cast>*>(this)->setDirty(); + static_cast>*>(this)->setDirty(); } } @@ -212,6 +208,7 @@ class RigidMatrixTransformation2D: public AbstractTranslationRotation2D { Math::Matrix3 _transformation; }; + }} #endif diff --git a/src/SceneGraph/RigidMatrixTransformation3D.h b/src/SceneGraph/RigidMatrixTransformation3D.h index 1d13702e4..abccc8cbf 100644 --- a/src/SceneGraph/RigidMatrixTransformation3D.h +++ b/src/SceneGraph/RigidMatrixTransformation3D.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::RigidMatrixTransformation3D + * @brief Class Magnum::SceneGraph::BasicRigidMatrixTransformation3D, typedef Magnum::SceneGraph::RigidMatrixTransformation3D */ #include "Math/Matrix4.h" @@ -38,17 +38,13 @@ namespace Magnum { namespace SceneGraph { /** @brief Three-dimensional rigid transformation implemented using matrices -Unlike MatrixTransformation3D this class allows only rotation, reflection and -translation (no scaling or setting arbitrary transformations). This allows to -use Matrix4::invertedRigid() for faster computation of inverse transformations. -@see @ref scenegraph, RigidMatrixTransformation2D +Unlike BasicMatrixTransformation3D this class allows only rotation, reflection +and translation (no scaling or setting arbitrary transformations). This allows +to use Matrix4::invertedRigid() for faster computation of inverse +transformations. +@see @ref RigidMatrixTransformation3D, @ref scenegraph, @ref BasicRigidMatrixTransformation2D */ -#ifndef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -class RigidMatrixTransformation3D: public AbstractTranslationRotation3D { +template class BasicRigidMatrixTransformation3D: public AbstractBasicTranslationRotation3D { public: /** @brief Underlying transformation type */ typedef Math::Matrix4 DataType; @@ -84,11 +80,11 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D { * Normalizes the rotation part using Math::Algorithms::gramSchmidt() * to prevent rounding errors when rotating the object subsequently. */ - Object>* normalizeRotation() { + Object>* normalizeRotation() { setTransformation(Math::Matrix4::from( Math::Algorithms::gramSchmidtOrthonormalize(_transformation.rotationScaling()), _transformation.translation())); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -98,18 +94,18 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D { * Expects that the matrix represents rigid transformation. * @see Matrix4::isRigidTransformation() */ - Object>* setTransformation(const Math::Matrix4& transformation) { + Object>* setTransformation(const Math::Matrix4& transformation) { CORRADE_ASSERT(transformation.isRigidTransformation(), "SceneGraph::RigidMatrixTransformation3D::setTransformation(): the matrix doesn't represent rigid transformation", - static_cast>*>(this)); + static_cast>*>(this)); setTransformationInternal(transformation); - return static_cast>*>(this); + return static_cast>*>(this); } /** @copydoc AbstractTranslationRotationScaling3D::resetTransformation() */ - Object>* resetTransformation() { + Object>* resetTransformation() { setTransformation({}); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -121,21 +117,21 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D { * Expects that the matrix represents rigid transformation. * @see Matrix4::isRigidTransformation() */ - Object>* transform(const Math::Matrix4& transformation, TransformationType type = TransformationType::Global) { + Object>* transform(const Math::Matrix4& transformation, TransformationType type = TransformationType::Global) { CORRADE_ASSERT(transformation.isRigidTransformation(), "SceneGraph::RigidMatrixTransformation3D::transform(): the matrix doesn't represent rigid transformation", - static_cast>*>(this)); + static_cast>*>(this)); transformInternal(transformation, type); - return static_cast>*>(this); + return static_cast>*>(this); } /** * @copydoc AbstractTranslationRotationScaling3D::translate() * Same as calling transform() with Matrix4::translation(). */ - Object>* translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { + Object>* translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix4::translation(vector), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -149,9 +145,9 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D { * @see rotateX(), rotateY(), rotateZ(), Vector3::xAxis(), * Vector3::yAxis(), Vector3::zAxis(), normalizeRotation() */ - Object>* rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { + Object>* rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix4::rotation(angle, normalizedAxis), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -163,9 +159,9 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D { * Same as calling transform() with Matrix4::rotationX(). * @see normalizeRotation() */ - Object>* rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>* rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix4::rotationX(angle), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -177,9 +173,9 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D { * Same as calling transform() with Matrix4::rotationY(). * @see normalizeRotation() */ - Object>* rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>* rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix4::rotationY(angle), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -191,9 +187,9 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D { * Same as calling transform() with Matrix4::rotationZ(). * @see normalizeRotation() */ - Object>* rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>* rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix4::rotationZ(angle), type); - return static_cast>*>(this); + return static_cast>*>(this); } /** @@ -205,14 +201,14 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D { * * Same as calling transform() with Matrix4::reflection(). */ - Object>* reflect(const Math::Vector3& normal, TransformationType type = TransformationType::Global) { + Object>* reflect(const Math::Vector3& normal, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix4::reflection(normal), type); - return static_cast>*>(this); + return static_cast>*>(this); } protected: /* Allow construction only from Object */ - explicit RigidMatrixTransformation3D() = default; + explicit BasicRigidMatrixTransformation3D() = default; private: void doResetTransformation() override final { resetTransformation(); } @@ -242,9 +238,9 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D { /* Setting transformation is forbidden for the scene */ /** @todo Assert for this? */ /** @todo Do this in some common code so we don't need to include Object? */ - if(!static_cast>*>(this)->isScene()) { + if(!static_cast>*>(this)->isScene()) { _transformation = transformation; - static_cast>*>(this)->setDirty(); + static_cast>*>(this)->setDirty(); } } @@ -257,6 +253,13 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D { Math::Matrix4 _transformation; }; +/** +@brief Three-dimensional rigid transformation for float scenes implemented using matrices + +@see @ref RigidMatrixTransformation2D +*/ +typedef BasicRigidMatrixTransformation3D RigidMatrixTransformation3D; + }} #endif diff --git a/src/SceneGraph/SceneGraph.h b/src/SceneGraph/SceneGraph.h index 26ccb6bd5..255b02640 100644 --- a/src/SceneGraph/SceneGraph.h +++ b/src/SceneGraph/SceneGraph.h @@ -64,16 +64,19 @@ typedef AbstractBasicObject<3, Float> AbstractObject3D; enum class TransformationType: UnsignedByte; -template class AbstractTransformation; -#ifndef CORRADE_GCC46_COMPATIBILITY -template using AbstractTransformation2D = AbstractTransformation<2, T>; -template using AbstractTransformation3D = AbstractTransformation<3, T>; -#endif +template class AbstractBasicTransformation; +typedef AbstractBasicTransformation<2, Float> AbstractTransformation2D; +typedef AbstractBasicTransformation<3, Float> AbstractTransformation3D; + +template class AbstractBasicTranslationRotation2D; +template class AbstractBasicTranslationRotation3D; +typedef AbstractBasicTranslationRotation2D AbstractTranslationRotation2D; +typedef AbstractBasicTranslationRotation3D AbstractTranslationRotation3D; -template class AbstractTranslationRotation2D; -template class AbstractTranslationRotation3D; -template class AbstractTranslationRotationScaling2D; -template class AbstractTranslationRotationScaling3D; +template class AbstractBasicTranslationRotationScaling2D; +template class AbstractBasicTranslationRotationScaling3D; +typedef AbstractBasicTranslationRotationScaling2D AbstractTranslationRotationScaling2D; +typedef AbstractBasicTranslationRotationScaling3D AbstractTranslationRotationScaling3D; template class BasicAnimable; typedef BasicAnimable<2, Float> Animable2D; @@ -94,8 +97,10 @@ template class BasicDrawable; typedef BasicDrawable<2, Float> Drawable2D; typedef BasicDrawable<3, Float> Drawable3D; -template class DualComplexTransformation; -template class DualQuaternionTransformation; +template class BasicDualComplexTransformation; +template class BasicDualQuaternionTransformation; +typedef BasicDualComplexTransformation DualComplexTransformation; +typedef BasicDualQuaternionTransformation DualQuaternionTransformation; template class BasicFeatureGroup; #ifndef CORRADE_GCC46_COMPATIBILITY @@ -111,13 +116,17 @@ template class BasicDrawableGroup; typedef BasicDrawableGroup<2, Float> DrawableGroup2D; typedef BasicDrawableGroup<3, Float> DrawableGroup3D; -template class MatrixTransformation2D; -template class MatrixTransformation3D; +template class BasicMatrixTransformation2D; +template class BasicMatrixTransformation3D; +typedef BasicMatrixTransformation2D MatrixTransformation2D; +typedef BasicMatrixTransformation3D MatrixTransformation3D; template class Object; -template class RigidMatrixTransformation2D; -template class RigidMatrixTransformation3D; +template class BasicRigidMatrixTransformation2D; +template class BasicRigidMatrixTransformation3D; +typedef BasicRigidMatrixTransformation2D RigidMatrixTransformation2D; +typedef BasicRigidMatrixTransformation3D RigidMatrixTransformation3D; template class Scene; #endif diff --git a/src/SceneGraph/Test/AnimableTest.cpp b/src/SceneGraph/Test/AnimableTest.cpp index b2b21b313..ed3726ec3 100644 --- a/src/SceneGraph/Test/AnimableTest.cpp +++ b/src/SceneGraph/Test/AnimableTest.cpp @@ -45,7 +45,7 @@ class AnimableTest: public TestSuite::Tester { void debug(); }; -typedef SceneGraph::Object> Object3D; +typedef SceneGraph::Object Object3D; AnimableTest::AnimableTest() { addTests({&AnimableTest::state, diff --git a/src/SceneGraph/Test/CameraTest.cpp b/src/SceneGraph/Test/CameraTest.cpp index c29a04dc1..54402cdc2 100644 --- a/src/SceneGraph/Test/CameraTest.cpp +++ b/src/SceneGraph/Test/CameraTest.cpp @@ -48,9 +48,9 @@ class CameraTest: public TestSuite::Tester { void draw(); }; -typedef SceneGraph::Object> Object2D; -typedef SceneGraph::Object> Object3D; -typedef SceneGraph::Scene> Scene3D; +typedef SceneGraph::Object Object2D; +typedef SceneGraph::Object Object3D; +typedef SceneGraph::Scene Scene3D; CameraTest::CameraTest() { addTests({&CameraTest::fixAspectRatio, diff --git a/src/SceneGraph/Test/DualComplexTransformationTest.cpp b/src/SceneGraph/Test/DualComplexTransformationTest.cpp index 853051f58..87d222df4 100644 --- a/src/SceneGraph/Test/DualComplexTransformationTest.cpp +++ b/src/SceneGraph/Test/DualComplexTransformationTest.cpp @@ -30,8 +30,8 @@ namespace Magnum { namespace SceneGraph { namespace Test { -typedef Object> Object2D; -typedef Scene> Scene2D; +typedef Object Object2D; +typedef Scene Scene2D; class DualComplexTransformationTest: public TestSuite::Tester { public: @@ -67,24 +67,24 @@ DualComplexTransformationTest::DualComplexTransformationTest() { void DualComplexTransformationTest::fromMatrix() { Matrix3 m = Matrix3::rotation(Deg(17.0f))*Matrix3::translation({1.0f, -0.3f}); DualComplex c = DualComplex::rotation(Deg(17.0f))*DualComplex::translation({1.0f, -0.3f}); - CORRADE_COMPARE(DualComplexTransformation<>::fromMatrix(m), c); + CORRADE_COMPARE(DualComplexTransformation::fromMatrix(m), c); } void DualComplexTransformationTest::toMatrix() { DualComplex c = DualComplex::rotation(Deg(17.0f))*DualComplex::translation({1.0f, -0.3f}); Matrix3 m = Matrix3::rotation(Deg(17.0f))*Matrix3::translation({1.0f, -0.3f}); - CORRADE_COMPARE(DualComplexTransformation<>::toMatrix(c), m); + CORRADE_COMPARE(DualComplexTransformation::toMatrix(c), m); } void DualComplexTransformationTest::compose() { DualComplex parent = DualComplex::rotation(Deg(17.0f)); DualComplex child = DualComplex::translation({1.0f, -0.3f}); - CORRADE_COMPARE(DualComplexTransformation<>::compose(parent, child), parent*child); + CORRADE_COMPARE(DualComplexTransformation::compose(parent, child), parent*child); } void DualComplexTransformationTest::inverted() { DualComplex c = DualComplex::rotation(Deg(17.0f))*DualComplex::translation({1.0f, -0.3f}); - CORRADE_COMPARE(DualComplexTransformation<>::inverted(c)*c, DualComplex()); + CORRADE_COMPARE(DualComplexTransformation::inverted(c)*c, DualComplex()); } void DualComplexTransformationTest::setTransformation() { diff --git a/src/SceneGraph/Test/DualQuaternionTransformationTest.cpp b/src/SceneGraph/Test/DualQuaternionTransformationTest.cpp index bfacea1a6..8433eebbb 100644 --- a/src/SceneGraph/Test/DualQuaternionTransformationTest.cpp +++ b/src/SceneGraph/Test/DualQuaternionTransformationTest.cpp @@ -30,8 +30,8 @@ namespace Magnum { namespace SceneGraph { namespace Test { -typedef Object> Object3D; -typedef Scene> Scene3D; +typedef Object Object3D; +typedef Scene Scene3D; class DualQuaternionTransformationTest: public TestSuite::Tester { public: @@ -67,24 +67,24 @@ DualQuaternionTransformationTest::DualQuaternionTransformationTest() { void DualQuaternionTransformationTest::fromMatrix() { Matrix4 m = Matrix4::rotationX(Deg(17.0f))*Matrix4::translation({1.0f, -0.3f, 2.3f}); DualQuaternion q = DualQuaternion::rotation(Deg(17.0f), Vector3::xAxis())*DualQuaternion::translation({1.0f, -0.3f, 2.3f}); - CORRADE_COMPARE(DualQuaternionTransformation<>::fromMatrix(m), q); + CORRADE_COMPARE(DualQuaternionTransformation::fromMatrix(m), q); } void DualQuaternionTransformationTest::toMatrix() { DualQuaternion q = DualQuaternion::rotation(Deg(17.0f), Vector3::xAxis())*DualQuaternion::translation({1.0f, -0.3f, 2.3f}); Matrix4 m = Matrix4::rotationX(Deg(17.0f))*Matrix4::translation({1.0f, -0.3f, 2.3f}); - CORRADE_COMPARE(DualQuaternionTransformation<>::toMatrix(q), m); + CORRADE_COMPARE(DualQuaternionTransformation::toMatrix(q), m); } void DualQuaternionTransformationTest::compose() { DualQuaternion parent = DualQuaternion::rotation(Deg(17.0f), Vector3::xAxis()); DualQuaternion child = DualQuaternion::translation({1.0f, -0.3f, 2.3f}); - CORRADE_COMPARE(DualQuaternionTransformation<>::compose(parent, child), parent*child); + CORRADE_COMPARE(DualQuaternionTransformation::compose(parent, child), parent*child); } void DualQuaternionTransformationTest::inverted() { DualQuaternion q = DualQuaternion::rotation(Deg(17.0f), Vector3::xAxis())*DualQuaternion::translation({1.0f, -0.3f, 2.3f}); - CORRADE_COMPARE(DualQuaternionTransformation<>::inverted(q)*q, DualQuaternion()); + CORRADE_COMPARE(DualQuaternionTransformation::inverted(q)*q, DualQuaternion()); } void DualQuaternionTransformationTest::setTransformation() { diff --git a/src/SceneGraph/Test/MatrixTransformation2DTest.cpp b/src/SceneGraph/Test/MatrixTransformation2DTest.cpp index f000e4742..d997a0f17 100644 --- a/src/SceneGraph/Test/MatrixTransformation2DTest.cpp +++ b/src/SceneGraph/Test/MatrixTransformation2DTest.cpp @@ -29,8 +29,8 @@ namespace Magnum { namespace SceneGraph { namespace Test { -typedef Object> Object2D; -typedef Scene> Scene2D; +typedef Object Object2D; +typedef Scene Scene2D; class MatrixTransformation2DTest: public TestSuite::Tester { public: @@ -67,23 +67,23 @@ MatrixTransformation2DTest::MatrixTransformation2DTest() { void MatrixTransformation2DTest::fromMatrix() { Matrix3 m = Matrix3::rotation(Deg(17.0f))*Matrix3::translation({1.0f, -0.3f}); - CORRADE_COMPARE(MatrixTransformation2D<>::fromMatrix(m), m); + CORRADE_COMPARE(MatrixTransformation2D::fromMatrix(m), m); } void MatrixTransformation2DTest::toMatrix() { Matrix3 m = Matrix3::rotation(Deg(17.0f))*Matrix3::translation({1.0f, -0.3f}); - CORRADE_COMPARE(MatrixTransformation2D<>::toMatrix(m), m); + CORRADE_COMPARE(MatrixTransformation2D::toMatrix(m), m); } void MatrixTransformation2DTest::compose() { Matrix3 parent = Matrix3::rotation(Deg(17.0f)); Matrix3 child = Matrix3::translation({1.0f, -0.3f}); - CORRADE_COMPARE(MatrixTransformation2D<>::compose(parent, child), parent*child); + CORRADE_COMPARE(MatrixTransformation2D::compose(parent, child), parent*child); } void MatrixTransformation2DTest::inverted() { Matrix3 m = Matrix3::rotation(Deg(17.0f))*Matrix3::translation({1.0f, -0.3f}); - CORRADE_COMPARE(MatrixTransformation2D<>::inverted(m)*m, Matrix3()); + CORRADE_COMPARE(MatrixTransformation2D::inverted(m)*m, Matrix3()); } void MatrixTransformation2DTest::setTransformation() { diff --git a/src/SceneGraph/Test/MatrixTransformation3DTest.cpp b/src/SceneGraph/Test/MatrixTransformation3DTest.cpp index 955775572..32a09dbfc 100644 --- a/src/SceneGraph/Test/MatrixTransformation3DTest.cpp +++ b/src/SceneGraph/Test/MatrixTransformation3DTest.cpp @@ -29,8 +29,8 @@ namespace Magnum { namespace SceneGraph { namespace Test { -typedef Object> Object3D; -typedef Scene> Scene3D; +typedef Object Object3D; +typedef Scene Scene3D; class MatrixTransformation3DTest: public TestSuite::Tester { public: @@ -67,23 +67,23 @@ MatrixTransformation3DTest::MatrixTransformation3DTest() { void MatrixTransformation3DTest::fromMatrix() { Matrix4 m = Matrix4::rotationX(Deg(17.0f))*Matrix4::translation({1.0f, -0.3f, 2.3f})*Matrix4::scaling({2.0f, 1.4f, -2.1f}); - CORRADE_COMPARE(MatrixTransformation3D<>::fromMatrix(m), m); + CORRADE_COMPARE(MatrixTransformation3D::fromMatrix(m), m); } void MatrixTransformation3DTest::toMatrix() { Matrix4 m = Matrix4::rotationX(Deg(17.0f))*Matrix4::translation({1.0f, -0.3f, 2.3f})*Matrix4::scaling({2.0f, 1.4f, -2.1f}); - CORRADE_COMPARE(MatrixTransformation3D<>::toMatrix(m), m); + CORRADE_COMPARE(MatrixTransformation3D::toMatrix(m), m); } void MatrixTransformation3DTest::compose() { Matrix4 parent = Matrix4::rotationX(Deg(17.0f)); Matrix4 child = Matrix4::translation({1.0f, -0.3f, 2.3f}); - CORRADE_COMPARE(MatrixTransformation3D<>::compose(parent, child), parent*child); + CORRADE_COMPARE(MatrixTransformation3D::compose(parent, child), parent*child); } void MatrixTransformation3DTest::inverted() { Matrix4 m = Matrix4::rotationX(Deg(17.0f))*Matrix4::translation({1.0f, -0.3f, 2.3f})*Matrix4::scaling({2.0f, 1.4f, -2.1f}); - CORRADE_COMPARE(MatrixTransformation3D<>::inverted(m)*m, Matrix4()); + CORRADE_COMPARE(MatrixTransformation3D::inverted(m)*m, Matrix4()); } void MatrixTransformation3DTest::setTransformation() { diff --git a/src/SceneGraph/Test/ObjectTest.cpp b/src/SceneGraph/Test/ObjectTest.cpp index f6151d420..272b915d7 100644 --- a/src/SceneGraph/Test/ObjectTest.cpp +++ b/src/SceneGraph/Test/ObjectTest.cpp @@ -47,8 +47,8 @@ class ObjectTest: public TestSuite::Tester { void setCleanListBulk(); }; -typedef SceneGraph::Object> Object3D; -typedef SceneGraph::Scene> Scene3D; +typedef SceneGraph::Object Object3D; +typedef SceneGraph::Scene Scene3D; class CachingObject: public Object3D, AbstractFeature3D { public: diff --git a/src/SceneGraph/Test/RigidMatrixTransformation2DTest.cpp b/src/SceneGraph/Test/RigidMatrixTransformation2DTest.cpp index 31d3625c9..b362e97de 100644 --- a/src/SceneGraph/Test/RigidMatrixTransformation2DTest.cpp +++ b/src/SceneGraph/Test/RigidMatrixTransformation2DTest.cpp @@ -30,8 +30,8 @@ namespace Magnum { namespace SceneGraph { namespace Test { -typedef Object> Object2D; -typedef Scene> Scene2D; +typedef Object Object2D; +typedef Scene Scene2D; class RigidMatrixTransformation2DTest: public TestSuite::Tester { public: @@ -69,27 +69,27 @@ RigidMatrixTransformation2DTest::RigidMatrixTransformation2DTest() { void RigidMatrixTransformation2DTest::fromMatrix() { std::ostringstream o; Error::setOutput(&o); - RigidMatrixTransformation2D<>::fromMatrix(Matrix3::scaling(Vector2(4.0f))); + RigidMatrixTransformation2D::fromMatrix(Matrix3::scaling(Vector2(4.0f))); CORRADE_COMPARE(o.str(), "SceneGraph::RigidMatrixTransformation2D::fromMatrix(): the matrix doesn't represent rigid transformation\n"); Matrix3 m = Matrix3::rotation(Deg(17.0f))*Matrix3::translation({1.0f, -0.3f}); - CORRADE_COMPARE(RigidMatrixTransformation2D<>::fromMatrix(m), m); + CORRADE_COMPARE(RigidMatrixTransformation2D::fromMatrix(m), m); } void RigidMatrixTransformation2DTest::toMatrix() { Matrix3 m = Matrix3::rotation(Deg(17.0f))*Matrix3::translation({1.0f, -0.3f}); - CORRADE_COMPARE(RigidMatrixTransformation2D<>::toMatrix(m), m); + CORRADE_COMPARE(RigidMatrixTransformation2D::toMatrix(m), m); } void RigidMatrixTransformation2DTest::compose() { Matrix3 parent = Matrix3::rotation(Deg(17.0f)); Matrix3 child = Matrix3::translation({1.0f, -0.3f}); - CORRADE_COMPARE(RigidMatrixTransformation2D<>::compose(parent, child), parent*child); + CORRADE_COMPARE(RigidMatrixTransformation2D::compose(parent, child), parent*child); } void RigidMatrixTransformation2DTest::inverted() { Matrix3 m = Matrix3::rotation(Deg(17.0f))*Matrix3::translation({1.0f, -0.3f}); - CORRADE_COMPARE(RigidMatrixTransformation2D<>::inverted(m)*m, Matrix3()); + CORRADE_COMPARE(RigidMatrixTransformation2D::inverted(m)*m, Matrix3()); } void RigidMatrixTransformation2DTest::setTransformation() { diff --git a/src/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp b/src/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp index 7c9495a2d..ef56d9d69 100644 --- a/src/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp +++ b/src/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp @@ -30,8 +30,8 @@ namespace Magnum { namespace SceneGraph { namespace Test { -typedef Object> Object3D; -typedef Scene> Scene3D; +typedef Object Object3D; +typedef Scene Scene3D; class RigidMatrixTransformation3DTest: public TestSuite::Tester { public: @@ -69,27 +69,27 @@ RigidMatrixTransformation3DTest::RigidMatrixTransformation3DTest() { void RigidMatrixTransformation3DTest::fromMatrix() { std::ostringstream o; Error::setOutput(&o); - RigidMatrixTransformation3D<>::fromMatrix(Matrix4::scaling(Vector3(4.0f))); + RigidMatrixTransformation3D::fromMatrix(Matrix4::scaling(Vector3(4.0f))); CORRADE_COMPARE(o.str(), "SceneGraph::RigidMatrixTransformation3D::fromMatrix(): the matrix doesn't represent rigid transformation\n"); Matrix4 m = Matrix4::rotationX(Deg(17.0f))*Matrix4::translation({1.0f, -0.3f, 2.3f}); - CORRADE_COMPARE(RigidMatrixTransformation3D<>::fromMatrix(m), m); + CORRADE_COMPARE(RigidMatrixTransformation3D::fromMatrix(m), m); } void RigidMatrixTransformation3DTest::toMatrix() { Matrix4 m = Matrix4::rotationX(Deg(17.0f))*Matrix4::translation({1.0f, -0.3f, 2.3f}); - CORRADE_COMPARE(RigidMatrixTransformation3D<>::toMatrix(m), m); + CORRADE_COMPARE(RigidMatrixTransformation3D::toMatrix(m), m); } void RigidMatrixTransformation3DTest::compose() { Matrix4 parent = Matrix4::rotationX(Deg(17.0f)); Matrix4 child = Matrix4::translation({1.0f, -0.3f, 2.3f}); - CORRADE_COMPARE(RigidMatrixTransformation3D<>::compose(parent, child), parent*child); + CORRADE_COMPARE(RigidMatrixTransformation3D::compose(parent, child), parent*child); } void RigidMatrixTransformation3DTest::inverted() { Matrix4 m = Matrix4::rotationX(Deg(17.0f))*Matrix4::translation({1.0f, -0.3f, 2.3f}); - CORRADE_COMPARE(RigidMatrixTransformation3D<>::inverted(m)*m, Matrix4()); + CORRADE_COMPARE(RigidMatrixTransformation3D::inverted(m)*m, Matrix4()); } void RigidMatrixTransformation3DTest::setTransformation() { diff --git a/src/SceneGraph/Test/SceneTest.cpp b/src/SceneGraph/Test/SceneTest.cpp index a2a725504..65f8dcb60 100644 --- a/src/SceneGraph/Test/SceneTest.cpp +++ b/src/SceneGraph/Test/SceneTest.cpp @@ -37,8 +37,8 @@ class SceneTest: public TestSuite::Tester { void parent(); }; -typedef SceneGraph::Scene> Scene3D; -typedef SceneGraph::Object> Object3D; +typedef SceneGraph::Scene Scene3D; +typedef SceneGraph::Object Object3D; SceneTest::SceneTest() { addTests({&SceneTest::transformation, diff --git a/src/SceneGraph/instantiation.cpp b/src/SceneGraph/instantiation.cpp index a43a916a2..ce04fb137 100644 --- a/src/SceneGraph/instantiation.cpp +++ b/src/SceneGraph/instantiation.cpp @@ -39,8 +39,8 @@ namespace Magnum { namespace SceneGraph { #ifndef DOXYGEN_GENERATING_OUTPUT template class AbstractBasicObject<2, Float>; template class AbstractBasicObject<3, Float>; -template class AbstractTransformation<2, Float>; -template class AbstractTransformation<3, Float>; +template class AbstractBasicTransformation<2, Float>; +template class AbstractBasicTransformation<3, Float>; template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicFeature<2, Float>; template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicFeature<3, Float>; @@ -52,12 +52,12 @@ template class AbstractBasicCamera<3, Float>; template class BasicCamera2D; template class BasicCamera3D; -template class MAGNUM_SCENEGRAPH_EXPORT Object>; -template class MAGNUM_SCENEGRAPH_EXPORT Object>; -template class MAGNUM_SCENEGRAPH_EXPORT Object>; -template class MAGNUM_SCENEGRAPH_EXPORT Object>; -template class MAGNUM_SCENEGRAPH_EXPORT Object>; -template class MAGNUM_SCENEGRAPH_EXPORT Object>; +template class MAGNUM_SCENEGRAPH_EXPORT Object>; +template class MAGNUM_SCENEGRAPH_EXPORT Object>; +template class MAGNUM_SCENEGRAPH_EXPORT Object>; +template class MAGNUM_SCENEGRAPH_EXPORT Object>; +template class MAGNUM_SCENEGRAPH_EXPORT Object>; +template class MAGNUM_SCENEGRAPH_EXPORT Object>; #endif }} diff --git a/src/Shapes/Test/ShapeTest.cpp b/src/Shapes/Test/ShapeTest.cpp index 3515a2739..7c8e2d8b0 100644 --- a/src/Shapes/Test/ShapeTest.cpp +++ b/src/Shapes/Test/ShapeTest.cpp @@ -44,10 +44,10 @@ class ShapeTest: public TestSuite::Tester { void shapeGroup(); }; -typedef SceneGraph::Scene> Scene2D; -typedef SceneGraph::Object> Object2D; -typedef SceneGraph::Scene> Scene3D; -typedef SceneGraph::Object> Object3D; +typedef SceneGraph::Scene Scene2D; +typedef SceneGraph::Object Object2D; +typedef SceneGraph::Scene Scene3D; +typedef SceneGraph::Object Object3D; ShapeTest::ShapeTest() { addTests({&ShapeTest::clean,