public static IEnumerable <(SubAssetKey, TextureImportParam)> EnumerateTexturesForMaterial(GltfParser parser, int i)
        {
            var m = parser.GLTF.materials[i];

            int?metallicRoughnessTexture = default;

            if (m.pbrMetallicRoughness != null)
            {
                // base color
                if (m.pbrMetallicRoughness?.baseColorTexture != null)
                {
                    yield return(GltfPBRMaterial.BaseColorTexture(parser, m));
                }

                // metallic roughness
                if (m.pbrMetallicRoughness?.metallicRoughnessTexture != null && m.pbrMetallicRoughness.metallicRoughnessTexture.index != -1)
                {
                    metallicRoughnessTexture = m.pbrMetallicRoughness?.metallicRoughnessTexture?.index;
                }
            }

            // emission
            if (m.emissiveTexture != null)
            {
                var(offset, scale) = GltfMaterialImporter.GetTextureOffsetAndScale(m.emissiveTexture);
                yield return(GltfTextureImporter.CreateSRGB(parser, m.emissiveTexture.index, offset, scale));
            }

            // normal
            if (m.normalTexture != null)
            {
                yield return(GltfPBRMaterial.NormalTexture(parser, m));
            }

            // occlusion
            int?occlusionTexture = default;

            if (m.occlusionTexture != null && m.occlusionTexture.index != -1)
            {
                occlusionTexture = m.occlusionTexture.index;
            }

            // metallicSmooth and occlusion
            if (metallicRoughnessTexture.HasValue || occlusionTexture.HasValue)
            {
                yield return(GltfPBRMaterial.StandardTexture(parser, m));
            }
        }
        public static IEnumerable <(SubAssetKey, TextureImportParam)> EnumerateTexturesReferencedByMaterials(GltfParser parser, int i)
        {
            var m = parser.GLTF.materials[i];

            int?metallicRoughnessTexture = default;

            if (m.pbrMetallicRoughness != null)
            {
                // base color
                if (m.pbrMetallicRoughness?.baseColorTexture != null)
                {
                    yield return(GltfPBRMaterial.BaseColorTexture(parser, m));
                }

                // metallic roughness
                if (m.pbrMetallicRoughness?.metallicRoughnessTexture != null && m.pbrMetallicRoughness.metallicRoughnessTexture.index != -1)
                {
                    metallicRoughnessTexture = m.pbrMetallicRoughness?.metallicRoughnessTexture?.index;
                }
            }

            // emission
            if (m.emissiveTexture != null)
            {
                yield return(GltfPBRMaterial.EmissiveTexture(parser, m));
            }

            // normal
            if (m.normalTexture != null)
            {
                yield return(GltfPBRMaterial.NormalTexture(parser, m));
            }

            // occlusion
            int?occlusionTexture = default;

            if (m.occlusionTexture != null && m.occlusionTexture.index != -1)
            {
                occlusionTexture = m.occlusionTexture.index;
            }

            // metallicSmooth and occlusion
            if (metallicRoughnessTexture.HasValue || occlusionTexture.HasValue)
            {
                yield return(GltfPBRMaterial.StandardTexture(parser, m));
            }
        }