UniVRM/Assets/VRM10/Runtime/IO/ModelExtensions.cs
2021-04-09 16:54:55 +09:00

21 lines
534 B
C#

using VrmLib;
namespace UniVRM10
{
public static class ModelExtensions
{
public static byte[] ToGlb(this VrmLib.Model model)
{
// export vrm-1.0
var exporter10 = new Vrm10Exporter(_ => false);
var option = new VrmLib.ExportArgs
{
// vrm = false
};
exporter10.Export(null, model, null, option);
var glb10 = UniGLTF.Glb.Parse(exporter10.Storage.ToBytes());
return glb10.ToBytes();
}
}
}