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
qabstractphysxnode_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 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 ABSTRACTPHYSXNODE_H
6#define ABSTRACTPHYSXNODE_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
20
21#include "foundation/PxTransform.h"
22#include "qtconfigmacros.h"
23
24#include <QVector>
25#include <qobject.h>
26
27namespace physx {
28class PxMaterial;
29class PxShape;
30}
31
33
34class QAbstractPhysicsNode;
35class QMatrix4x4;
36class QQuick3DNode;
37class QPhysicsWorld;
38class QPhysicsMaterial;
39class QPhysXWorld;
40
41// Used for debug drawing
50
51/*
52 NOTE
53 The inheritance hierarchy is not ideal, since both controller and rigid body have materials,
54 but trigger doesn't. AND both trigger and rigid body have actors, but controller doesn't.
55*/
56
58{
60public:
62 virtual ~QAbstractPhysXNode();
63
64 bool cleanupIfRemoved(QPhysXWorld *physX); // TODO rename??
65
66 virtual void init(QPhysicsWorld *world, QPhysXWorld *physX) = 0;
67 virtual void updateDefaultDensity(float density);
68 // The material of the frontend node, if it has one
69 virtual QPhysicsMaterial *qtMaterial() const;
70 // Moves the node to the material matching the properties of qtMaterial(), creating it if
71 // needed. Returns true if the node ended up with a different material than before.
72 bool updateMaterial();
73 void releaseMaterial();
74 virtual void markDirtyShapes();
75 virtual void rebuildDirtyShapes(QPhysicsWorld *, QPhysXWorld *);
76 virtual void updateFilters(QPhysXWorld *physX);
77
78 virtual void sync(float deltaTime, QHash<QQuick3DNode *, QMatrix4x4> &transformCache) = 0;
79 virtual void cleanup(QPhysXWorld *);
80 virtual bool debugGeometryCapability();
82
83 virtual bool useTriggerFlag();
85
86 bool shapesDirty() const;
87 void setShapesDirty(bool dirty);
88
89 bool filtersDirty() const;
90 void setFiltersDirty(bool dirty);
91
92 virtual void detachFrontend();
93
95 physx::PxMaterial *material = nullptr;
96 // The properties 'material' was created for
98 QAbstractPhysicsNode *frontendNode = nullptr;
99 bool isRemoved = false;
100
101protected:
102 // The backend of another node, for a backend that acts on other nodes.
103 static QAbstractPhysXNode *backendOf(const QAbstractPhysicsNode *node);
104};
105
107
108#endif
virtual void updateDefaultDensity(float density)
virtual void sync(float deltaTime, QHash< QQuick3DNode *, QMatrix4x4 > &transformCache)=0
QAbstractPhysicsNode * frontendNode
QVector< physx::PxShape * > shapes
virtual void cleanup(QPhysXWorld *)
physx::PxMaterial * material
virtual void rebuildDirtyShapes(QPhysicsWorld *, QPhysXWorld *)
PhysicsMaterialProperties materialProperties
void setShapesDirty(bool dirty)
static QAbstractPhysXNode * backendOf(const QAbstractPhysicsNode *node)
virtual bool debugGeometryCapability()
virtual physx::PxTransform getGlobalPose()
virtual void init(QPhysicsWorld *world, QPhysXWorld *physX)=0
virtual void markDirtyShapes()
virtual DebugDrawBodyType getDebugDrawBodyType()
virtual QPhysicsMaterial * qtMaterial() const
void setFiltersDirty(bool dirty)
virtual void updateFilters(QPhysXWorld *physX)
virtual void detachFrontend()
bool cleanupIfRemoved(QPhysXWorld *physX)
virtual bool useTriggerFlag()
void updateFilters(QPhysXWorld *physX) override
void markDirtyShapes() override
void buildShapes(QPhysXWorld *physX)
void rebuildDirtyShapes(QPhysicsWorld *world, QPhysXWorld *physX) override
void init(QPhysicsWorld *world, QPhysXWorld *physX) override
void detachFrontend() override
bool debugGeometryCapability() override
void cleanup(QPhysXWorld *physX) override
physx::PxRigidActor * actor
virtual void createActor(QPhysXWorld *physX)
void sync(float deltaTime, QHash< QQuick3DNode *, QMatrix4x4 > &transformCache) override
physx::PxTransform getGlobalPose() override
physx::PxD6Motion::Enum toPxEnum(QD6Joint::Motion val)
Definition qd6joint.cpp:278
DebugDrawBodyType
#define QT_BEGIN_NAMESPACE
#define QT_END_NAMESPACE
static constexpr PhysicsMaterialProperties none()