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
qquick3dparticlepointrotator.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
5
7
22
32{
33 return m_magnitude;
34}
35
37{
38 if (qFuzzyCompare(m_magnitude, magnitude))
39 return;
40
41 m_magnitude = magnitude;
43 Q_EMIT update();
44}
45
55{
56 return m_direction;
57}
58
60{
61 if (m_direction == direction)
62 return;
63
64 m_direction = direction;
65 m_directionNormalized = m_direction.normalized();
67 Q_EMIT update();
68}
69
79{
80 return m_pivotPoint;
81}
82
84{
85 if (m_pivotPoint == point)
86 return;
87
88 m_pivotPoint = point;
90 Q_EMIT update();
91}
92
94{
95 m_rotationMatrix.setToIdentity();
96 m_rotationMatrix.translate(m_pivotPoint);
97}
98
100{
101 // Rotate based on the current position
102 // Note that this means order of PointRotator element compared to other affectors matters
103 Q_UNUSED(sd);
104 if (!qFuzzyIsNull(m_magnitude)) {
105 QMatrix4x4 rot = m_rotationMatrix;
106 rot.rotate(time * m_magnitude, m_directionNormalized);
107 rot.translate(-m_pivotPoint);
108 d->position = rot.map(d->position);
109 }
110}
111
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
void rotate(float angle, const QVector3D &vector)
Multiples this matrix by another that rotates coordinates through angle degrees about vector.
void setToIdentity()
Sets this matrix to the identity.
Definition qmatrix4x4.h:316
void translate(const QVector3D &vector)
Multiplies this matrix by another that translates coordinates by the components of vector.
void affectParticle(const QQuick3DParticleData &sd, QQuick3DParticleDataCurrent *d, float time) override
void setDirection(const QVector3D &direction)
QQuick3DParticlePointRotator(QQuick3DNode *parent=nullptr)
\qmltype PointRotator3D \inherits Affector3D \inqmlmodule QtQuick3D.Particles3D
void setPivotPoint(const QVector3D &point)
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
QVector3D normalized() const noexcept
Returns the normalized unit vector form of this vector.
Definition qvectornd.h:695
direction
Combined button and popup list for selecting options.
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Definition qfloat16.h:333
bool qFuzzyIsNull(qfloat16 f) noexcept
Definition qfloat16.h:349
#define Q_EMIT
#define Q_UNUSED(x)