mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-12 13:59:21 -05:00
PreShaderPropExporter は既に VRM/MToon 専用
This commit is contained in:
@@ -30,7 +30,7 @@ namespace VRM
|
||||
//
|
||||
// extensions.VRM.materialProperties に記録する
|
||||
//
|
||||
var prop = UniGLTF.ShaderPropExporter.PreShaderPropExporter.GetPropsForSupportedShader(m.shader.name);
|
||||
var prop = UniGLTF.ShaderPropExporter.PreShaderPropExporter.GetPropsForMToon();
|
||||
foreach (var kv in prop.Properties)
|
||||
{
|
||||
if (kv.ShaderPropertyType == UniGLTF.ShaderPropExporter.ShaderPropertyType.TexEnv)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UniGLTF;
|
||||
using UniGLTF.ShaderPropExporter;
|
||||
@@ -135,16 +134,16 @@ namespace VRM
|
||||
renderQueue = m.renderQueue,
|
||||
};
|
||||
|
||||
if (!PreShaderPropExporter.VRMExtensionShaders.Contains(m.shader.name))
|
||||
if (m.shader.name != MToon.Utils.ShaderName)
|
||||
{
|
||||
material.shader = glTF_VRM_Material.VRM_USE_GLTFSHADER;
|
||||
return material;
|
||||
}
|
||||
|
||||
var prop = PreShaderPropExporter.GetPropsForSupportedShader(m.shader.name);
|
||||
var prop = PreShaderPropExporter.GetPropsForMToon();
|
||||
if (prop == null)
|
||||
{
|
||||
Debug.LogWarningFormat("Fail to export shader: {0}", m.shader.name);
|
||||
throw new Exception("arienai");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -25,17 +25,16 @@ namespace UniGLTF.ShaderPropExporter
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 今はMToon専用
|
||||
/// </summary>
|
||||
public static partial class PreShaderPropExporter
|
||||
{
|
||||
public static readonly string[] VRMExtensionShaders = new string[]
|
||||
{
|
||||
"VRM/UnlitTransparentZWrite",
|
||||
"VRM/MToon"
|
||||
};
|
||||
|
||||
static Dictionary<string, ShaderProps> m_shaderPropMap;
|
||||
|
||||
public static ShaderProps GetPropsForSupportedShader(string shaderName)
|
||||
const string ShaderName = "VRM/MToon";
|
||||
|
||||
public static ShaderProps GetPropsForMToon()
|
||||
{
|
||||
if (m_shaderPropMap == null)
|
||||
{
|
||||
@@ -51,19 +50,12 @@ namespace UniGLTF.ShaderPropExporter
|
||||
}
|
||||
|
||||
ShaderProps props;
|
||||
if (m_shaderPropMap.TryGetValue(shaderName, out props))
|
||||
if (m_shaderPropMap.TryGetValue(ShaderName, out props))
|
||||
{
|
||||
return props;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
// fallback
|
||||
Debug.LogWarningFormat("{0} is not predefined shader. Use ShaderUtil", shaderName);
|
||||
var shader = Shader.Find(shaderName);
|
||||
return ShaderProps.FromShader(shader);
|
||||
#else
|
||||
return null;
|
||||
#endif
|
||||
throw new Exception("arienai");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user