mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-19 17:27:56 -05:00
* UniGLTF.GltfTextureExporter.GetBytesWithMime を VRMShaders.AssetTextureUtil.GetTextureBytesWithMime に移動 * テスト NotReadable, Compressed を VRMShaders に移動 * テスト用リソース Resources/4x4.png と 4x4compressed.DDS を VRMShaders に移動
23 lines
622 B
C#
23 lines
622 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
|
|
namespace UniVRM10
|
|
{
|
|
public static class ModelExtensions
|
|
{
|
|
public static byte[] ToGlb(this VrmLib.Model model, Func<Texture2D, (byte[], string)> getTextureBytes)
|
|
{
|
|
// export vrm-1.0
|
|
var exporter10 = new Vrm10Exporter(_ => false);
|
|
var option = new VrmLib.ExportArgs
|
|
{
|
|
// vrm = false
|
|
};
|
|
exporter10.Export(null, model, null, option, getTextureBytes);
|
|
var glb10 = UniGLTF.Glb.Parse(exporter10.Storage.ToBytes());
|
|
return glb10.ToBytes();
|
|
}
|
|
}
|
|
}
|