64QSSGRenderGeometry::Attribute QSSGRenderGeometry::attribute(
int idx)
const
67 const auto &mattr = m_meshData.m_attributes[idx];
68 attr.offset = mattr.offset;
69 attr.semantic = mattr.semantic;
70 attr.componentType = mattr.componentType;
74void QSSGRenderGeometry::addAttribute(QSSGMesh::RuntimeMeshData::Attribute::Semantic semantic,
76 QSSGMesh::Mesh::ComponentType componentType)
79 attr.semantic = semantic;
81 attr.componentType = componentType;
85void QSSGRenderGeometry::addAttribute(
const Attribute &att)
87 const int index = m_meshData.m_attributeCount;
88 if (index == QSSGMesh::RuntimeMeshData::MAX_ATTRIBUTES) {
89 qWarning(
"Maximum number (%d) of vertex attributes in custom geometry has been reached; ignoring extra attributes",
90 QSSGMesh::RuntimeMeshData::MAX_ATTRIBUTES);
93 m_meshData.m_attributes[index].semantic
94 =
static_cast<QSSGMesh::RuntimeMeshData::Attribute::Semantic>(att.semantic);
95 m_meshData.m_attributes[index].offset = att.offset;
96 m_meshData.m_attributes[index].componentType = att.componentType;
97 ++m_meshData.m_attributeCount;
101void QSSGRenderGeometry::addTargetAttribute(quint32 targetId,
102 QSSGMesh::RuntimeMeshData::Attribute::Semantic semantic,
106 TargetAttribute tAttr;
107 tAttr.targetId = targetId;
108 tAttr.attr.semantic = semantic;
109 tAttr.attr.offset = offset;
110 tAttr.stride = stride;
111 addTargetAttribute(tAttr);
114void QSSGRenderGeometry::addTargetAttribute(
const TargetAttribute &att)
116 const int index = m_meshData.m_targetAttributeCount;
117 if (index == QSSGMesh::RuntimeMeshData::MAX_TARGET_ATTRIBUTES) {
118 qWarning(
"Maximum number (%d) of morph target attributes in custom geometry has been reached; ignoring extra attributes",
119 QSSGMesh::RuntimeMeshData::MAX_TARGET_ATTRIBUTES);
122 m_meshData.m_targetAttributes[index].attr.semantic
123 =
static_cast<QSSGMesh::RuntimeMeshData::Attribute::Semantic>(att.attr.semantic);
124 m_meshData.m_targetAttributes[index].attr.offset = att.attr.offset;
125 m_meshData.m_targetAttributes[index].targetId = att.targetId;
126 m_meshData.m_targetAttributes[index].stride = att.stride;
127 ++m_meshData.m_targetAttributeCount;
131void QSSGRenderGeometry::addSubset(quint32 offset, quint32 count,
const QVector3D &boundsMin,
const QVector3D &boundsMax,
const QString &name)
133 m_meshData.m_subsets.append({name, {boundsMin, boundsMax}, count, offset, {}, {}});