コード整理。IMaterialValidator.EnumerateTextureProperties 追加した

Exporter がテクスチャー列挙という形式をとらずに全部展開してするという手法を取っているため、それほど共通化されない。
This commit is contained in:
ousttrue
2021-07-16 17:38:51 +09:00
parent 0d9b9cbbf7
commit 14ea4befce
6 changed files with 131 additions and 62 deletions

View File

@@ -124,6 +124,9 @@ namespace VRM
m_meshes = null;
}
/// <summary>
/// VRM0
/// </summary>
class VRMMaterialValidator : DefaultMaterialValidator
{
public override string GetGltfMaterialTypeFromUnityShaderName(string shaderName)
@@ -135,6 +138,26 @@ namespace VRM
}
return base.GetGltfMaterialTypeFromUnityShaderName(shaderName);
}
public override IEnumerable<(string propertyName, Texture texture)> EnumerateTextureProperties(Material m)
{
if (m.shader.name != "VRM/MToon")
{
foreach (var x in base.EnumerateTextureProperties(m))
{
yield return x;
}
}
var prop = UniGLTF.ShaderPropExporter.PreShaderPropExporter.GetPropsForSupportedShader(m.shader.name);
foreach (var kv in prop.Properties)
{
if (kv.ShaderPropertyType == UniGLTF.ShaderPropExporter.ShaderPropertyType.TexEnv)
{
yield return (kv.Key, m.GetTexture(kv.Key));
}
}
}
}
protected override IEnumerable<Validator> ValidatorFactory()

View File

@@ -6,7 +6,8 @@
"VRMShaders.GLTF.IO.Runtime",
"VRMShaders.GLTF.IO.Editor",
"UniGLTF",
"UniGLTF.Editor"
"UniGLTF.Editor",
"VRMShaders.VRM.IO.Runtime"
],
"optionalUnityReferences": [],
"includePlatforms": [