fix rebase

This commit is contained in:
ousttrue 2021-03-17 15:42:16 +09:00
parent 2c9bb63ccb
commit 1d38656df2
5 changed files with 18 additions and 10 deletions

View File

@ -37,7 +37,7 @@ namespace UniGLTF
EnumerateTexturesFromUri(externalObjectMap, parser, UnityPath.FromUnityPath(scriptedImporter.assetPath).Parent))))
{
// settings TextureImporters
foreach (var textureInfo in parser.EnumerateTextures())
foreach (var textureInfo in GltfTextureEnumerator.Enumerate(parser.GLTF))
{
TextureImporterConfigurator.Configure(textureInfo, loaded.TextureFactory.ExternalMap);
}

View File

@ -8,6 +8,7 @@ namespace UniGLTF
{
public static IEnumerable<GetTextureParam> EnumerateTextures(glTF gltf, glTFMaterial m)
{
int? metallicRoughnessTexture = default;
if (m.pbrMetallicRoughness != null)
{
// base color
@ -17,16 +18,16 @@ namespace UniGLTF
}
// metallic roughness
if (m.pbrMetallicRoughness?.metallicRoughnessTexture != null)
if (m.pbrMetallicRoughness?.metallicRoughnessTexture != null && m.pbrMetallicRoughness.metallicRoughnessTexture.index != -1)
{
yield return PBRMaterialItem.MetallicRoughnessTexture(gltf, m);
metallicRoughnessTexture = m.pbrMetallicRoughness?.metallicRoughnessTexture?.index;
}
}
// emission
if (m.emissiveTexture != null)
{
yield return GetTextureParam.Create(gltf, m.emissiveTexture.index);
yield return GetTextureParam.CreateSRGB(gltf, m.emissiveTexture.index);
}
// normal
@ -36,9 +37,16 @@ namespace UniGLTF
}
// occlusion
if (m.occlusionTexture != null)
int? occlusionTexture = default;
if (m.occlusionTexture != null && m.occlusionTexture.index != -1)
{
yield return PBRMaterialItem.OcclusionTexture(gltf, m);
occlusionTexture = m.occlusionTexture.index;
}
// metallicSmooth and occlusion
if (metallicRoughnessTexture.HasValue || occlusionTexture.HasValue)
{
yield return PBRMaterialItem.StandardTexture(gltf, m);
}
}

View File

@ -73,7 +73,7 @@ namespace VRM
using (var context = new VRMImporterContext(parser))
{
var editor = new VRMEditorImporterContext(context, prefabPath);
foreach (var textureInfo in parser.EnumerateTextures())
foreach (var textureInfo in new VRMTextureEnumerator(context.VRM).Enumerate(parser.GLTF))
{
TextureImporterConfigurator.Configure(textureInfo, map.ToDictionary(x => x.name, x => x.texture as Texture2D));
}

View File

@ -60,7 +60,7 @@ namespace VRM
using (var context = new VRMImporterContext(parser, null, map))
{
var editor = new VRMEditorImporterContext(context, prefabPath);
foreach (var textureInfo in parser.EnumerateTextures())
foreach (var textureInfo in new VRMTextureEnumerator(context.VRM).Enumerate(parser.GLTF))
{
TextureImporterConfigurator.Configure(textureInfo, map.ToDictionary(x => x.name, x => x.texture as Texture2D));
}

View File

@ -22,7 +22,7 @@ namespace VRM
foreach (var kv in vrmMaterial.textureProperties)
{
// SRGB color or normalmap
yield return GetTextureParam.Create(gltf, kv.Value, kv.Key);
yield return GetTextureParam.Create(gltf, kv.Value, kv.Key, default, default);
}
}
else
@ -38,7 +38,7 @@ namespace VRM
// thumbnail
if (m_vrm.meta != null && m_vrm.meta.texture != -1)
{
yield return GetTextureParam.Create(gltf, m_vrm.meta.texture);
yield return GetTextureParam.CreateSRGB(gltf, m_vrm.meta.texture);
}
}
}