Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qssgmeshbvhbuilder_p.h
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QSSGMESHBVHBUILDER_H
5#define QSSGMESHBVHBUILDER_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#include <QtQuick3DUtils/private/qtquick3dutilsglobal_p.h>
18#include <QtQuick3DUtils/private/qssgmeshbvh_p.h>
19#include <QtQuick3DUtils/private/qssgmesh_p.h>
20
22
23class Q_QUICK3DUTILS_EXPORT QSSGMeshBVHBuilder
24{
25public:
27 QSSGMeshBVHBuilder(const QByteArray &vertexBuffer,
28 int stride,
29 int posOffset,
30 bool hasUV = false,
31 int uvOffset = -1,
32 bool hasIndexBuffer = false,
33 const QByteArray &indexBuffer = QByteArray(),
35
36 std::unique_ptr<QSSGMeshBVH> buildTree();
37
38private:
39 enum class Axis
40 {
41 None = -1,
42 X = 0,
43 Y = 1,
44 Z = 2
45 };
46 struct Split {
47 Axis axis;
48 float pos;
49 };
50
51 QSSGMeshBVHTriangles calculateTriangleBounds(quint32 indexOffset, quint32 indexCount) const;
52
55 static Split getOptimalSplit(const QSSGMeshBVH &bvh, const QSSGBounds3 &nodeBounds, quint32 offset, quint32 count);
56 static Axis getLongestDimension(const QSSGBounds3 &nodeBounds);
57 static float getAverageValue(const QSSGMeshBVH &bvh, quint32 offset, quint32 count, Axis axis);
58 static quint32 partition(QSSGMeshBVH &bvh, quint32 offset, quint32 count, const Split &split);
59
60 QSSGMesh::Mesh m_mesh;
61 QSSGRenderComponentType m_indexBufferComponentType;
62 QByteArray m_indexBufferData;
63 QByteArray m_vertexBufferData;
64 quint32 m_vertexStride;
65 bool m_hasPositionData = false;
66 quint32 m_vertexPosOffset;
67 bool m_hasUVData = false;
68 quint32 m_vertexUVOffset;
69 bool m_hasIndexBuffer = true;
70};
71
73
74#endif // QSSGMESHBVHBUILDER_H
\inmodule QtCore
Definition qbytearray.h:57
Class representing 3D range or axis aligned bounding box.
Combined button and popup list for selecting options.
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
static void getBounds(const QList< TTF_POINT > &points, qint16 *xmin, qint16 *xmax, qint16 *ymin, qint16 *ymax)
@ None
Definition qhash.cpp:531
GLint GLenum GLsizei GLsizei GLsizei depth
GLenum GLenum GLsizei count
const void GLsizei GLsizei stride
GLenum GLuint GLintptr offset
static void split(QT_FT_Vector *b)
std::vector< QSSGMeshBVHTriangle > QSSGMeshBVHTriangles
QSSGRenderComponentType
unsigned int quint32
Definition qtypes.h:50