1 | // Copyright (C) 2021 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef CAPSULESHAPE_H |
5 | #define CAPSULESHAPE_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 <QtQml/QQmlEngine> |
21 | |
22 | namespace physx { |
23 | class PxCapsuleGeometry; |
24 | } |
25 | |
26 | QT_BEGIN_NAMESPACE |
27 | |
28 | class Q_QUICK3DPHYSICS_EXPORT QCapsuleShape : public QAbstractCollisionShape |
29 | { |
30 | Q_OBJECT |
31 | QML_NAMED_ELEMENT(CapsuleShape) |
32 | Q_PROPERTY(float diameter READ diameter WRITE setDiameter NOTIFY diameterChanged) |
33 | Q_PROPERTY(float height READ height WRITE setHeight NOTIFY heightChanged) |
34 | public: |
35 | QCapsuleShape(); |
36 | ~QCapsuleShape(); |
37 | |
38 | float diameter() const; |
39 | void setDiameter(float newDiameter); |
40 | |
41 | float height() const; |
42 | void setHeight(float newHeight); |
43 | |
44 | physx::PxGeometry *getPhysXGeometry() override; |
45 | bool isStaticShape() const override { return false; } |
46 | |
47 | Q_SIGNALS: |
48 | void diameterChanged(); |
49 | void heightChanged(); |
50 | |
51 | private: |
52 | void updatePhysXGeometry(); |
53 | physx::PxCapsuleGeometry *m_physXGeometry = nullptr; |
54 | float m_diameter = 100.0f; |
55 | float m_height = 100.0f; |
56 | }; |
57 | |
58 | QT_END_NAMESPACE |
59 | |
60 | #endif // CAPSULESHAPE_H |
61 | |