From c083505ef51993e9fb33ccd409e457a0570e41ab Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 3 Mar 2021 12:57:35 +0900 Subject: [PATCH] fix MaterialTests --- .../IO/MaterialLoader/MaterialFactory.cs | 5 ++++ Assets/UniGLTF/Tests/UniGLTF/MaterialTests.cs | 30 +++++++++++++++---- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialLoader/MaterialFactory.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialLoader/MaterialFactory.cs index d44492f48..fb3f6ca5f 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialLoader/MaterialFactory.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialLoader/MaterialFactory.cs @@ -191,6 +191,11 @@ namespace UniGLTF var gltf = new glTF { materials = new System.Collections.Generic.List { material }, + textures = new List{ + new glTFTexture{ + name = "texture_0" + } + }, }; var task = DefaultCreateMaterialAsync(default(ImmediateCaller), gltf, i, null); return task.Result; diff --git a/Assets/UniGLTF/Tests/UniGLTF/MaterialTests.cs b/Assets/UniGLTF/Tests/UniGLTF/MaterialTests.cs index d37a0e54c..ceb97dc78 100644 --- a/Assets/UniGLTF/Tests/UniGLTF/MaterialTests.cs +++ b/Assets/UniGLTF/Tests/UniGLTF/MaterialTests.cs @@ -111,7 +111,10 @@ namespace UniGLTF alphaMode = "OPAQUE", pbrMetallicRoughness = new glTFPbrMetallicRoughness { - baseColorTexture = new glTFMaterialBaseColorTextureInfo(), + baseColorTexture = new glTFMaterialBaseColorTextureInfo + { + index = 0, + }, }, extensions = glTF_KHR_materials_unlit.Serialize().Deserialize(), }; @@ -127,7 +130,10 @@ namespace UniGLTF pbrMetallicRoughness = new glTFPbrMetallicRoughness { baseColorFactor = new float[] { 1, 0, 0, 1 }, - baseColorTexture = new glTFMaterialBaseColorTextureInfo(), + baseColorTexture = new glTFMaterialBaseColorTextureInfo + { + index = 0 + }, }, extensions = glTF_KHR_materials_unlit.Serialize().Deserialize(), }; @@ -157,7 +163,10 @@ namespace UniGLTF alphaMode = "BLEND", pbrMetallicRoughness = new glTFPbrMetallicRoughness { - baseColorTexture = new glTFMaterialBaseColorTextureInfo(), + baseColorTexture = new glTFMaterialBaseColorTextureInfo + { + index = 0, + }, }, extensions = glTF_KHR_materials_unlit.Serialize().Deserialize(), }; @@ -173,7 +182,10 @@ namespace UniGLTF pbrMetallicRoughness = new glTFPbrMetallicRoughness { baseColorFactor = new float[] { 1, 0, 0, 1 }, - baseColorTexture = new glTFMaterialBaseColorTextureInfo(), + baseColorTexture = new glTFMaterialBaseColorTextureInfo + { + index = 0, + }, }, extensions = glTF_KHR_materials_unlit.Serialize().Deserialize(), }; @@ -188,7 +200,10 @@ namespace UniGLTF alphaMode = "MASK", pbrMetallicRoughness = new glTFPbrMetallicRoughness { - baseColorTexture = new glTFMaterialBaseColorTextureInfo(), + baseColorTexture = new glTFMaterialBaseColorTextureInfo + { + index = 0, + }, }, extensions = glTF_KHR_materials_unlit.Serialize().Deserialize(), }; @@ -204,7 +219,10 @@ namespace UniGLTF pbrMetallicRoughness = new glTFPbrMetallicRoughness { baseColorFactor = new float[] { 1, 0, 0, 1 }, - baseColorTexture = new glTFMaterialBaseColorTextureInfo(), + baseColorTexture = new glTFMaterialBaseColorTextureInfo + { + index = 0, + }, }, extensions = glTF_KHR_materials_unlit.Serialize().Deserialize(), };