mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-13 14:04:29 -05:00
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using UniGLTF;
|
|
using UnityEngine;
|
|
|
|
namespace UniVRM10
|
|
{
|
|
public static class TestVrm10
|
|
{
|
|
public static Vrm10Instance LoadBytesAsBuiltInRP(byte[] bytes, bool canLoadVrm0X = true)
|
|
{
|
|
return Vrm10.LoadBytesAsync(
|
|
bytes,
|
|
canLoadVrm0X: canLoadVrm0X,
|
|
awaitCaller: new ImmediateCaller(),
|
|
materialGenerator: new BuiltInVrm10MaterialDescriptorGenerator()
|
|
).Result;
|
|
}
|
|
|
|
public static Vrm10Instance LoadPathAsBuiltInRP(string path, bool canLoadVrm0X = true)
|
|
{
|
|
return Vrm10.LoadPathAsync(
|
|
path,
|
|
canLoadVrm0X: canLoadVrm0X,
|
|
awaitCaller: new ImmediateCaller(),
|
|
materialGenerator: new BuiltInVrm10MaterialDescriptorGenerator()
|
|
).Result;
|
|
}
|
|
|
|
public static byte[] ExportAsBuiltInRP(GameObject gameObject)
|
|
{
|
|
return Vrm10Exporter.Export(
|
|
new(),
|
|
gameObject,
|
|
materialExporter: new BuiltInVrm10MaterialExporter(),
|
|
textureSerializer: new EditorTextureSerializer()
|
|
);
|
|
}
|
|
}
|
|
} |