mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-20 09:34:42 -05:00
Merge pull request #47 from hiroj/shader_fallback
vrm shader fallback fix
This commit is contained in:
@@ -9,7 +9,7 @@ namespace VRM
|
||||
public class VRMMaterialImporter : MaterialImporter
|
||||
{
|
||||
List<glTF_VRM_Material> m_materials;
|
||||
public VRMMaterialImporter(ImporterContext context, List<glTF_VRM_Material> materials) : base(new ShaderStore(context, "VRM/UnlitTexture"), context)
|
||||
public VRMMaterialImporter(ImporterContext context, List<glTF_VRM_Material> materials) : base(new ShaderStore(context), context)
|
||||
{
|
||||
m_materials = materials;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,14 @@ namespace VRM
|
||||
// "Queue",
|
||||
};
|
||||
|
||||
private static readonly string[] VRMExtensionShaders = new string[]
|
||||
{
|
||||
"VRM/UnlitTransparentZWrite",
|
||||
"VRM/MToon"
|
||||
};
|
||||
|
||||
private static readonly string VRM_USE_GLTFSHADER = "VRM_USE_GLTFSHADER";
|
||||
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => name);
|
||||
@@ -112,6 +120,12 @@ namespace VRM
|
||||
renderQueue = m.renderQueue,
|
||||
};
|
||||
|
||||
if (!VRMExtensionShaders.Contains(m.shader.name))
|
||||
{
|
||||
material.shader = VRM_USE_GLTFSHADER;
|
||||
return material;
|
||||
}
|
||||
|
||||
var prop = PreShaderPropExporter.GetPropsForSupportedShader(m.shader.name);
|
||||
if (prop == null)
|
||||
{
|
||||
|
||||
2
UniGLTF
2
UniGLTF
Submodule UniGLTF updated: fae0f5e1f4...8f04b09b5c
Reference in New Issue
Block a user