1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef CONVEXMESHSHAPE_H
5#define CONVEXMESHSHAPE_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
24namespace physx {
25class PxBoxGeometry;
26class PxConvexMesh;
27class PxConvexMeshGeometry;
28}
29
30QT_BEGIN_NAMESPACE
31class QQuick3DPhysicsMesh;
32
33class Q_QUICK3DPHYSICS_EXPORT QConvexMeshShape : public QAbstractCollisionShape
34{
35 Q_OBJECT
36 Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged REVISION(6, 5))
37 QML_NAMED_ELEMENT(ConvexMeshShape)
38public:
39 QConvexMeshShape();
40 ~QConvexMeshShape();
41
42 physx::PxGeometry *getPhysXGeometry() override;
43
44 Q_REVISION(6, 5) const QUrl &source() const;
45 Q_REVISION(6, 5) void setSource(const QUrl &newSource);
46 bool isStaticShape() const override { return false; }
47
48signals:
49 Q_REVISION(6, 5) void sourceChanged();
50
51private:
52 void updatePhysXGeometry();
53
54 bool m_dirtyPhysx = false;
55 physx::PxConvexMeshGeometry *m_meshGeometry = nullptr;
56 QUrl m_meshSource;
57 QQuick3DPhysicsMesh *m_mesh = nullptr;
58};
59
60QT_END_NAMESPACE
61
62#endif // CONVEXMESHSHAPE_H
63

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