diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-08-21 04:45:40 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-08-21 04:45:40 (GMT) |
commit | 95c116a562c6d488caf5f2222af3c261c304587f (patch) | |
tree | e460ecac63192e3a6d07c91d5e9f0f6c8bd0731a | |
parent | bc9ced591a81293a155800cb28771f3bac17a9d2 (diff) | |
download | Qt-95c116a562c6d488caf5f2222af3c261c304587f.zip Qt-95c116a562c6d488caf5f2222af3c261c304587f.tar.gz Qt-95c116a562c6d488caf5f2222af3c261c304587f.tar.bz2 |
Register interpolators for math3d classes
Reviewed-by: Justin McPherson
-rw-r--r-- | src/gui/animation/qguivariantanimation.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/gui/animation/qguivariantanimation.cpp b/src/gui/animation/qguivariantanimation.cpp index 9badc82..de9363c 100644 --- a/src/gui/animation/qguivariantanimation.cpp +++ b/src/gui/animation/qguivariantanimation.cpp @@ -45,6 +45,10 @@ #include <private/qvariantanimation_p.h> #include <QtGui/qcolor.h> +#include <QtGui/qvector2d.h> +#include <QtGui/qvector3d.h> +#include <QtGui/qvector4d.h> +#include <QtGui/qquaternion.h> QT_BEGIN_NAMESPACE @@ -56,17 +60,35 @@ template<> Q_INLINE_TEMPLATE QColor _q_interpolate(const QColor &f,const QColor _q_interpolate(f.alpha(), t.alpha(), progress)); } +template<> Q_INLINE_TEMPLATE QQuaternion _q_interpolate(const QQuaternion &f,const QQuaternion &t, qreal progress) +{ + return QQuaternion::slerp(f, t, progress); +} + static int qRegisterGuiGetInterpolator() { qRegisterAnimationInterpolator<QColor>(_q_interpolateVariant<QColor>); + qRegisterAnimationInterpolator<QVector2D>(_q_interpolateVariant<QVector2D>); + qRegisterAnimationInterpolator<QVector3D>(_q_interpolateVariant<QVector3D>); + qRegisterAnimationInterpolator<QVector4D>(_q_interpolateVariant<QVector4D>); + qRegisterAnimationInterpolator<QQuaternion>(_q_interpolateVariant<QQuaternion>); return 1; } Q_CONSTRUCTOR_FUNCTION(qRegisterGuiGetInterpolator) static int qUnregisterGuiGetInterpolator() { + // casts required by Sun CC 5.5 qRegisterAnimationInterpolator<QColor>( - (QVariant (*)(const QColor &, const QColor &, qreal))0); // cast required by Sun CC 5.5 + (QVariant (*)(const QColor &, const QColor &, qreal))0); + qRegisterAnimationInterpolator<QVector2D>( + (QVariant (*)(const QVector2D &, const QVector2D &, qreal))0); + qRegisterAnimationInterpolator<QVector3D>( + (QVariant (*)(const QVector3D &, const QVector3D &, qreal))0); + qRegisterAnimationInterpolator<QVector4D>( + (QVariant (*)(const QVector4D &, const QVector4D &, qreal))0); + qRegisterAnimationInterpolator<QQuaternion>( + (QVariant (*)(const QQuaternion &, const QQuaternion &, qreal))0); return 1; } |