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#include <qobject.h>
24
25namespace physx {
26class PxMaterial;
27class PxShape;
28}
29
31
32class QAbstractPhysicsNode;
33class QMatrix4x4;
34class QQuick3DNode;
35class QPhysicsWorld;
36class QPhysicsMaterial;
37class QPhysXWorld;
38
39// Used for debug drawing
48
49/*
50 NOTE
51 The inheritance hierarchy is not ideal, since both controller and rigid body have materials,
52 but trigger doesn't. AND both trigger and rigid body have actors, but controller doesn't.
53
54 TODO: defaultMaterial isn't used for rigid bodies, since they always create their own
55 QPhysicsMaterial with default values. We should only have a qt material when set explicitly.
56*/
57
59{
61public:
63 virtual ~QAbstractPhysXNode();
64
65 bool cleanupIfRemoved(QPhysXWorld *physX); // TODO rename??
66
67 virtual void init(QPhysicsWorld *world, QPhysXWorld *physX) = 0;
68 virtual void updateDefaultDensity(float density);
69 virtual void createMaterial(QPhysXWorld *physX);
70 void createMaterialFromQtMaterial(QPhysXWorld *physX, QPhysicsMaterial *qtMaterial);
71 virtual void markDirtyShapes();
72 virtual void rebuildDirtyShapes(QPhysicsWorld *, QPhysXWorld *);
73 virtual void updateFilters();
74
75 virtual void sync(float deltaTime, QHash<QQuick3DNode *, QMatrix4x4> &transformCache) = 0;
76 virtual void cleanup(QPhysXWorld *);
77 virtual bool debugGeometryCapability();
78 virtual physx::PxTransform getGlobalPose();
79
80 virtual bool useTriggerFlag();
82
83 bool shapesDirty() const;
84 void setShapesDirty(bool dirty);
85
86 bool filtersDirty() const;
87 void setFiltersDirty(bool dirty);
88
90 physx::PxMaterial *material = nullptr;
91 QAbstractPhysicsNode *frontendNode = nullptr;
92 bool isRemoved = false;
93 static physx::PxMaterial *sDefaultMaterial;
94};
95
97
98#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
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()
Definition qlist.h:81
void markDirtyShapes() override
void buildShapes(QPhysXWorld *physX)
void rebuildDirtyShapes(QPhysicsWorld *world, QPhysXWorld *physX) override
void init(QPhysicsWorld *world, QPhysXWorld *physX) 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
void updateFilters() override
physx::PxTransform getGlobalPose() override
Combined button and popup list for selecting options.
DebugDrawBodyType
#define QML_UNCREATABLE(REASON)
#define QML_PRIVATE_NAMESPACE
#define QML_NAMED_ELEMENT(NAME)
void qmlRegisterTypesAndRevisions(const char *uri, int versionMajor, QList< int > *qmlTypeIds=nullptr)
Definition qqml.h:939
#define QML_FOREIGN(FOREIGN_TYPE)
#define QT_BEGIN_NAMESPACE
#define QT_END_NAMESPACE
#define QT_ANNOTATE_FUNCTION(x)
#define QT_ANNOTATE_CLASS2(type, a1, a2)
#define Q_PROPERTY(...)
#define Q_GADGET_EXPORT(...)
#define Q_OBJECT
#define Q_REVISION(...)
#define Q_CLASSINFO(name, value)
#define QT_ANNOTATE_CLASS(type,...)
#define Q_OBJECT_NO_ATTRIBUTES_WARNING
#define QT_META_OBJECT_VARS
#define Q_INTERFACES(x)
#define QT_TR_FUNCTIONS
#define QT_ANNOTATE_ACCESS_SPECIFIER(x)
#define QT_OBJECT_GADGET_COMMON
#define Q_SLOTS
#define Q_OBJECT_NO_OVERRIDE_WARNING
#define signals
#define Q_SIGNALS
#define Q_ENUM_IMPL(ENUM)
#define Q_ENUM_NS_IMPL(ENUM)
#define emit
#define Q_NAMESPACE_EXPORT(...)