/// <summary> /// VRM-1 の thumbnail テクスチャー。gltf.textures ではなく gltf.images の参照であることに注意(sampler等の設定が無い) /// </summary> public static bool TryGetMetaThumbnailTextureImportParam(GltfParser parser, UniGLTF.Extensions.VRMC_vrm.VRMC_vrm vrm, out (SubAssetKey, TextureImportParam) value) { if (vrm?.Meta?.ThumbnailImage == null) { value = default; return(false); } var imageIndex = vrm.Meta.ThumbnailImage.Value; var gltfImage = parser.GLTF.images[imageIndex]; var name = TextureImportName.GetUnityObjectName(TextureImportTypes.sRGB, gltfImage.name, gltfImage.uri); GetTextureBytesAsync getThumbnailImageBytesAsync = () => { var bytes = parser.GLTF.GetImageBytes(parser.Storage, imageIndex); return(Task.FromResult(GltfTextureImporter.ToArray(bytes))); }; var param = new TextureImportParam(name, gltfImage.GetExt(), gltfImage.uri, Vector2.zero, Vector2.one, default, TextureImportTypes.sRGB, default, default,
/// <summary> /// VRM-1 の thumbnail テクスチャー。gltf.textures ではなく gltf.images の参照であることに注意(sampler等の設定が無い) /// /// MToonとは無関係だがとりあえずここに /// </summary> /// <param name="parser"></param> /// <param name="vrm"></param> /// <param name="value"></param> /// <returns></returns> public static bool TryGetMetaThumbnailTextureImportParam(GltfParser parser, UniGLTF.Extensions.VRMC_vrm.VRMC_vrm vrm, out TextureImportParam value) { if (!vrm.Meta.ThumbnailImage.HasValue) { value = default; return(false); } // thumbnail var imageIndex = vrm.Meta.ThumbnailImage.Value; var gltfImage = parser.GLTF.images[imageIndex]; var name = new TextureImportName(TextureImportTypes.sRGB, gltfImage.name, gltfImage.GetExt(), ""); GetTextureBytesAsync getBytesAsync = () => { var bytes = parser.GLTF.GetImageBytes(parser.Storage, imageIndex); return(Task.FromResult(GltfTextureImporter.ToArray(bytes))); }; value = new TextureImportParam(name, Vector2.zero, Vector2.one, default, TextureImportTypes.sRGB, default, default,