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
4#ifndef ABSTRACTPHYSXNODE_H
5#define ABSTRACTPHYSXNODE_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 "foundation/PxTransform.h"
19#include "qtconfigmacros.h"
20
21#include <QVector>
22
23namespace physx {
24class PxMaterial;
25class PxShape;
26}
27
29
30class QAbstractPhysicsNode;
31class QMatrix4x4;
32class QQuick3DNode;
33class QPhysicsWorld;
34class QPhysicsMaterial;
35class QPhysXWorld;
36
37// Used for debug drawing
46
47/*
48 NOTE
49 The inheritance hierarchy is not ideal, since both controller and rigid body have materials,
50 but trigger doesn't. AND both trigger and rigid body have actors, but controller doesn't.
51
52 TODO: defaultMaterial isn't used for rigid bodies, since they always create their own
53 QPhysicsMaterial with default values. We should only have a qt material when set explicitly.
54*/
55
57{
58public:
59 QAbstractPhysXNode(QAbstractPhysicsNode *node);
60 virtual ~QAbstractPhysXNode();
61
62 bool cleanupIfRemoved(QPhysXWorld *physX); // TODO rename??
63
64 virtual void init(QPhysicsWorld *world, QPhysXWorld *physX) = 0;
65 virtual void updateDefaultDensity(float density);
66 virtual void createMaterial(QPhysXWorld *physX);
67 void createMaterialFromQtMaterial(QPhysXWorld *physX, QPhysicsMaterial *qtMaterial);
68 virtual void markDirtyShapes();
69 virtual void rebuildDirtyShapes(QPhysicsWorld *, QPhysXWorld *);
70 virtual void updateFilters();
71
72 virtual void sync(float deltaTime, QHash<QQuick3DNode *, QMatrix4x4> &transformCache) = 0;
73 virtual void cleanup(QPhysXWorld *);
74 virtual bool debugGeometryCapability();
76
77 virtual bool useTriggerFlag();
79
80 bool shapesDirty() const;
81 void setShapesDirty(bool dirty);
82
83 bool filtersDirty() const;
84 void setFiltersDirty(bool dirty);
85
87 physx::PxMaterial *material = nullptr;
88 QAbstractPhysicsNode *frontendNode = nullptr;
89 bool isRemoved = false;
90 static physx::PxMaterial *sDefaultMaterial;
91};
92
94
95#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
static physx::PxMaterial * sDefaultMaterial
QAbstractPhysXNode(QAbstractPhysicsNode *node)
virtual void rebuildDirtyShapes(QPhysicsWorld *, QPhysXWorld *)
void setShapesDirty(bool dirty)
virtual bool debugGeometryCapability()
virtual void updateFilters()
void createMaterialFromQtMaterial(QPhysXWorld *physX, QPhysicsMaterial *qtMaterial)
virtual physx::PxTransform getGlobalPose()
virtual void init(QPhysicsWorld *world, QPhysXWorld *physX)=0
virtual void markDirtyShapes()
virtual DebugDrawBodyType getDebugDrawBodyType()
void setFiltersDirty(bool dirty)
virtual void createMaterial(QPhysXWorld *physX)
bool cleanupIfRemoved(QPhysXWorld *physX)
virtual bool useTriggerFlag()
#define PHYSX_RELEASE(x)
DebugDrawBodyType
#define QT_BEGIN_NAMESPACE
#define QT_END_NAMESPACE
static StaticPhysXObjects & getReference()