Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qphysicsmeshutils_p_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QPHYSICSMESHUTILS_P_P_H
5#define QPHYSICSMESHUTILS_P_P_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 <QtGui/QVector3D>
20#include <QtQuick3DUtils/private/qssgmesh_p.h>
21
22namespace physx {
23class PxBoxGeometry;
24class PxConvexMesh;
25class PxConvexMeshGeometry;
26class PxTriangleMesh;
27}
28
30
32
34{
35public:
36 QQuick3DPhysicsMesh(const QString &qmlSource) : m_meshPath(qmlSource) { }
38
40
42 {
43 loadSsgMesh();
44 if (m_ssgMesh.isValid()) {
45 auto b = m_ssgMesh.subsets().constFirst().bounds;
46 return { b.min, b.max };
47 }
48 return {};
49 }
50
51 void ref() { ++refCount; }
52 int deref() { return --refCount; }
53
54 physx::PxConvexMesh *convexMesh();
55 physx::PxTriangleMesh *triangleMesh();
56
58
59private:
60 void loadSsgMesh();
61
62 QString m_meshPath;
63 QSSGMesh::Mesh m_ssgMesh;
64 int m_posOffset = 0;
65
66 physx::PxConvexMesh *m_convexMesh = nullptr;
67 physx::PxTriangleMesh *m_triangleMesh = nullptr;
68 int refCount = 0;
69};
70
72{
73public:
74 static QQuick3DPhysicsMesh *getMesh(const QUrl &source, const QObject *contextObject);
75 static void releaseMesh(QQuick3DPhysicsMesh *mesh);
76
77private:
79};
80
82
83#endif // QPHYSICSMESHUTILS_P_P_H
\inmodule QtCore
Definition qhash.h:818
Definition qlist.h:74
\inmodule QtCore
Definition qobject.h:90
\qmltype Geometry \inherits Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DGeometry
static void releaseMesh(QQuick3DPhysicsMesh *mesh)
static QQuick3DPhysicsMesh * getMesh(const QUrl &source, const QObject *contextObject)
QQuick3DPhysicsMesh(const QString &qmlSource)
physx::PxTriangleMesh * triangleMesh()
QList< QVector3D > positions()
physx::PxConvexMesh * convexMesh()
QPair< QVector3D, QVector3D > bounds()
bool isValid() const
Definition qssgmesh_p.h:116
QVector< Subset > subsets() const
Definition qssgmesh_p.h:100
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\inmodule QtCore
Definition qurl.h:94
Combined button and popup list for selecting options.
std::pair< T1, T2 > QPair
GLboolean GLboolean GLboolean b
GLsizei GLsizei GLchar * source