From e60149aabbfca37111b3b5f94b45adf80ce6c590 Mon Sep 17 00:00:00 2001 From: Tiago Date: Tue, 27 Mar 2018 22:19:40 -0700 Subject: [PATCH 1/2] Retrieving model with the latest changes in the Mixed Reality ToolKit --- Assets/NewtonVR/WindowsMR/NVRWindowsMRInput.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Assets/NewtonVR/WindowsMR/NVRWindowsMRInput.cs b/Assets/NewtonVR/WindowsMR/NVRWindowsMRInput.cs index c4a57042..5f778c91 100644 --- a/Assets/NewtonVR/WindowsMR/NVRWindowsMRInput.cs +++ b/Assets/NewtonVR/WindowsMR/NVRWindowsMRInput.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -12,6 +13,7 @@ using GLTF; using UnityEngine.XR.WSA.Input; using HoloToolkit.Unity; +using UnityGLTF; #if !UNITY_EDITOR using Windows.Foundation; @@ -207,10 +209,10 @@ private IEnumerator LoadSourceControllerModel(InteractionSource source) #endif RenderModel = new GameObject { name = source.handedness + "-glTFController" }; - GLTFComponentStreamingAssets gltfScript = RenderModel.AddComponent(); - gltfScript.ColorMaterial = GLTFMaterial; - gltfScript.NoColorMaterial = GLTFMaterial; - gltfScript.GLTFData = fileBytes; + GLTFComponent gltfScript = RenderModel.AddComponent(); + gltfScript.GLTFConstant = gltfScript.GLTFStandard = gltfScript.GLTFStandardSpecular = GLTFMaterial.shader; + gltfScript.UseStream = true; + gltfScript.GLTFStream = new MemoryStream(fileBytes); yield return gltfScript.LoadModel(); From 3e3dff58647d2c8550cc71380c293d25261aae09 Mon Sep 17 00:00:00 2001 From: Tiago Date: Tue, 27 Mar 2018 22:29:34 -0700 Subject: [PATCH 2/2] Loading model with gltfScript.WaitForModelLoad() --- Assets/NewtonVR/WindowsMR/NVRWindowsMRInput.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/NewtonVR/WindowsMR/NVRWindowsMRInput.cs b/Assets/NewtonVR/WindowsMR/NVRWindowsMRInput.cs index 5f778c91..d8031b68 100644 --- a/Assets/NewtonVR/WindowsMR/NVRWindowsMRInput.cs +++ b/Assets/NewtonVR/WindowsMR/NVRWindowsMRInput.cs @@ -214,7 +214,7 @@ private IEnumerator LoadSourceControllerModel(InteractionSource source) gltfScript.UseStream = true; gltfScript.GLTFStream = new MemoryStream(fileBytes); - yield return gltfScript.LoadModel(); + yield return gltfScript.WaitForModelLoad(); RenderModelInitialized = true; loading = false;