From 92138a80ffd3dc42a4c662748dce13c7cf24869b Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 10 Feb 2021 22:08:35 +0900 Subject: [PATCH] new AssetTextureLoader --- .../UniGLTF/Runtime/UniGLTF/IO/TextureItem.cs | 19 ++----------------- .../MaterialFacotry/MaterialFactory.cs | 5 ++++- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureItem.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureItem.cs index cc03b6cb5..e96402d3c 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureItem.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureItem.cs @@ -87,7 +87,7 @@ namespace UniGLTF public bool IsAsset { - private set; + set; get; } @@ -115,27 +115,12 @@ namespace UniGLTF m_textureIndex = index; m_textureLoader = textureLoader; - if(m_textureLoader == null) + if (m_textureLoader == null) { throw new Exception("ITextureLoader is null."); } } -#if UNITY_EDITOR - /// - /// Texture from asset - /// - /// - /// - /// - public TextureItem(int index, UnityPath assetPath, string textureName) - { - m_textureIndex = index; - IsAsset = true; - m_textureLoader = new AssetTextureLoader(assetPath, textureName); - } -#endif - #region Process ITextureLoader m_textureLoader; diff --git a/Assets/UniGLTF/Runtime/UniGLTF/MaterialFacotry/MaterialFactory.cs b/Assets/UniGLTF/Runtime/UniGLTF/MaterialFacotry/MaterialFactory.cs index 6a2d46291..659f620e4 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/MaterialFacotry/MaterialFactory.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/MaterialFacotry/MaterialFactory.cs @@ -121,7 +121,10 @@ namespace UniGLTF /// var assetPath = imageBaseDir.Child(image.uri); var textureName = !string.IsNullOrEmpty(image.name) ? image.name : Path.GetFileNameWithoutExtension(image.uri); - item = new TextureItem(i, assetPath, textureName); + item = new TextureItem(i, new AssetTextureLoader(assetPath, textureName)) + { + IsAsset = true + }; } else #endif