62QSSGRenderGeometry::Attribute QSSGRenderGeometry::attribute(
int idx)
const
65 const auto &mattr = m_meshData.m_attributes[idx];
66 attr.offset = mattr.offset;
67 attr.semantic = mattr.semantic;
68 attr.componentType = mattr.componentType;
72void QSSGRenderGeometry::addAttribute(QSSGMesh::RuntimeMeshData::Attribute::Semantic semantic,
74 QSSGMesh::Mesh::ComponentType componentType)
77 attr.semantic = semantic;
79 attr.componentType = componentType;
83void QSSGRenderGeometry::addAttribute(
const Attribute &att)
85 const int index = m_meshData.m_attributeCount;
86 if (index == QSSGMesh::RuntimeMeshData::MAX_ATTRIBUTES) {
87 qWarning(
"Maximum number (%d) of vertex attributes in custom geometry has been reached; ignoring extra attributes",
88 QSSGMesh::RuntimeMeshData::MAX_ATTRIBUTES);
91 m_meshData.m_attributes[index].semantic
92 =
static_cast<QSSGMesh::RuntimeMeshData::Attribute::Semantic>(att.semantic);
93 m_meshData.m_attributes[index].offset = att.offset;
94 m_meshData.m_attributes[index].componentType = att.componentType;
95 ++m_meshData.m_attributeCount;
99void QSSGRenderGeometry::addTargetAttribute(quint32 targetId,
100 QSSGMesh::RuntimeMeshData::Attribute::Semantic semantic,
104 TargetAttribute tAttr;
105 tAttr.targetId = targetId;
106 tAttr.attr.semantic = semantic;
107 tAttr.attr.offset = offset;
108 tAttr.stride = stride;
109 addTargetAttribute(tAttr);
112void QSSGRenderGeometry::addTargetAttribute(
const TargetAttribute &att)
114 const int index = m_meshData.m_targetAttributeCount;
115 if (index == QSSGMesh::RuntimeMeshData::MAX_TARGET_ATTRIBUTES) {
116 qWarning(
"Maximum number (%d) of morph target attributes in custom geometry has been reached; ignoring extra attributes",
117 QSSGMesh::RuntimeMeshData::MAX_TARGET_ATTRIBUTES);
120 m_meshData.m_targetAttributes[index].attr.semantic
121 =
static_cast<QSSGMesh::RuntimeMeshData::Attribute::Semantic>(att.attr.semantic);
122 m_meshData.m_targetAttributes[index].attr.offset = att.attr.offset;
123 m_meshData.m_targetAttributes[index].targetId = att.targetId;
124 m_meshData.m_targetAttributes[index].stride = att.stride;
125 ++m_meshData.m_targetAttributeCount;
129void QSSGRenderGeometry::addSubset(quint32 offset, quint32 count,
const QVector3D &boundsMin,
const QVector3D &boundsMax,
const QString &name)
131 m_meshData.m_subsets.append({name, {boundsMin, boundsMax}, count, offset, {}, {}});