mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-08 03:48:19 -05:00
Merge pull request #408 from hiroj/fix_createTextureItem
Changed to be able to extend texture loader.
This commit is contained in:
@@ -394,7 +394,7 @@ namespace UniGLTF
|
||||
Root.name = Path.GetFileNameWithoutExtension(path);
|
||||
}
|
||||
|
||||
public void CreateTextureItems(UnityPath imageBaseDir = default(UnityPath))
|
||||
public virtual void CreateTextureItems(UnityPath imageBaseDir = default(UnityPath))
|
||||
{
|
||||
if (m_textures.Any())
|
||||
{
|
||||
|
||||
@@ -110,13 +110,25 @@ namespace UniGLTF
|
||||
/// Texture from buffer
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
public TextureItem(int index)
|
||||
public TextureItem(int index, ITextureLoader textureLoader = null)
|
||||
{
|
||||
m_textureIndex = index;
|
||||
if(textureLoader == null)
|
||||
{
|
||||
m_textureLoader = CreateTextureLoader(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_textureLoader = textureLoader;
|
||||
}
|
||||
}
|
||||
|
||||
private static ITextureLoader CreateTextureLoader(int index)
|
||||
{
|
||||
#if UNIGLTF_USE_WEBREQUEST_TEXTURELOADER
|
||||
m_textureLoader = new UnityWebRequestTextureLoader(m_textureIndex);
|
||||
return new UnityWebRequestTextureLoader(index);
|
||||
#else
|
||||
m_textureLoader = new TextureLoader(m_textureIndex);
|
||||
return new TextureLoader(index);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user