mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-04-24 23:18:04 -05:00
AssetTextureLoader.LoadTaskAsync
This commit is contained in:
parent
14c39b61be
commit
b4ca9e607c
|
|
@ -8,8 +8,13 @@ namespace UniGLTF
|
|||
public static class AssetTextureLoader
|
||||
{
|
||||
public static Task<Texture2D> LoadTaskAsync(UnityPath m_assetPath,
|
||||
bool isLinear, glTFTextureSampler sampler)
|
||||
glTF gltf, int textureIndex)
|
||||
{
|
||||
var textureType = TextureIO.GetglTFTextureType(gltf, textureIndex);
|
||||
var colorSpace = TextureIO.GetColorSpace(textureType);
|
||||
var isLinear = colorSpace == RenderTextureReadWrite.Linear;
|
||||
var sampler = gltf.GetSamplerFromTextureIndex(textureIndex);
|
||||
|
||||
//
|
||||
// texture from assets
|
||||
//
|
||||
|
|
|
|||
|
|
@ -53,14 +53,10 @@ namespace VRM
|
|||
// save texture assets !
|
||||
LoadTextureAsyncFunc textureLoader = async (textureIndex, used) =>
|
||||
{
|
||||
var textureType = TextureIO.GetglTFTextureType(parser.GLTF, textureIndex);
|
||||
var colorSpace = TextureIO.GetColorSpace(textureType);
|
||||
var isLinear = colorSpace == RenderTextureReadWrite.Linear;
|
||||
var sampler = parser.GLTF.GetSamplerFromTextureIndex(textureIndex);
|
||||
var gltfTexture = parser.GLTF.textures[textureIndex];
|
||||
var gltfImage = parser.GLTF.images[gltfTexture.source];
|
||||
var assetPath = prefabPath.Parent.Child(gltfImage.uri);
|
||||
var texture = await UniGLTF.AssetTextureLoader.LoadTaskAsync(assetPath, isLinear, sampler);
|
||||
var texture = await UniGLTF.AssetTextureLoader.LoadTaskAsync(assetPath, parser.GLTF, textureIndex);
|
||||
return new TextureLoadInfo(texture, used, false);
|
||||
};
|
||||
var context = new VRMImporterContext(parser, textureLoader);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user