mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-04-17 02:25:57 -05:00
33 lines
1.0 KiB
C#
33 lines
1.0 KiB
C#
using UniGLTF;
|
|
using UnityEngine;
|
|
using VRMShaders;
|
|
|
|
namespace UniVRM10
|
|
{
|
|
public sealed class Vrm10MaterialDescriptorGenerator : IMaterialDescriptorGenerator
|
|
{
|
|
public MaterialDescriptor Get(GltfData data, int i)
|
|
{
|
|
// mtoon
|
|
if (!Vrm10MToonMaterialImporter.TryCreateParam(data, i, out MaterialDescriptor matDesc))
|
|
{
|
|
// unlit
|
|
if (!GltfUnlitMaterialImporter.TryCreateParam(data, i, out matDesc))
|
|
{
|
|
// pbr
|
|
if (!GltfPbrMaterialImporter.TryCreateParam(data, i, out matDesc))
|
|
{
|
|
// fallback
|
|
#if VRM_DEVELOP
|
|
Debug.LogWarning($"material: {i} out of range. fallback");
|
|
#endif
|
|
return new MaterialDescriptor(GltfMaterialDescriptorGenerator.GetMaterialName(i, null), GltfPbrMaterialImporter.ShaderName);
|
|
}
|
|
}
|
|
}
|
|
return matDesc;
|
|
}
|
|
|
|
}
|
|
}
|