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
qssgrendergeometry_p.h
Go to the documentation of this file.
1// Copyright (C) 2019 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 QSSG_RENDER_GEOMETRY_H
7#define QSSG_RENDER_GEOMETRY_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QtQuick3DRuntimeRender/private/qssgrendergraphobject_p.h>
21#include <QtQuick3DRuntimeRender/private/qssgrendernode_p.h>
22#include <QtQuick3DRuntimeRender/private/qssgrendermesh_p.h>
23#include <QtQuick3DRuntimeRender/private/qssgrendererutil_p.h>
24#include <QtQuick3DUtils/private/qssgmesh_p.h>
25
26#include <QtCore/qbytearray.h>
27
29
30class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderGeometry : public QSSGRenderGraphObject
31{
32public:
33 struct Attribute {
34 QSSGMesh::RuntimeMeshData::Attribute::Semantic semantic = QSSGMesh::RuntimeMeshData::Attribute::PositionSemantic;
35 int offset = -1;
36 QSSGMesh::Mesh::ComponentType componentType = QSSGMesh::Mesh::ComponentType::Float32;
37 };
38 struct TargetAttribute {
39 quint32 targetId = 0;
40 Attribute attr;
41 int stride = 0;
42 };
43
44 explicit QSSGRenderGeometry();
45 virtual ~QSSGRenderGeometry();
46
47 const QByteArray &vertexBuffer() const;
48 QByteArray &vertexBuffer();
49 const QByteArray &indexBuffer() const;
50 QByteArray &indexBuffer();
51 int attributeCount() const;
52 Attribute attribute(int idx) const;
53 QSSGMesh::Mesh::DrawMode primitiveType() const;
54 QVector3D boundsMin() const;
55 QVector3D boundsMax() const;
56 int stride() const;
57 int targetStride() const;
58
59 void setVertexData(const QByteArray &data);
60 void setIndexData(const QByteArray &data);
61 void setStride(int stride);
62 void setBounds(const QVector3D &min, const QVector3D &max);
63 void setPrimitiveType(QSSGMesh::Mesh::DrawMode type);
64
65 void addAttribute(QSSGMesh::RuntimeMeshData::Attribute::Semantic semantic,
66 int offset,
67 QSSGMesh::Mesh::ComponentType componentType);
68 void addAttribute(const Attribute &att);
69 void addSubset(quint32 offset, quint32 count, const QVector3D &boundsMin, const QVector3D &boundsMax, const QString &name = {});
70
71 void clear();
72 void clearAttributes();
73
74 uint32_t generationId() const;
75 const QSSGMesh::RuntimeMeshData &meshData() const;
76
77 QString debugObjectName;
78
79 void clearVertexAndIndex();
80 void clearTarget();
81 void setTargetData(const QByteArray &data);
82 void addTargetAttribute(quint32 targetId,
83 QSSGMesh::RuntimeMeshData::Attribute::Semantic semantic,
84 int offset,
85 int stride = 0);
86 void addTargetAttribute(const TargetAttribute &att);
87
88protected:
89 Q_DISABLE_COPY(QSSGRenderGeometry)
90
91 void markDirty();
92
93 uint32_t m_generationId = 1;
94 QSSGMesh::RuntimeMeshData m_meshData;
95 QSSGBounds3 m_bounds;
96};
97
98QT_END_NAMESPACE
99
100#endif // QSSG_GEOMETRY_H