diff --git a/Assets/VRM10/Runtime/Components/Vrm10Instance/Vrm10InstanceRuntime.cs b/Assets/VRM10/Runtime/Components/Vrm10Instance/Vrm10InstanceRuntime.cs index abb8f84ea..3aa1b3298 100644 --- a/Assets/VRM10/Runtime/Components/Vrm10Instance/Vrm10InstanceRuntime.cs +++ b/Assets/VRM10/Runtime/Components/Vrm10Instance/Vrm10InstanceRuntime.cs @@ -14,7 +14,8 @@ namespace UniVRM10 private readonly Vrm10Instance m_target; private readonly VRM10Constraint[] m_constraints; private readonly Transform m_head; - private readonly FastSpringBoneScope m_fastSpringBoneScope; + private readonly FastSpringBoneService m_fastSpringBoneService; + private readonly FastSpringBoneBuffer m_fastSpringBoneBuffer; public Vrm10InstanceRuntime(Vrm10Instance target) { @@ -34,12 +35,15 @@ namespace UniVRM10 m_constraints = target.GetComponentsInChildren(); } - m_fastSpringBoneScope = CreateFastSpringBoneScheduler(m_target.SpringBone); + m_fastSpringBoneService = FastSpringBoneService.Instance; + m_fastSpringBoneBuffer = CreateFastSpringBoneBuffer(m_target.SpringBone); + + m_fastSpringBoneService.BufferCombiner.Register(m_fastSpringBoneBuffer); } - private FastSpringBoneScope CreateFastSpringBoneScheduler(Vrm10InstanceSpringBone springBone) + private FastSpringBoneBuffer CreateFastSpringBoneBuffer(Vrm10InstanceSpringBone springBone) { - return new FastSpringBoneScope( + return new FastSpringBoneBuffer( springBone.Springs.Select(spring => new FastSpringBoneSpring { center = m_target.SpringBoneCenter, @@ -117,7 +121,8 @@ namespace UniVRM10 public void Dispose() { - m_fastSpringBoneScope.Dispose(); + m_fastSpringBoneService.BufferCombiner.Unregister(m_fastSpringBoneBuffer); + m_fastSpringBoneBuffer.Dispose(); } } } \ No newline at end of file diff --git a/Assets/VRM10/Runtime/FastSpringBone/InputPorts/FastSpringBoneScope.cs b/Assets/VRM10/Runtime/FastSpringBone/InputPorts/FastSpringBoneScope.cs deleted file mode 100644 index 3295744f8..000000000 --- a/Assets/VRM10/Runtime/FastSpringBone/InputPorts/FastSpringBoneScope.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UniVRM10.FastSpringBones.System -{ - /// - /// 1キャラに対応するFastSpringBoneのスコープ - /// - public class FastSpringBoneScope : IDisposable - { - private readonly FastSpringBoneService _service; - private readonly FastSpringBoneBuffer _buffer; - - public FastSpringBoneScope(IReadOnlyList springs) - { - _service = FastSpringBoneService.Instance; - _buffer = new FastSpringBoneBuffer(springs); - - _service.BufferCombiner.Register(_buffer); - } - - public void Dispose() - { - _service.BufferCombiner.Unregister(_buffer); - _buffer.Dispose(); - } - } -} \ No newline at end of file diff --git a/Assets/VRM10/Runtime/FastSpringBone/InputPorts/FastSpringBoneScope.cs.meta b/Assets/VRM10/Runtime/FastSpringBone/InputPorts/FastSpringBoneScope.cs.meta deleted file mode 100644 index f0f75a237..000000000 --- a/Assets/VRM10/Runtime/FastSpringBone/InputPorts/FastSpringBoneScope.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 3531a1098413408f8abf2d7f5f8adca0 -timeCreated: 1633328902 \ No newline at end of file