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
proceduralmesh_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the Qt API. It exists purely as an
9// implementation detail. This header file may change from version to
10// version without notice, or even be removed.
11//
12// We mean it.
13//
14
15#ifndef PROCEDURALMESH_H
16#define PROCEDURALMESH_H
17
18#include <QQuick3DGeometry>
19#include <QQmlEngine>
20#include <QList>
21#include <QVector3D>
22
24
27 Q_PROPERTY(unsigned int offset READ offset WRITE setOffset NOTIFY offsetChanged FINAL)
28 Q_PROPERTY(unsigned int count READ count WRITE setCount NOTIFY countChanged FINAL)
29 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged FINAL)
32
33public:
34 int offset() const;
35 void setOffset(int newOffset);
36
37 int count() const;
38 void setCount(int newCount);
39
40 QString name() const;
41 void setName(const QString &newName);
46 void isDirty();
47
49 int m_offset = 0;
50 int m_count = 0;
51 QString m_name;
52};
53
55{
57 Q_PROPERTY(QList<QVector3D> positions READ positions WRITE setPositions NOTIFY positionsChanged FINAL)
58 Q_PROPERTY(QList<QVector3D> normals READ normals WRITE setNormals NOTIFY normalsChanged FINAL)
59 Q_PROPERTY(QList<QVector3D> tangents READ tangents WRITE setTangents NOTIFY tangentsChanged FINAL)
60 Q_PROPERTY(QList<QVector3D> binormals READ binormals WRITE setBinormals NOTIFY binormalsChanged FINAL)
61 Q_PROPERTY(QList<QVector2D> uv0s READ uv0s WRITE setUv0s NOTIFY uv0sChanged FINAL)
62 Q_PROPERTY(QList<QVector2D> uv1s READ uv1s WRITE setUv1s NOTIFY uv1sChanged FINAL)
63 Q_PROPERTY(QList<QVector4D> colors READ colors WRITE setColors NOTIFY colorsChanged FINAL)
64 Q_PROPERTY(QList<QVector4D> joints READ joints WRITE setJoints NOTIFY jointsChanged FINAL)
65 Q_PROPERTY(QList<QVector4D> weights READ weights WRITE setWeights NOTIFY weightsChanged FINAL)
66 Q_PROPERTY(QList<unsigned int> indexes READ indexes WRITE setIndexes NOTIFY indexesChanged FINAL)
68 Q_PROPERTY(PrimitiveMode primitiveMode READ primitiveMode WRITE setPrimitiveMode NOTIFY primitiveModeChanged FINAL)
71public:
80 Q_ENUM(PrimitiveMode)
81
83 QList<QVector3D> positions() const;
84 void setPositions(const QList<QVector3D> &newPositions);
85 PrimitiveMode primitiveMode() const;
86 void setPrimitiveMode(PrimitiveMode newPrimitiveMode);
87
88 QList<unsigned int> indexes() const;
89 void setIndexes(const QList<unsigned int> &newIndexes);
90
91 QList<QVector3D> normals() const;
92 void setNormals(const QList<QVector3D> &newNormals);
93
94 QList<QVector3D> tangents() const;
95 void setTangents(const QList<QVector3D> &newTangents);
96
97 QList<QVector3D> binormals() const;
98 void setBinormals(const QList<QVector3D> &newBinormals);
99
100 QList<QVector2D> uv0s() const;
101 void setUv0s(const QList<QVector2D> &newUv0s);
102
103 QList<QVector2D> uv1s() const;
104 void setUv1s(const QList<QVector2D> &newUv1s);
105
106 QList<QVector4D> colors() const;
107 void setColors(const QList<QVector4D> &newColors);
108
109 QList<QVector4D> joints() const;
110 void setJoints(const QList<QVector4D> &newJoints);
111
112 QList<QVector4D> weights() const;
113 void setWeights(const QList<QVector4D> &newWeights);
114
115 QQmlListProperty<ProceduralMeshSubset> subsets();
116
129
130private Q_SLOTS:
131 void requestUpdate();
132 void updateGeometry();
133 void subsetDestroyed(QObject *subset);
134
135private:
136 bool supportsTriangleFanPrimitive() const;
137
138 static void qmlAppendProceduralMeshSubset(QQmlListProperty<ProceduralMeshSubset> *list, ProceduralMeshSubset *subset);
139 static ProceduralMeshSubset *qmlProceduralMeshSubsetAt(QQmlListProperty<ProceduralMeshSubset> *list, qsizetype index);
140 static qsizetype qmlProceduralMeshSubsetCount(QQmlListProperty<ProceduralMeshSubset> *list);
141 static void qmlClearProceduralMeshSubset(QQmlListProperty<ProceduralMeshSubset> *list);
142
143 bool m_updateRequested = false;
144 PrimitiveMode m_primitiveMode = Triangles;
145 QList<QVector3D> m_positions;
146 QList<unsigned int> m_indexes;
147 QList<QVector3D> m_normals;
148 QList<QVector3D> m_tangents;
149 QList<QVector3D> m_binormals;
150 QList<QVector2D> m_uv0s;
151 QList<QVector2D> m_uv1s;
152 QList<QVector4D> m_colors;
153 QList<QVector4D> m_joints;
154 QList<QVector4D> m_weights;
155 QList<ProceduralMeshSubset *> m_subsets;
156};
157
159
160#endif // PROCEDURALMESH_H
void setCount(int newCount)
void setOffset(int newOffset)
void setName(const QString &newName)
void colorsChanged()
void weightsChanged()
void uv1sChanged()
void jointsChanged()
void primitiveModeChanged()
void positionsChanged()
void binormalsChanged()
void normalsChanged()
QQmlListProperty< ProceduralMeshSubset > subsets()
void uv0sChanged()
void indexesChanged()
void tangentsChanged()
Definition qlist.h:75
\inmodule QtCore
Definition qobject.h:103
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
Definition qqmllist.h:24
\qmltype Geometry \inherits Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DGeometry
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QVector2D class represents a vector or vertex in 2D space.
Definition qvectornd.h:31
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
The QVector4D class represents a vector or vertex in 4D space.
Definition qvectornd.h:330
Combined button and popup list for selecting options.
static const QCssKnownValue positions[NumKnownPositionModes - 1]
GLuint index
[2]
GLsizei const GLuint const GLfloat * weights
GLenum GLenum GLsizei count
GLenum GLuint GLintptr offset
GLuint name
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define QML_ELEMENT
static QT_BEGIN_NAMESPACE const QRgb colors[][14]
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
ptrdiff_t qsizetype
Definition qtypes.h:165
QList< int > list
[14]