Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qcollisiondebugmeshbuilder.cpp
Go to the documentation of this file.
1
// Copyright (C) 2021 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
"qcollisiondebugmeshbuilder_p.h"
6
7
QT_BEGIN_NAMESPACE
8
9
QCollisionDebugMeshBuilder::QCollisionDebugMeshBuilder() { }
10
11
void
QCollisionDebugMeshBuilder::reset()
12
{
13
m_vertices.clear();
14
m_normals.clear();
15
}
16
17
void
QCollisionDebugMeshBuilder::addLine(
const
QVector3D &start,
const
QVector3D &end,
18
const
QVector3D &normal)
19
{
20
m_vertices.append(start);
21
m_vertices.append(end);
22
m_normals.append(normal);
23
}
24
25
QByteArray QCollisionDebugMeshBuilder::generateVertexArray()
26
{
27
QByteArray output;
28
const
int
size = m_normals.count();
29
output.resize(4 * 4 *
sizeof
(
float
) * size);
30
31
float
*data =
reinterpret_cast
<
float
*>(output.data());
32
33
for
(
int
i = 0; i < size; ++i) {
34
const
QVector3D &start = m_vertices[i * 2];
35
const
QVector3D &end = m_vertices[i * 2 + 1];
36
const
QVector3D &normal = m_normals[i];
37
38
data[0] = start.x();
39
data[1] = start.y();
40
data[2] = start.z();
41
data[3] = 1.0f;
42
43
data[4] = normal.x();
44
data[5] = normal.y();
45
data[6] = normal.z();
46
data[7] = 0.0f;
47
48
data += 8;
49
data[0] = end.x();
50
data[1] = end.y();
51
data[2] = end.z();
52
data[3] = 1.0f;
53
54
data[4] = normal.x();
55
data[5] = normal.y();
56
data[6] = normal.z();
57
data[7] = 0.0f;
58
59
data += 8;
60
}
61
62
return
output;
63
}
64
65
QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtquick3dphysics
src
quick3dphysics
qcollisiondebugmeshbuilder.cpp
Generated on
for Qt by
1.18.0