-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
136 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.Threading.Tasks; | ||
using UniGLTF; | ||
using UnityEngine; | ||
|
||
namespace VRM | ||
{ | ||
public interface IVRM0SpringBoneRuntime | ||
{ | ||
public Task InitializeAsync(GameObject vrm, IAwaitCaller awaitCaller); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/VRM/Runtime/SpringBone/IVRM0SpringBoneRuntime.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
Assets/VRM/Runtime/SpringBone/Jobs/FastSpringBoneRuntime.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.Threading.Tasks; | ||
using UniGLTF; | ||
using UniGLTF.SpringBoneJobs; | ||
using UnityEngine; | ||
|
||
namespace VRM | ||
{ | ||
/// <summary> | ||
/// FastSpringbone(job + singleton) で動作します。 | ||
/// | ||
/// VRMSpringBone.m_updateType = Manual | ||
/// | ||
/// により、各VRMSpringBoneの自力Updateは停止します。 | ||
/// FastSpringBoneService に登録します。 | ||
/// FastSpringBoneService.LateUpdate[DefaultExecutionOrder(11000)] で動作します。 | ||
/// </summary> | ||
public class FastSpringboneRuntime : IVRM0SpringBoneRuntime | ||
{ | ||
public async Task InitializeAsync(GameObject vrm, IAwaitCaller awaitCaller) | ||
{ | ||
// default update の停止 | ||
foreach (VRMSpringBone sb in vrm.GetComponentsInChildren<VRMSpringBone>()) | ||
{ | ||
sb.m_updateType = VRMSpringBone.SpringBoneUpdateType.Manual; | ||
} | ||
|
||
// create | ||
var buffer = await SpringBoneJobs.FastSpringBoneReplacer.MakeBufferAsync(vrm, awaitCaller); | ||
SpringBoneJobs.FastSpringBoneService.Instance.BufferCombiner.Register(buffer); | ||
|
||
// disposer | ||
var disposer = vrm.AddComponent<FastSpringBoneDisposer>() | ||
.AddAction(() => | ||
{ | ||
SpringBoneJobs.FastSpringBoneService.Instance.BufferCombiner.Unregister(buffer); | ||
buffer.Dispose(); | ||
}) | ||
; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/VRM/Runtime/SpringBone/Jobs/FastSpringBoneRuntime.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
Assets/VRM/Runtime/SpringBone/VRMSpringBoneDefaultRuntime.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System.Threading.Tasks; | ||
using UniGLTF; | ||
using UnityEngine; | ||
|
||
namespace VRM | ||
{ | ||
/// <summary> | ||
/// デフォルトの VRMSPringBone 実装です。 | ||
/// | ||
/// VRMSpringBone.m_updateType = LateUpdate | ||
/// | ||
/// により、各VRMSpringBoneが自力で LateUpdate に動作します。 | ||
/// </summary> | ||
public class VRMSpringBoneDefaultRuntime : IVRM0SpringBoneRuntime | ||
{ | ||
public async Task InitializeAsync(GameObject vrm, IAwaitCaller awaitCaller) | ||
{ | ||
foreach (VRMSpringBone sb in vrm.GetComponentsInChildren<VRMSpringBone>()) | ||
{ | ||
sb.m_updateType = VRMSpringBone.SpringBoneUpdateType.LateUpdate; | ||
} | ||
await awaitCaller.NextFrame(); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/VRM/Runtime/SpringBone/VRMSpringBoneDefaultRuntime.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters