From e370e7d6453a82b8bb3326b9616f21ded69acf5b Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 2 Oct 2018 15:10:05 +0900 Subject: [PATCH 1/8] Updated UniGLTF --- UniGLTF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UniGLTF b/UniGLTF index 3a3ddbbb2..a438c4576 160000 --- a/UniGLTF +++ b/UniGLTF @@ -1 +1 @@ -Subproject commit 3a3ddbbb20c27be665e8c3fbfe007ff95962be2d +Subproject commit a438c45760e9759552d04cdf03e5258ed01eeaba From 473a90ebf0ab37be50c2990c61694376334892d5 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 2 Oct 2018 18:39:28 +0900 Subject: [PATCH 2/8] Updated UniGLTF --- UniGLTF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UniGLTF b/UniGLTF index a438c4576..1f5c39ac5 160000 --- a/UniGLTF +++ b/UniGLTF @@ -1 +1 @@ -Subproject commit a438c45760e9759552d04cdf03e5258ed01eeaba +Subproject commit 1f5c39ac527d8250af2b9d8c05eacdd33a77388f From d71acca3cb87ce0043d8796039ea981235a8f9f7 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 2 Oct 2018 20:50:02 +0900 Subject: [PATCH 3/8] Updated UniGLTF. ImporterContext interface --- Scripts/Format/VRMImporterContext.cs | 108 ++------------------------- UniGLTF | 2 +- 2 files changed, 9 insertions(+), 101 deletions(-) diff --git a/Scripts/Format/VRMImporterContext.cs b/Scripts/Format/VRMImporterContext.cs index b4db38236..4e60595bf 100644 --- a/Scripts/Format/VRMImporterContext.cs +++ b/Scripts/Format/VRMImporterContext.cs @@ -1,11 +1,11 @@ -using DepthFirstScheduler; -using System; +using System; using System.Linq; using System.Collections.Generic; using UniGLTF; using UnityEngine; using System.IO; + namespace VRM { public class VRMImporterContext : ImporterContext @@ -32,109 +32,14 @@ namespace VRM } } - public override void Load() + public override void ParseJson(string json, IStorage storage) { + base.ParseJson(json, storage); SetMaterialImporter(new VRMMaterialImporter(this, glTF_VRM_Material.Parse(Json))); - base.Load(); - OnLoadModel(); - } - - protected override Schedulable LoadAsync() - { - return Schedulable.Create() - .AddTask(Scheduler.ThreadPool, () => - { - using (MeasureTime("glTF_VRM_Material.Parse")) - { - return glTF_VRM_Material.Parse(Json); - } - }) - .ContinueWith(Scheduler.MainThread, gltfMaterials => - { - using (MeasureTime("new VRMMaterialImporter")) - { - SetMaterialImporter(new VRMMaterialImporter(this, gltfMaterials)); - } - }) - .OnExecute(Scheduler.ThreadPool, parent => - { - // textures - for (int i = 0; i < GLTF.textures.Count; ++i) - { - var index = i; - parent.AddTask(Scheduler.MainThread, - () => - { - using (MeasureTime("texture.Process")) - { - var texture = new TextureItem(index); - texture.Process(GLTF, Storage); - return texture; - } - }) - .ContinueWith(Scheduler.ThreadPool, x => AddTexture(x)); - } - }) - .ContinueWithCoroutine(Scheduler.MainThread, () => LoadMaterials()) - .OnExecute(Scheduler.ThreadPool, parent => - { - // meshes - var meshImporter = new MeshImporter(); - for (int i = 0; i < GLTF.meshes.Count; ++i) - { - var index = i; - parent.AddTask(Scheduler.ThreadPool, - () => - { - using (MeasureTime("ReadMesh")) - { - return meshImporter.ReadMesh(this, index); - } - }) - .ContinueWith(Scheduler.MainThread, x => - { - using (MeasureTime("BuildMesh")) - { - return MeshImporter.BuildMesh(this, x); - } - }) - .ContinueWith(Scheduler.ThreadPool, x => Meshes.Add(x)) - ; - } - }) - .ContinueWithCoroutine(Scheduler.MainThread, () => - { - using (MeasureTime("LoadNodes")) - { - return LoadNodes(); - } - }) - .ContinueWithCoroutine(Scheduler.MainThread, () => - { - using (MeasureTime("BuildHierarchy")) - { - return BuildHierarchy(); - } - }) - .ContinueWith(Scheduler.CurrentThread, _ => - { - //using (MeasureTime("OnLoadModel")) - { - OnLoadModel(); - return Unit.Default; - } - }) - .ContinueWith(Scheduler.CurrentThread, - _ => - { - Root.name = "VRM"; - Debug.Log(GetSpeedLog()); - return Unit.Default; - }); } #region OnLoad - void OnLoadModel() + protected override void OnLoadModel() { using (MeasureTime("VRM LoadMeta")) { @@ -159,6 +64,9 @@ namespace VRM { LoadFirstPerson(); } + + Root.name = "VRM"; + Debug.Log(GetSpeedLog()); } void LoadMeta() diff --git a/UniGLTF b/UniGLTF index 1f5c39ac5..e5456784e 160000 --- a/UniGLTF +++ b/UniGLTF @@ -1 +1 @@ -Subproject commit 1f5c39ac527d8250af2b9d8c05eacdd33a77388f +Subproject commit e5456784e5bd11974f49f927d8b47d4787eddcaf From 0fec32df7186bc0685439e2e8c0b6043f982f789 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 3 Oct 2018 14:31:34 +0900 Subject: [PATCH 4/8] Updated UniGLTF --- UniGLTF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UniGLTF b/UniGLTF index e5456784e..53748bf03 160000 --- a/UniGLTF +++ b/UniGLTF @@ -1 +1 @@ -Subproject commit e5456784e5bd11974f49f927d8b47d4787eddcaf +Subproject commit 53748bf03229d1c123326cf069bbfe4caa850204 From b49eebfce97c3bfa3ddf2cb47cd6d2fc5377deda Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 3 Oct 2018 14:46:08 +0900 Subject: [PATCH 5/8] Updated UniGLTF. Fixed OnLoad --- Scripts/Format/VRMImporterContext.cs | 5 ++--- UniGLTF | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Scripts/Format/VRMImporterContext.cs b/Scripts/Format/VRMImporterContext.cs index 4e60595bf..455ebaffb 100644 --- a/Scripts/Format/VRMImporterContext.cs +++ b/Scripts/Format/VRMImporterContext.cs @@ -41,6 +41,8 @@ namespace VRM #region OnLoad protected override void OnLoadModel() { + Root.name = "VRM"; + using (MeasureTime("VRM LoadMeta")) { LoadMeta(); @@ -64,9 +66,6 @@ namespace VRM { LoadFirstPerson(); } - - Root.name = "VRM"; - Debug.Log(GetSpeedLog()); } void LoadMeta() diff --git a/UniGLTF b/UniGLTF index 53748bf03..43cbb963b 160000 --- a/UniGLTF +++ b/UniGLTF @@ -1 +1 @@ -Subproject commit 53748bf03229d1c123326cf069bbfe4caa850204 +Subproject commit 43cbb963b1755231625d22ceeae17bd4d3ee938e From 2843f357875bb6004bf305d9143206270bae13c2 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 3 Oct 2018 16:42:36 +0900 Subject: [PATCH 6/8] Updated UniGLTF --- UniGLTF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UniGLTF b/UniGLTF index 43cbb963b..782686845 160000 --- a/UniGLTF +++ b/UniGLTF @@ -1 +1 @@ -Subproject commit 43cbb963b1755231625d22ceeae17bd4d3ee938e +Subproject commit 782686845719bee372695a59acc6c7846d4d9775 From 7f84ecd6f61ce33f75756d4b871fae188b6c5079 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 3 Oct 2018 16:47:49 +0900 Subject: [PATCH 7/8] Updated UniGLTF --- UniGLTF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UniGLTF b/UniGLTF index 782686845..c833545ed 160000 --- a/UniGLTF +++ b/UniGLTF @@ -1 +1 @@ -Subproject commit 782686845719bee372695a59acc6c7846d4d9775 +Subproject commit c833545ed2b58964602244f55f2adcb3fdc951e0 From 338144f8f5e45751f62bff88a51335e54f314192 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 3 Oct 2018 17:16:25 +0900 Subject: [PATCH 8/8] Updated UniGLTF --- UniGLTF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UniGLTF b/UniGLTF index c833545ed..598e6a69f 160000 --- a/UniGLTF +++ b/UniGLTF @@ -1 +1 @@ -Subproject commit c833545ed2b58964602244f55f2adcb3fdc951e0 +Subproject commit 598e6a69f54c9ff947669526970a3ded7a171ff5