fix sparse blendShape position accessor min and max

This commit is contained in:
ousttrue
2022-07-11 20:19:54 +09:00
parent 9c92be5f3e
commit 05d7c1d8ea

View File

@@ -48,6 +48,8 @@ namespace UniGLTF
positionAccessorIndex = data.ExtendSparseBufferAndGetAccessorIndex(accessorCount,
sparseIndices.Select(x => positions[x]).ToArray(), sparseIndices, sparseIndicesViewIndex,
glBufferTarget.NONE);
data.Gltf.accessors[positionAccessorIndex].min = positions.Aggregate(positions[0], (a, b) => new Vector3(Mathf.Min(a.x, b.x), Math.Min(a.y, b.y), Mathf.Min(a.z, b.z))).ToArray();
data.Gltf.accessors[positionAccessorIndex].max = positions.Aggregate(positions[0], (a, b) => new Vector3(Mathf.Max(a.x, b.x), Math.Max(a.y, b.y), Mathf.Max(a.z, b.z))).ToArray();
}
// normals