From eff6d6edd01ce05bf5c751f06ed11da30f61d460 Mon Sep 17 00:00:00 2001 From: Masataka SUMI Date: Thu, 14 Mar 2024 19:11:48 +0900 Subject: [PATCH] fix --- .../Texture/Importer/UnityTextureDeserializer.cs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Assets/VRMShaders/GLTF/IO/Runtime/Texture/Importer/UnityTextureDeserializer.cs b/Assets/VRMShaders/GLTF/IO/Runtime/Texture/Importer/UnityTextureDeserializer.cs index 0306fa60a..16fcdedb1 100644 --- a/Assets/VRMShaders/GLTF/IO/Runtime/Texture/Importer/UnityTextureDeserializer.cs +++ b/Assets/VRMShaders/GLTF/IO/Runtime/Texture/Importer/UnityTextureDeserializer.cs @@ -19,8 +19,13 @@ namespace VRMShaders switch (textureInfo.DataMimeType) { case "image/png": - break; case "image/jpeg": + texture = new Texture2D(2, 2, TextureFormat.ARGB32, textureInfo.UseMipmap, textureInfo.ColorSpace == ColorSpace.Linear); + if (textureInfo.ImageData != null) + { + texture.LoadImage(textureInfo.ImageData); + await awaitCaller.NextFrame(); + } break; #if USE_COM_UNITY_CLOUD_KTX case "image/ktx": @@ -53,19 +58,12 @@ namespace VRMShaders break; } - if (texture == null) + if (texture != null) { - texture = new Texture2D(2, 2, TextureFormat.ARGB32, textureInfo.UseMipmap, textureInfo.ColorSpace == ColorSpace.Linear); - } - if (textureInfo.ImageData != null) - { - texture.LoadImage(textureInfo.ImageData); texture.wrapModeU = textureInfo.WrapModeU; texture.wrapModeV = textureInfo.WrapModeV; texture.filterMode = textureInfo.FilterMode; - await awaitCaller.NextFrame(); } - return texture; } }