Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquick3dquaternionanimation.cpp
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
5#include <QtQuick/private/qquickanimation_p_p.h>
6
8
49
50
52{
53 return QVariant::fromValue(QQuaternion::slerp(from, to, progress));
54}
55
57{
58 return QVariant::fromValue(QQuaternion::nlerp(from, to, progress));
59}
60
63{
65 d->interpolatorType = qMetaTypeId<QQuaternion>();
66 d->defaultToInterpolatorType = true;
67 d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
68}
69
78{
80 return d->from.value<QQuaternion>();
81}
82
87
96{
98 return d->to.value<QQuaternion>();
99}
100
105
121
123{
125 if (d->type == type)
126 return;
127
128 d->type = type;
129 switch (type) {
130 case Nlerp:
131 d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(reinterpret_cast<void(*)()>(&q_quaternionNlerpInterpolator));
132 break;
133 case Slerp:
134 default:
135 d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
136 break;
137 }
138
140}
141
151{
153 return d->anglesFrom.x();
154}
155
157{
159 if (d->anglesFrom.x() == f)
160 return;
161 d->anglesFrom.setX(f);
162 setFrom(QQuaternion::fromEulerAngles(d->anglesFrom));
164}
165
175{
177 return d->anglesFrom.y();
178}
179
181{
183 if (d->anglesFrom.y() == f)
184 return;
185 d->anglesFrom.setY(f);
186 setFrom(QQuaternion::fromEulerAngles(d->anglesFrom));
188}
189
199{
201 return d->anglesFrom.z();
202}
203
205{
207 if (d->anglesFrom.z() == f)
208 return;
209 d->anglesFrom.setZ(f);
210 setFrom(QQuaternion::fromEulerAngles(d->anglesFrom));
212}
213
223{
225 return d->anglesTo.x();
226}
227
229{
231 if (d->anglesTo.x() == f)
232 return;
233 d->anglesTo.setX(f);
234 setTo(QQuaternion::fromEulerAngles(d->anglesTo));
236}
237
247{
249 return d->anglesTo.y();
250}
251
253{
255 if (d->anglesTo.y() == f)
256 return;
257 d->anglesTo.setY(f);
258 setTo(QQuaternion::fromEulerAngles(d->anglesTo));
260}
261
271{
273 return d->anglesTo.z();
274}
275
277{
279 if (d->anglesTo.z() == f)
280 return;
281 d->anglesTo.setZ(f);
282 setTo(QQuaternion::fromEulerAngles(d->anglesTo));
284}
285
\inmodule QtCore
Definition qobject.h:103
The QQuaternion class represents a quaternion consisting of a vector and scalar.
\qmltype QuaternionAnimation \inherits PropertyAnimation \inqmlmodule QtQuick3D
void toXRotationChanged(float value)
QQuick3DQuaternionAnimation(QObject *parent=nullptr)
void typeChanged(QQuick3DQuaternionAnimation::Type type)
void toZRotationChanged(float value)
void fromZRotationChanged(float value)
void toYRotationChanged(float value)
void fromXRotationChanged(float value)
void fromYRotationChanged(float value)
void setFrom(const QVariant &)
void setTo(const QVariant &)
static Q_CORE_EXPORT QVariantAnimation::Interpolator getInterpolator(int interpolationType)
QVariant(* Interpolator)(const void *from, const void *to, qreal progress)
\inmodule QtCore
Definition qvariant.h:65
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Definition qvariant.h:536
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
Combined button and popup list for selecting options.
GLfloat GLfloat f
GLenum type
GLdouble GLdouble t
Definition qopenglext.h:243
QVariant q_quaternionInterpolator(const QQuaternion &from, const QQuaternion &to, qreal progress)
QVariant q_quaternionNlerpInterpolator(const QQuaternion &from, const QQuaternion &to, qreal progress)
#define emit
double qreal
Definition qtypes.h:187
Definition moc.h:23