mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-14 06:19:47 -05:00
Merge pull request #2297 from Santarh/asyncLoad
Run parsing of vrm10 files on a thread pool.
This commit is contained in:
commit
7a5d0beb60
|
|
@ -52,7 +52,11 @@ namespace UniVRM10
|
|||
? new RuntimeOnlyAwaitCaller()
|
||||
: new ImmediateCaller();
|
||||
|
||||
using var gltfData = new GlbLowLevelParser(path, File.ReadAllBytes(path)).Parse();
|
||||
using var gltfData = await awaitCaller.Run(() =>
|
||||
{
|
||||
var bytes = File.ReadAllBytes(path);
|
||||
return new GlbLowLevelParser(path, bytes).Parse();
|
||||
});
|
||||
return await LoadAsync(
|
||||
gltfData,
|
||||
canLoadVrm0X,
|
||||
|
|
@ -96,7 +100,7 @@ namespace UniVRM10
|
|||
? new RuntimeOnlyAwaitCaller()
|
||||
: new ImmediateCaller();
|
||||
|
||||
using var gltfData = new GlbLowLevelParser(string.Empty, bytes).Parse();
|
||||
using var gltfData = await awaitCaller.Run(() => new GlbLowLevelParser(string.Empty, bytes).Parse());
|
||||
return await LoadAsync(
|
||||
gltfData,
|
||||
canLoadVrm0X,
|
||||
|
|
|
|||
20
Assets/VRM10/Tests/Vrm10ApiTests.cs
Normal file
20
Assets/VRM10/Tests/Vrm10ApiTests.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using NUnit.Framework;
|
||||
using VRMShaders;
|
||||
|
||||
namespace UniVRM10.Test
|
||||
{
|
||||
public sealed class Vrm10ApiTests
|
||||
{
|
||||
[Test]
|
||||
public void LoadImmediately()
|
||||
{
|
||||
var loadTask = Vrm10.LoadPathAsync(
|
||||
TestAsset.AliciaPath,
|
||||
canLoadVrm0X: true,
|
||||
awaitCaller: new ImmediateCaller()
|
||||
);
|
||||
|
||||
Assert.AreEqual(true, loadTask.IsCompleted);
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/VRM10/Tests/Vrm10ApiTests.cs.meta
Normal file
3
Assets/VRM10/Tests/Vrm10ApiTests.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6bf6de3c68bf4a5994e2b5739f60b913
|
||||
timeCreated: 1716261790
|
||||
Loading…
Reference in New Issue
Block a user