Qt 6.x
The Qt SDK
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
4#ifndef QPHYSICSUTILS_P_H
5#define QPHYSICSUTILS_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QVector3D>
19#include <QQuaternion>
20#include <foundation/PxMat33.h>
21#include <foundation/PxQuat.h>
22#include <foundation/PxVec3.h>
23
24namespace physx {
25class PxRigidBody;
26}
27
28namespace QPhysicsUtils {
29
30Q_ALWAYS_INLINE physx::PxVec3 toPhysXType(const QVector3D &qvec)
31{
32 return physx::PxVec3(qvec.x(), qvec.y(), qvec.z());
33}
34
35Q_ALWAYS_INLINE physx::PxQuat toPhysXType(const QQuaternion &qquat)
36{
37 return physx::PxQuat(qquat.x(), qquat.y(), qquat.z(), qquat.scalar());
38}
39
41{
42 return physx::PxMat33(const_cast<float *>(m.constData()));
43}
44
45Q_ALWAYS_INLINE QVector3D toQtType(const physx::PxVec3 &vec)
46{
47 return QVector3D(vec.x, vec.y, vec.z);
48}
49
50Q_ALWAYS_INLINE QQuaternion toQtType(const physx::PxQuat &quat)
51{
52 return QQuaternion(quat.w, quat.x, quat.y, quat.z);
53}
54}
55
56#endif // QPHYSICSUTILS_P_H
The QQuaternion class represents a quaternion consisting of a vector and scalar.
Definition qquaternion.h:21
float z() const
Returns the z coordinate of this quaternion's vector.
float scalar() const
Returns the scalar component of this quaternion.
float x() const
Returns the x coordinate of this quaternion's vector.
float y() const
Returns the y coordinate of this quaternion's vector.
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
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
Q_ALWAYS_INLINE physx::PxVec3 toPhysXType(const QVector3D &qvec)
Q_ALWAYS_INLINE QVector3D toQtType(const physx::PxVec3 &vec)
#define Q_ALWAYS_INLINE
const GLfloat * m