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