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
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
5
7
9
11{
12 m_vertices.clear();
13 m_normals.clear();
14}
15
17 const QVector3D &normal)
18{
19 m_vertices.append(start);
20 m_vertices.append(end);
21 m_normals.append(normal);
22}
23
25{
27 const int size = m_normals.count();
28 output.resize(4 * 4 * sizeof(float) * size);
29
30 float *data = reinterpret_cast<float *>(output.data());
31
32 for (int i = 0; i < size; ++i) {
33 const QVector3D &start = m_vertices[i * 2];
34 const QVector3D &end = m_vertices[i * 2 + 1];
35 const QVector3D &normal = m_normals[i];
36
37 data[0] = start.x();
38 data[1] = start.y();
39 data[2] = start.z();
40 data[4] = 1.0f;
41
42 data[5] = normal.x();
43 data[6] = normal.y();
44 data[7] = normal.z();
45 data[8] = 0.0f;
46
47 data += 8;
48 data[0] = end.x();
49 data[1] = end.y();
50 data[2] = end.z();
51 data[4] = 1.0f;
52
53 data[5] = normal.x();
54 data[6] = normal.y();
55 data[7] = normal.z();
56 data[8] = 0.0f;
57
58 data += 8;
59 }
60
61 return output;
62}
63
\inmodule QtCore
Definition qbytearray.h:57
void addLine(const QVector3D &start, const QVector3D &end, const QVector3D &normal=QVector3D(0, 0, 1))
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
constexpr float y() const noexcept
Returns the y coordinate of this point.
Definition qvectornd.h:671
constexpr float x() const noexcept
Returns the x coordinate of this point.
Definition qvectornd.h:670
constexpr float z() const noexcept
Returns the z coordinate of this point.
Definition qvectornd.h:672
Combined button and popup list for selecting options.
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLuint end
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint start
QT_BEGIN_NAMESPACE typedef uchar * output