mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-04-24 23:18:04 -05:00
Rename
This commit is contained in:
parent
72635626a6
commit
14151cb12d
|
|
@ -28,7 +28,7 @@ namespace UniGLTF
|
|||
/// </summary>
|
||||
public static class GltfTextureEnumerator
|
||||
{
|
||||
public static IEnumerable<(SubAssetKey, TextureImportParam)> EnumerateTexturesForMaterial(GltfParser parser, int i)
|
||||
public static IEnumerable<(SubAssetKey, TextureImportParam)> EnumerateTexturesReferencedByMaterials(GltfParser parser, int i)
|
||||
{
|
||||
var m = parser.GLTF.materials[i];
|
||||
|
||||
|
|
@ -82,17 +82,12 @@ namespace UniGLTF
|
|||
/// <returns></returns>
|
||||
public static IEnumerable<(SubAssetKey, TextureImportParam)> EnumerateAllTexturesDistinct(GltfParser parser)
|
||||
{
|
||||
var used = new HashSet<SubAssetKey>();
|
||||
Func<(SubAssetKey, TextureImportParam), bool> add = (kv) =>
|
||||
{
|
||||
var (key, textureInfo) = kv;
|
||||
return used.Add(key);
|
||||
};
|
||||
var usedTextures = new HashSet<SubAssetKey>();
|
||||
for (int i = 0; i < parser.GLTF.materials.Count; ++i)
|
||||
{
|
||||
foreach (var kv in EnumerateTexturesForMaterial(parser, i))
|
||||
foreach ((SubAssetKey key, TextureImportParam) kv in EnumerateTexturesReferencedByMaterials(parser, i))
|
||||
{
|
||||
if (add(kv))
|
||||
if (usedTextures.Add(kv.key))
|
||||
{
|
||||
yield return kv;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ namespace UniGLTF
|
|||
|
||||
// extractor
|
||||
var extractor = new TextureExtractor(parser, UnityPath.FromUnityPath(""), loader.TextureFactory.Textures.Select(x => (new SubAssetKey(typeof(Texture2D), x.Texture.name), x.Texture)).ToArray());
|
||||
var m = GltfTextureEnumerator.EnumerateTexturesForMaterial(parser, 0).FirstOrDefault(x => x.Item1.Name == "texture_1.standard");
|
||||
var m = GltfTextureEnumerator.EnumerateTexturesReferencedByMaterials(parser, 0).FirstOrDefault(x => x.Item1.Name == "texture_1.standard");
|
||||
|
||||
Assert.Catch<NotImplementedException>(() => extractor.Extract(m.Item1, m.Item2));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ namespace VRM
|
|||
else
|
||||
{
|
||||
// PBR or Unlit
|
||||
foreach (var (key, value) in GltfTextureEnumerator.EnumerateTexturesForMaterial(parser, i))
|
||||
foreach (var (key, value) in GltfTextureEnumerator.EnumerateTexturesReferencedByMaterials(parser, i))
|
||||
{
|
||||
if (used.Add(key))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
m_EditorVersion: 2018.4.27f1
|
||||
m_EditorVersion: 2019.4.14f1
|
||||
m_EditorVersionWithRevision: 2019.4.14f1 (4037e52648cd)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user