Fix multiple blendshapes targeted to one model blendshape

This commit is contained in:
David Rowe 2020-08-31 11:20:56 +12:00
parent 5d02e0fe28
commit 0fcc73d5cd

View file

@ -1593,11 +1593,15 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash&
generateTargetData(target.values.value((QString) "POSITION"), weight, vertices);
}
auto blendshapeIndicesCount = blendshape.indices.count();
if (blendshape.indices.size() < prevMeshVerticesCount + vertices.size()) {
blendshape.indices.resize(prevMeshVerticesCount + vertices.size());
blendshape.vertices.resize(prevMeshVerticesCount + vertices.size());
blendshape.normals.resize(prevMeshVerticesCount + vertices.size());
}
for (int i = 0; i < vertices.size(); i++) {
blendshape.indices.push_back(blendshapeIndicesCount + i);
blendshape.vertices.push_back(vertices.value(i));
blendshape.normals.push_back(normals.value(i));
blendshape.indices[prevMeshVerticesCount + i] = prevMeshVerticesCount + i;
blendshape.vertices[prevMeshVerticesCount + i] += vertices.value(i);
blendshape.normals[prevMeshVerticesCount + i] += normals.value(i);
}
}