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
28QT_BEGIN_NAMESPACE
29
30class QSSGRenderBuffer;
31
32class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderGeometry : public QSSGRenderGraphObject
33{
34public:
35 struct Attribute {
36 QSSGMesh::RuntimeMeshData::Attribute::Semantic semantic = QSSGMesh::RuntimeMeshData::Attribute::PositionSemantic;
37 int offset = -1;
38 QSSGMesh::Mesh::ComponentType componentType = QSSGMesh::Mesh::ComponentType::Float32;
39 };
40 struct TargetAttribute {
41 quint32 targetId = 0;
42 Attribute attr;
43 int stride = 0;
44 };
45 struct IndirectDraw {
46 bool enabled = false;
47 QSSGRenderBuffer *buffer = nullptr;
48 quint32 offset = 0;
49 quint32 drawCount = 1;
50 quint32 stride = 16;
51 };
52
53 explicit QSSGRenderGeometry();
54 virtual ~QSSGRenderGeometry();
55
56 const QByteArray &vertexBuffer() const;
57 QByteArray &vertexBuffer();
58 const QByteArray &indexBuffer() const;
59 QByteArray &indexBuffer();
60 int attributeCount() const;
61 Attribute attribute(int idx) const;
62 QSSGMesh::Mesh::DrawMode primitiveType() const;
63 QVector3D boundsMin() const;
64 QVector3D boundsMax() const;
65 int stride() const;
66 int targetStride() const;
67
68 void setVertexData(const QByteArray &data);
69 void setIndexData(const QByteArray &data);
70 void setStride(int stride);
71 void setBounds(const QVector3D &min, const QVector3D &max);
72 void setPrimitiveType(QSSGMesh::Mesh::DrawMode type);
73
74 void addAttribute(QSSGMesh::RuntimeMeshData::Attribute::Semantic semantic,
75 int offset,
76 QSSGMesh::Mesh::ComponentType componentType);
77 void addAttribute(const Attribute &att);
78 void addSubset(quint32 offset, quint32 count, const QVector3D &boundsMin, const QVector3D &boundsMax, const QString &name = {});
79
80 void clear();
81 void clearAttributes();
82
83 uint32_t generationId() const;
84 const QSSGMesh::RuntimeMeshData &meshData() const;
85
86 QString debugObjectName;
87
88 void clearVertexAndIndex();
89 void clearTarget();
90 void setTargetData(const QByteArray &data);
91 void addTargetAttribute(quint32 targetId,
92 QSSGMesh::RuntimeMeshData::Attribute::Semantic semantic,
93 int offset,
94 int stride = 0);
95 void addTargetAttribute(const TargetAttribute &att);
96
97 const IndirectDraw &indirectDraw() const { return m_indirectDraw; }
98 void setIndirectDraw(const IndirectDraw &indirectDraw) { m_indirectDraw = indirectDraw; }
99
100protected:
101 Q_DISABLE_COPY(QSSGRenderGeometry)
102
103 void markDirty();
104
105 uint32_t m_generationId = 1;
106 QSSGMesh::RuntimeMeshData m_meshData;
107 QSSGBounds3 m_bounds;
108 IndirectDraw m_indirectDraw;
109};
110
111QT_END_NAMESPACE
112
113#endif // QSSG_GEOMETRY_H