1 | // Copyright (C) 2021 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef BOXSHAPE_H |
5 | #define BOXSHAPE_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 <QtQuick3DPhysics/private/qabstractcollisionshape_p.h> |
20 | #include <QtCore/QObject> |
21 | #include <QtGui/QVector3D> |
22 | #include <QtQml/QQmlEngine> |
23 | |
24 | namespace physx { |
25 | class PxBoxGeometry; |
26 | } |
27 | |
28 | QT_BEGIN_NAMESPACE |
29 | |
30 | class Q_QUICK3DPHYSICS_EXPORT QBoxShape : public QAbstractCollisionShape |
31 | { |
32 | Q_OBJECT |
33 | Q_PROPERTY(QVector3D extents READ extents WRITE setExtents NOTIFY extentsChanged) |
34 | QML_NAMED_ELEMENT(BoxShape) |
35 | public: |
36 | QBoxShape(); |
37 | ~QBoxShape(); |
38 | |
39 | QVector3D extents() const; |
40 | |
41 | physx::PxGeometry *getPhysXGeometry() override; |
42 | bool isStaticShape() const override { return false; } |
43 | |
44 | public slots: |
45 | void setExtents(QVector3D extents); |
46 | |
47 | signals: |
48 | void extentsChanged(QVector3D extents); |
49 | |
50 | private: |
51 | void updatePhysXGeometry(); |
52 | |
53 | physx::PxBoxGeometry *m_physXGeometry = nullptr; |
54 | QVector3D m_extents = QVector3D(100, 100, 100); |
55 | }; |
56 | |
57 | QT_END_NAMESPACE |
58 | |
59 | #endif // BOXSHAPE_H |
60 | |