1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QSSGMESHBVH_H
5#define QSSGMESHBVH_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 <QtQuick3DUtils/private/qtquick3dutilsglobal_p.h>
19#include <QtQuick3DUtils/private/qssgbounds3_p.h>
20
21#include <QtGui/QVector2D>
22#include <QtCore/QVector>
23
24QT_BEGIN_NAMESPACE
25
26struct Q_QUICK3DUTILS_EXPORT QSSGMeshBVHNode {
27 ~QSSGMeshBVHNode() {
28 delete left;
29 delete right;
30 }
31
32 // Internal
33 QSSGMeshBVHNode *left = nullptr;
34 QSSGMeshBVHNode *right = nullptr;
35 QSSGBounds3 boundingData;
36 //splitAxis
37
38 // Leaf
39 int offset = 0;
40 int count = 0;
41};
42
43struct Q_QUICK3DUTILS_EXPORT QSSGMeshBVHTriangle {
44 QSSGBounds3 bounds;
45 QVector3D vertex1;
46 QVector3D vertex2;
47 QVector3D vertex3;
48 QVector2D uvCoord1;
49 QVector2D uvCoord2;
50 QVector2D uvCoord3;
51};
52
53struct Q_QUICK3DUTILS_EXPORT QSSGMeshBVH
54{
55 QSSGMeshBVH(const QVector<QSSGMeshBVHNode *> &bvhRoots,
56 const QVector<QSSGMeshBVHTriangle *> &bvhTriangles)
57 : roots(bvhRoots)
58 , triangles(bvhTriangles)
59 {}
60 ~QSSGMeshBVH();
61
62 QVector<QSSGMeshBVHNode *> roots;
63 QVector<QSSGMeshBVHTriangle *> triangles;
64};
65
66QT_END_NAMESPACE
67
68#endif // QSSGMESHBVH_H
69

source code of qtquick3d/src/utils/qssgmeshbvh_p.h