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
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/PxTransform.h>
21#include <foundation/PxMat33.h>
22#include <foundation/PxQuat.h>
23#include <foundation/PxVec3.h>
24
25namespace physx {
26class PxRigidBody;
27}
28
29namespace QPhysicsUtils {
30
31Q_ALWAYS_INLINE physx::PxVec3 toPhysXType(const QVector3D &qvec)
32{
33 return physx::PxVec3(qvec.x(), qvec.y(), qvec.z());
34}
35
36Q_ALWAYS_INLINE physx::PxQuat toPhysXType(const QQuaternion &qquat)
37{
38 return physx::PxQuat(qquat.x(), qquat.y(), qquat.z(), qquat.scalar());
39}
40
41Q_ALWAYS_INLINE physx::PxMat33 toPhysXType(const QMatrix3x3 &m)
42{
43 return physx::PxMat33(const_cast<float *>(m.constData()));
44}
45
46Q_ALWAYS_INLINE QVector3D toQtType(const physx::PxVec3 &vec)
47{
48 return QVector3D(vec.x, vec.y, vec.z);
49}
50
51Q_ALWAYS_INLINE QQuaternion toQtType(const physx::PxQuat &quat)
52{
53 return QQuaternion(quat.w, quat.x, quat.y, quat.z);
54}
55
62
63Q_ALWAYS_INLINE bool fuzzyEquals(const physx::PxTransform &a, const physx::PxTransform &b)
64{
65 return qFuzzyCompare(a.p.x, b.p.x) && qFuzzyCompare(a.p.y, b.p.y) && qFuzzyCompare(a.p.z, b.p.z)
66 && qFuzzyCompare(a.q.x, b.q.x) && qFuzzyCompare(a.q.y, b.q.y)
67 && qFuzzyCompare(a.q.z, b.q.z) && qFuzzyCompare(a.q.w, b.q.w);
68}
69
71}
72
73#endif // QPHYSICSUTILS_P_H
QAbstractPhysicsNode * frontendNode
virtual void cleanup(QPhysXWorld *)
physx::PxMaterial * material
QAbstractPhysXNode(QAbstractPhysicsNode *node)
void setShapesDirty(bool dirty)
void setFiltersDirty(bool dirty)
virtual void createMaterial(QPhysXWorld *physX)
void simulationEnabledChanged()
Q_REVISION(6, 7) bool simulationEnabled() const
void setPhysicsMaterial(QPhysicsMaterial *newPhysicsMaterial)
QPhysicsMaterial * physicsMaterial() const
void markDirtyShapes() override
void buildShapes(QPhysXWorld *physX)
void rebuildDirtyShapes(QPhysicsWorld *world, QPhysXWorld *physX) override
void init(QPhysicsWorld *world, QPhysXWorld *physX) override
bool debugGeometryCapability() override
QPhysXActorBody(QAbstractPhysicsNode *frontEnd)
void cleanup(QPhysXWorld *physX) override
physx::PxRigidActor * actor
virtual void createActor(QPhysXWorld *physX)
void sync(float deltaTime, QHash< QQuick3DNode *, QMatrix4x4 > &transformCache) override
void updateFilters() override
physx::PxTransform getGlobalPose() override
void createWorld()
SimulationEventCallback * callback
void deleteWorld()
physx::PxScene * scene
void createScene(float typicalLength, float typicalSpeed, const QVector3D &gravity, bool enableCCD, QPhysicsWorld *physicsWorld, unsigned int numThreads)
physx::PxControllerManager * controllerManager
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
const QQuaternion kMinus90YawRotation
#define PHYSX_RELEASE(x)
static QT_BEGIN_NAMESPACE physx::PxTransform getPhysXLocalTransform(const QQuick3DNode *node)
#define QT_BEGIN_NAMESPACE
#define QT_END_NAMESPACE
static StaticPhysXObjects & getReference()