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
qssgrendergeometry.cpp
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
5#include "qssgrendermesh_p.h"
7
12
16
21
26
31
36
41
46
51
53{
54 return m_meshData.m_stride;
55}
56
61
63{
64 Attribute attr;
65 const auto &mattr = m_meshData.m_attributes[idx];
66 attr.offset = mattr.offset;
67 attr.semantic = mattr.semantic;
68 attr.componentType = mattr.componentType;
69 return attr;
70}
71
73 int offset,
75{
76 Attribute attr;
77 attr.semantic = semantic;
78 attr.offset = offset;
79 attr.componentType = componentType;
80 addAttribute(attr);
81}
82
84{
87 qWarning("Maximum number (%d) of vertex attributes in custom geometry has been reached; ignoring extra attributes",
89 return;
90 }
96 markDirty();
97}
98
101 int offset,
102 int stride)
103{
104 TargetAttribute tAttr;
105 tAttr.targetId = targetId;
106 tAttr.attr.semantic = semantic;
107 tAttr.attr.offset = offset;
108 tAttr.stride = stride;
109 addTargetAttribute(tAttr);
110}
111
128
129void QSSGRenderGeometry::addSubset(quint32 offset, quint32 count, const QVector3D &boundsMin, const QVector3D &boundsMax, const QString &name)
130{
131 m_meshData.m_subsets.append({name, {boundsMin, boundsMax}, count, offset, {}, {}});
132}
133
139
145
147{
148 m_bounds = QSSGBounds3(min, max);
149 markDirty();
150}
151
159
166
167
173
178
180{
181 return m_generationId;
182}
183
188
194
200
206
\inmodule QtCore
Definition qbytearray.h:57
Class representing 3D range or axis aligned bounding box.
Q_ALWAYS_INLINE void setEmpty()
Sets empty to true.
QVector3D minimum
QVector3D maximum
Attribute attribute(int idx) const
void setBounds(const QVector3D &min, const QVector3D &max)
void setStride(int stride)
void addAttribute(QSSGMesh::RuntimeMeshData::Attribute::Semantic semantic, int offset, QSSGMesh::Mesh::ComponentType componentType)
const QSSGMesh::RuntimeMeshData & meshData() const
void setVertexData(const QByteArray &data)
void setPrimitiveType(QSSGMesh::Mesh::DrawMode type)
void addSubset(quint32 offset, quint32 count, const QVector3D &boundsMin, const QVector3D &boundsMax, const QString &name={})
void setIndexData(const QByteArray &data)
uint32_t generationId() const
QVector3D boundsMin() const
void setTargetData(const QByteArray &data)
const QByteArray & indexBuffer() const
void addTargetAttribute(quint32 targetId, QSSGMesh::RuntimeMeshData::Attribute::Semantic semantic, int offset, int stride=0)
const QByteArray & vertexBuffer() const
QSSGMesh::RuntimeMeshData m_meshData
QVector3D boundsMax() const
QSSGMesh::Mesh::DrawMode primitiveType() const
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
#define qWarning
Definition qlogging.h:166
GLuint index
[2]
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
const void GLsizei GLsizei stride
GLenum type
GLenum GLuint GLintptr offset
GLuint name
QSSGRenderComponentType
unsigned int quint32
Definition qtypes.h:50
QVector< Mesh::Subset > m_subsets
Definition qssgmesh_p.h:269
TargetAttribute m_targetAttributes[MAX_TARGET_ATTRIBUTES]
Definition qssgmesh_p.h:273
Mesh::DrawMode m_primitiveType
Definition qssgmesh_p.h:275
Attribute m_attributes[MAX_ATTRIBUTES]
Definition qssgmesh_p.h:271
static const int MAX_TARGET_ATTRIBUTES
Definition qssgmesh_p.h:245
static const int MAX_ATTRIBUTES
Definition qssgmesh_p.h:244
QSSGMesh::RuntimeMeshData::Attribute::Semantic semantic
QSSGMesh::Mesh::ComponentType componentType
Definition moc.h:23