mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-07 11:28:35 -05:00
fix
This commit is contained in:
@@ -58,8 +58,15 @@ namespace UniGLTF
|
||||
return texture;
|
||||
}
|
||||
|
||||
texture = await LoadTextureAsync(param.Index0.Value);
|
||||
m_textureCache.Add(GetTextureParam.Create(param.Index0.Value), texture);
|
||||
{
|
||||
var defaultParam = GetTextureParam.Create(param.Index0.Value);
|
||||
if (!m_textureCache.TryGetValue(defaultParam, out texture))
|
||||
{
|
||||
texture = await LoadTextureAsync(param.Index0.Value);
|
||||
m_textureCache.Add(defaultParam, texture);
|
||||
}
|
||||
}
|
||||
|
||||
switch (param.TextureType)
|
||||
{
|
||||
case GetTextureParam.NORMAL_PROP:
|
||||
|
||||
@@ -71,7 +71,12 @@ namespace UniGLTF
|
||||
/// <returns></returns>
|
||||
public static Material CreateMaterialForTest(int i, glTFMaterial material)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
var gltf = new glTF
|
||||
{
|
||||
materials = new System.Collections.Generic.List<glTFMaterial> { material },
|
||||
};
|
||||
var task = DefaultCreateMaterialAsync(gltf, i, null);
|
||||
return task.Result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ namespace UniGLTF
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<Texture2D> LoadTextureAsync(glTF gltf, IStorage storage, int index)
|
||||
public static Task<Texture2D> LoadTextureAsync(glTF gltf, IStorage storage, int index)
|
||||
{
|
||||
string m_textureName = default;
|
||||
|
||||
|
||||
var imageIndex = gltf.GetImageIndexFromTextureIndex(index);
|
||||
var segments = gltf.GetImageBytes(storage, imageIndex, out m_textureName);
|
||||
var imageBytes = ToArray(segments);
|
||||
@@ -50,7 +50,7 @@ namespace UniGLTF
|
||||
{
|
||||
TextureSamplerUtil.SetSampler(texture, sampler);
|
||||
}
|
||||
return texture;
|
||||
return Task.FromResult(texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user