mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-22 02:24:57 -05:00
fix Flip bug !
This commit is contained in:
@@ -55,22 +55,13 @@ namespace UniGLTF.SpringBoneJobs
|
||||
|
||||
public bool HasBuffer => _batchedBuffers != null && _batchedBuffers.Length > 0;
|
||||
|
||||
int flipPhase = 0;
|
||||
public (NativeArray<Vector3> current, NativeArray<Vector3> prev, NativeArray<Vector3> next) FlipBuffer()
|
||||
public void FlipBuffer()
|
||||
{
|
||||
switch (flipPhase++ % 3)
|
||||
{
|
||||
case 0: return (_currentTails, _prevTails, _nextTails);
|
||||
case 1: return (_nextTails, _currentTails, _prevTails);
|
||||
case 2: return (_prevTails, _nextTails, _currentTails);
|
||||
default:
|
||||
throw new Exception();
|
||||
}
|
||||
// dispose が狂う??
|
||||
// var tmp = _prevTails;
|
||||
// _currentTails = _nextTails;
|
||||
// _prevTails = _currentTails;
|
||||
// _nextTails = tmp;
|
||||
var tmp = _prevTails;
|
||||
_prevTails = _currentTails;
|
||||
_currentTails = _nextTails;
|
||||
_nextTails = tmp;
|
||||
}
|
||||
|
||||
public void Register(FastSpringBoneBuffer buffer)
|
||||
|
||||
@@ -31,15 +31,15 @@ namespace UniGLTF.SpringBoneJobs
|
||||
Transforms = _bufferCombiner.Transforms
|
||||
}.Schedule(_bufferCombiner.TransformAccessArray, handle);
|
||||
|
||||
var (current, prev, next) = _bufferCombiner.FlipBuffer();
|
||||
_bufferCombiner.FlipBuffer();
|
||||
|
||||
handle = new UpdateFastSpringBoneJob
|
||||
{
|
||||
Joints = _bufferCombiner.Joints,
|
||||
Logics = _bufferCombiner.Logics,
|
||||
CurrentTail = current,
|
||||
PrevTail = prev,
|
||||
NextTail = next,
|
||||
CurrentTail = _bufferCombiner.CurrentTails,
|
||||
PrevTail = _bufferCombiner.PrevTails,
|
||||
NextTail = _bufferCombiner.NextTails,
|
||||
Springs = _bufferCombiner.Springs,
|
||||
Colliders = _bufferCombiner.Colliders,
|
||||
Transforms = _bufferCombiner.Transforms,
|
||||
|
||||
Reference in New Issue
Block a user