Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquick3dgeometry.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// Qt-Security score:significant reason:default
4
5
6#ifndef Q_QUICK3D_GEOMETRY_H
7#define Q_QUICK3D_GEOMETRY_H
8
9#include <QtQuick3D/qquick3dobject.h>
10
11QT_BEGIN_NAMESPACE
12
13class QQuick3DGeometryPrivate;
14
15class Q_QUICK3D_EXPORT QQuick3DGeometry : public QQuick3DObject
16{
17 Q_OBJECT
18 Q_DECLARE_PRIVATE(QQuick3DGeometry)
19
20 QML_NAMED_ELEMENT(Geometry)
21 QML_UNCREATABLE("Geometry is Abstract")
22public:
23 explicit QQuick3DGeometry(QQuick3DObject *parent = nullptr);
24 ~QQuick3DGeometry() override;
25
26 enum class PrimitiveType {
27 Points,
28 LineStrip,
29 Lines,
30 TriangleStrip,
31 TriangleFan,
32 Triangles
33 };
34
35 struct Attribute {
36 enum Semantic {
37 IndexSemantic,
38 PositionSemantic, // attr_pos
39 NormalSemantic, // attr_norm
40 TexCoordSemantic, // attr_uv0
41 TangentSemantic, // attr_textan
42 BinormalSemantic, // attr_binormal
43 JointSemantic, // attr_joints
44 WeightSemantic, // attr_weights
45 ColorSemantic, // attr_color
46 TargetPositionSemantic, // attr_tpos0
47 TargetNormalSemantic, // attr_tnorm0
48 TargetTangentSemantic, // attr_ttan0
49 TargetBinormalSemantic, // attr_tbinorm0
50 TexCoord1Semantic, // attr_uv1
51 TexCoord0Semantic = TexCoordSemantic // for compatibility
52 };
53 enum ComponentType {
54 U16Type,
55 U32Type,
56 I32Type,
57 F32Type
58 };
59 Semantic semantic = PositionSemantic;
60 int offset = -1;
61 ComponentType componentType = F32Type;
62 };
63
64 struct TargetAttribute {
65 quint32 targetId = 0;
66 Attribute attr;
67 int stride = 0;
68 };
69
70 QByteArray vertexData() const;
71 QByteArray indexData() const;
72 int attributeCount() const;
73 Attribute attribute(int index) const;
74 PrimitiveType primitiveType() const;
75 QVector3D boundsMin() const;
76 QVector3D boundsMax() const;
77 int stride() const;
78
79 void setVertexData(const QByteArray &data);
80 void setVertexData(int offset, const QByteArray &data);
81 void setIndexData(const QByteArray &data);
82 void setIndexData(int offset, const QByteArray &data);
83 void setStride(int stride);
84 void setBounds(const QVector3D &min, const QVector3D &max);
85 void setPrimitiveType(PrimitiveType type);
86
87 void addAttribute(Attribute::Semantic semantic, int offset,
88 Attribute::ComponentType componentType);
89 void addAttribute(const Attribute &att);
90
91 Q_REVISION(6, 3) int subsetCount() const;
92 Q_REVISION(6, 3) QVector3D subsetBoundsMin(int subset) const;
93 Q_REVISION(6, 3) QVector3D subsetBoundsMax(int subset) const;
94 Q_REVISION(6, 3) int subsetOffset(int subset) const;
95 Q_REVISION(6, 3) int subsetCount(int subset) const;
96 Q_REVISION(6, 3) QString subsetName(int subset) const;
97 Q_REVISION(6, 3) void addSubset(int offset, int count, const QVector3D &boundsMin, const QVector3D &boundsMax, const QString &name = {});
98
99 Q_REVISION(6, 6) QByteArray targetData() const;
100 Q_REVISION(6, 6) void setTargetData(const QByteArray &data);
101 Q_REVISION(6, 6) void setTargetData(int offset, const QByteArray &data);
102 Q_REVISION(6, 6) TargetAttribute targetAttribute(int index) const;
103 Q_REVISION(6, 6) int targetAttributeCount() const;
104 Q_REVISION(6, 6) void addTargetAttribute(quint32 targetId,
105 Attribute::Semantic semantic, int offset,
106 int stride = 0);
107 Q_REVISION(6, 6) void addTargetAttribute(const TargetAttribute &att);
108
109 void clear();
110
111Q_SIGNALS:
112 void geometryNodeDirty();
113 Q_REVISION(6, 7) void geometryChanged();
114
115protected:
116 QSSGRenderGraphObject *updateSpatialNode(QSSGRenderGraphObject *node) override;
117 void markAllDirty() override;
118};
119
120QT_END_NAMESPACE
121
122#endif // Q_QUICK3D_GEOMETRY_H
\qmltype Geometry \inherits Object3D \inqmlmodule QtQuick3D \nativetype QQuick3DGeometry