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
qquick3dparticlevectordirection.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
7
9
39
50{
51 return m_direction;
52}
53
64{
65 return m_directionVariation;
66}
67
79{
80 return m_normalized;
81}
82
84{
85 if (m_direction == direction)
86 return;
87
88 m_direction = direction;
90}
91
93{
94 if (m_directionVariation == directionVariation)
95 return;
96
97 m_directionVariation = directionVariation;
99}
100
102{
103 if (m_normalized == normalized)
104 return;
105
106 m_normalized = normalized;
108}
109
111{
113 if (!m_system)
114 return ret;
115 auto rand = m_system->rand();
116 ret.setX(m_direction.x() - m_directionVariation.x() + rand->get(d.index, QPRand::VDirXV) * m_directionVariation.x() * 2.0f);
117 ret.setY(m_direction.y() - m_directionVariation.y() + rand->get(d.index, QPRand::VDirYV) * m_directionVariation.y() * 2.0f);
118 ret.setZ(m_direction.z() - m_directionVariation.z() + rand->get(d.index, QPRand::VDirZV) * m_directionVariation.z() * 2.0f);
119 if (m_normalized)
120 ret = m_direction.length() * ret.normalized();
121 return ret;
122}
123
\inmodule QtCore
Definition qobject.h:103
void setDirection(const QVector3D &direction)
QQuick3DParticleVectorDirection(QObject *parent=nullptr)
\qmltype VectorDirection3D \inherits Direction3D \inqmlmodule QtQuick3D.Particles3D
void setDirectionVariation(const QVector3D &directionVariation)
QVector3D sample(const QQuick3DParticleData &d) override
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
float length() const noexcept
Returns the length of the vector from the origin.
Definition qvectornd.h:690
constexpr float y() const noexcept
Returns the y coordinate of this point.
Definition qvectornd.h:671
constexpr float x() const noexcept
Returns the x coordinate of this point.
Definition qvectornd.h:670
constexpr float z() const noexcept
Returns the z coordinate of this point.
Definition qvectornd.h:672
direction
Combined button and popup list for selecting options.
return ret
GLint GLenum GLboolean normalized
Definition qopenglext.h:752
#define Q_EMIT