Merge pull request #47 from hiroj/shader_fallback

vrm shader fallback fix
This commit is contained in:
ousttrue
2018-10-10 23:25:00 +09:00
committed by GitHub
3 changed files with 16 additions and 2 deletions

View File

@@ -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;
}

View File

@@ -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)
{

Submodule UniGLTF updated: fae0f5e1f4...8f04b09b5c