Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qphysicsutils_p.h
Go to the documentation of this file.
1
// Copyright (C) 2022 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
ifndef
QPHYSICSUTILS_P_H
6
#
define
QPHYSICSUTILS_P_H
7
8
//
9
// W A R N I N G
10
// -------------
11
//
12
// This file is not part of the Qt API. It exists purely as an
13
// implementation detail. This header file may change from version to
14
// version without notice, or even be removed.
15
//
16
// We mean it.
17
//
18
19
#
include
<
QVector3D
>
20
#
include
<
QQuaternion
>
21
#
include
<
foundation
/
PxTransform
.
h
>
22
#
include
<
foundation
/
PxMat33
.
h
>
23
#
include
<
foundation
/
PxQuat
.
h
>
24
#
include
<
foundation
/
PxVec3
.
h
>
25
26
namespace
physx
{
27
class
PxRigidBody;
28
}
29
30
namespace
QPhysicsUtils
{
31
32
Q_ALWAYS_INLINE
physx
::PxVec3
toPhysXType
(
const
QVector3D
&
qvec
)
33
{
34
return
physx
::
PxVec3
(
qvec
.
x
(),
qvec
.
y
(),
qvec
.
z
());
35
}
36
37
Q_ALWAYS_INLINE
physx
::PxQuat
toPhysXType
(
const
QQuaternion
&
qquat
)
38
{
39
return
physx
::
PxQuat
(
qquat
.
x
(),
qquat
.
y
(),
qquat
.
z
(),
qquat
.
scalar
());
40
}
41
42
Q_ALWAYS_INLINE
physx
::PxMat33
toPhysXType
(
const
QMatrix3x3
&
m
)
43
{
44
return
physx
::
PxMat33
(
const_cast
<
float
*>(
m
.
constData
()));
45
}
46
47
Q_ALWAYS_INLINE QVector3D
toQtType
(
const
physx
::
PxVec3
&
vec
)
48
{
49
return
QVector3D
(
vec
.
x
,
vec
.
y
,
vec
.
z
);
50
}
51
52
Q_ALWAYS_INLINE QQuaternion
toQtType
(
const
physx
::
PxQuat
&
quat
)
53
{
54
return
QQuaternion
(
quat
.
w
,
quat
.
x
,
quat
.
y
,
quat
.
z
);
55
}
56
57
Q_ALWAYS_INLINE
physx
::PxTransform
toPhysXTransform
(
const
QVector3D
&
position
,
58
const
QQuaternion
&
rotation
)
59
{
60
return
physx
::
PxTransform
(
QPhysicsUtils
::
toPhysXType
(
position
),
61
QPhysicsUtils
::
toPhysXType
(
rotation
));
62
}
63
64
Q_ALWAYS_INLINE
bool
fuzzyEquals
(
const
physx
::PxTransform &a,
const
physx
::PxTransform &b)
65
{
66
return
qFuzzyCompare(a.p.x, b.p.x) && qFuzzyCompare(a.p.y, b.p.y) && qFuzzyCompare(a.p.z, b.p.z)
67
&& qFuzzyCompare(a.q.x, b.q.x) && qFuzzyCompare(a.q.y, b.q.y)
68
&& qFuzzyCompare(a.q.z, b.q.z) && qFuzzyCompare(a.q.w, b.q.w);
69
}
70
71
inline
const
QQuaternion
kMinus90YawRotation
=
QQuaternion
::
fromEulerAngles
(0, -90, 0);
72
}
73
74
#
endif
// QPHYSICSUTILS_P_H
QPhysicsUtils
Definition
qphysicsutils_p.h:30
QPhysicsUtils::fuzzyEquals
Q_ALWAYS_INLINE bool fuzzyEquals(const physx::PxTransform &a, const physx::PxTransform &b)
Definition
qphysicsutils_p.h:64
QPhysicsUtils::kMinus90YawRotation
const QQuaternion kMinus90YawRotation
Definition
qphysicsutils_p.h:71
physx
Definition
qphysxactorbody_p.h:22
QT_BEGIN_NAMESPACE
#define QT_BEGIN_NAMESPACE
Definition
qtconfigmacros.h:161
QT_END_NAMESPACE
#define QT_END_NAMESPACE
Definition
qtconfigmacros.h:162
emit
#define emit
Definition
qtmetamacros.h:52
qtquick3dphysics
src
quick3dphysics
qphysicsutils_p.h
Generated on
for Qt by
1.16.1