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
22namespace physx {
23class PxGeometry;
24}
25
26QT_BEGIN_NAMESPACE
27
28class 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")
35public:
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
44public slots:
45 void setEnableDebugDraw(bool enableDebugDraw);
46
47signals:
48 void enableDebugDrawChanged(bool enableDebugDraw);
49 void needsRebuild(QObject *);
50
51protected:
52 bool m_scaleDirty = true;
53 QVector3D m_prevScale;
54
55private slots:
56 void handleScaleChange();
57
58private:
59 bool m_enableDebugDraw = false;
60};
61
62QT_END_NAMESPACE
63
64#endif // ABSTRACTCOLLISIONSHAPE_H
65

source code of qtquick3dphysics/src/quick3dphysics/qabstractcollisionshape_p.h