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

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