1 | // Copyright (C) 2021 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef ABSTRACTCOLLISIONSHAPE_H |
5 | #define ABSTRACTCOLLISIONSHAPE_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 <QtQuick3DPhysics/qtquick3dphysicsglobal.h> |
19 | #include <QtQuick3D/private/qquick3dnode_p.h> |
20 | #include <QtQml/QQmlEngine> |
21 | |
22 | namespace physx { |
23 | class PxGeometry; |
24 | } |
25 | |
26 | QT_BEGIN_NAMESPACE |
27 | |
28 | class Q_QUICK3DPHYSICS_EXPORT QAbstractCollisionShape : public QQuick3DNode |
29 | { |
30 | Q_OBJECT |
31 | Q_PROPERTY(bool enableDebugDraw READ enableDebugDraw WRITE setEnableDebugDraw NOTIFY |
32 | enableDebugDrawChanged) |
33 | QML_NAMED_ELEMENT(CollisionShape) |
34 | QML_UNCREATABLE("abstract interface" ) |
35 | public: |
36 | explicit QAbstractCollisionShape(QQuick3DNode *parent = nullptr); |
37 | virtual ~QAbstractCollisionShape(); |
38 | |
39 | virtual physx::PxGeometry *getPhysXGeometry() = 0; |
40 | bool enableDebugDraw() const; |
41 | |
42 | virtual bool isStaticShape() const = 0; |
43 | |
44 | public slots: |
45 | void setEnableDebugDraw(bool enableDebugDraw); |
46 | |
47 | signals: |
48 | void enableDebugDrawChanged(bool enableDebugDraw); |
49 | void needsRebuild(QObject *); |
50 | |
51 | protected: |
52 | bool m_scaleDirty = true; |
53 | QVector3D m_prevScale; |
54 | |
55 | private slots: |
56 | void handleScaleChange(); |
57 | |
58 | private: |
59 | bool m_enableDebugDraw = false; |
60 | }; |
61 | |
62 | QT_END_NAMESPACE |
63 | |
64 | #endif // ABSTRACTCOLLISIONSHAPE_H |
65 | |