From 696b0c8e9d2c638bbf4011305b6616f4840f042e Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 7 Jun 2022 16:40:28 +0900 Subject: [PATCH] =?UTF-8?q?await=20awaitCaller.NextFrame()=E3=80=80?= =?UTF-8?q?=E3=82=92=E5=A2=97=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshContext.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshContext.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshContext.cs index f9451a115..7acfa7435 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshContext.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshContext.cs @@ -643,19 +643,22 @@ namespace UniGLTF }; UploadMeshVertices(mesh); + await awaitCaller.NextFrame(); + UploadMeshIndices(mesh); + await awaitCaller.NextFrame(); // NOTE: mesh.vertices では自動的に行われていたが、SetVertexBuffer では行われないため、明示的に呼び出す. mesh.RecalculateBounds(); + await awaitCaller.NextFrame(); if (!HasNormal) { mesh.RecalculateNormals(); + await awaitCaller.NextFrame(); } - Profiler.EndSample(); // RecalculateTangents - await awaitCaller.NextFrame(); mesh.RecalculateTangents(); await awaitCaller.NextFrame(); @@ -665,8 +668,8 @@ namespace UniGLTF Mesh = mesh, Materials = MaterialIndices.Select(ctx).ToArray() }; - await awaitCaller.NextFrame(); + if (BlendShapes.Count > 0) { var emptyVertices = new Vector3[mesh.vertexCount]; @@ -675,6 +678,7 @@ namespace UniGLTF await BuildBlendShapeAsync(awaitCaller, mesh, blendShape, emptyVertices); } } + Profiler.EndSample(); Profiler.BeginSample("Mesh.UploadMeshData"); mesh.UploadMeshData(false);