rm fastSpringBoneScope

This commit is contained in:
notargs
2021-10-06 14:56:50 +09:00
parent 88d61d32a0
commit 55d8bcbd1c
3 changed files with 10 additions and 37 deletions

View File

@@ -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<VRM10Constraint>();
}
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();
}
}
}

View File

@@ -1,29 +0,0 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace UniVRM10.FastSpringBones.System
{
/// <summary>
/// 1キャラに対応するFastSpringBoneのスコープ
/// </summary>
public class FastSpringBoneScope : IDisposable
{
private readonly FastSpringBoneService _service;
private readonly FastSpringBoneBuffer _buffer;
public FastSpringBoneScope(IReadOnlyList<FastSpringBoneSpring> springs)
{
_service = FastSpringBoneService.Instance;
_buffer = new FastSpringBoneBuffer(springs);
_service.BufferCombiner.Register(_buffer);
}
public void Dispose()
{
_service.BufferCombiner.Unregister(_buffer);
_buffer.Dispose();
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 3531a1098413408f8abf2d7f5f8adca0
timeCreated: 1633328902