Skip to content

Commit

Permalink
Merge branch '099_integrator_blendshape' into v0_99_1
Browse files Browse the repository at this point in the history
  • Loading branch information
ousttrue committed Jul 29, 2022
2 parents 0dc9a0d + b8cb548 commit df66ce1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Assets/UniGLTF/Runtime/MeshUtility/MeshIntegrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ void AddBlendShapesToMesh(Mesh mesh)
if (!map.TryGetValue(x.Name, out bs))
{
bs = new BlendShape();
// arrays size must match mesh vertex count
bs.Positions = new Vector3[Positions.Count];
bs.Normals = new Vector3[Normals.Count];
bs.Tangents = new Vector3[Tangents.Count];
bs.Normals = new Vector3[Positions.Count];
bs.Tangents = new Vector3[Positions.Count];
bs.Name = x.Name;
bs.FrameWeight = x.FrameWeight;
map.Add(x.Name, bs);
Expand Down Expand Up @@ -214,10 +215,10 @@ public void Push(SkinnedMeshRenderer renderer)

for (int i = 0; i < mesh.blendShapeCount; ++i)
{
var positions = (Vector3[])mesh.vertices.Clone();
var normals = (Vector3[])mesh.normals.Clone();
var tangents = mesh.tangents.Select(x => (Vector3)x).ToArray();

// arrays size must match mesh vertex count
var positions = new Vector3[mesh.vertexCount];
var normals = new Vector3[mesh.vertexCount];
var tangents = new Vector3[mesh.vertexCount];
mesh.GetBlendShapeFrameVertices(i, 0, positions, normals, tangents);
BlendShapes.Add(new BlendShape
{
Expand Down

0 comments on commit df66ce1

Please sign in to comment.