Пример #1
0
        private void UpdateLipSyncFrame(bool direct)
        {
            if (_isSinging)
            {
                var       currentTime = playerControl.relativeTime;
                LipDeform deform;

                if (direct)
                {
                    deform = _currLipDeform;
                }
                else
                {
                    if (currentTime < _lipSyncStartTime + LipTransitionTime)
                    {
                        var t = (currentTime - _lipSyncStartTime) / LipTransitionTime;
                        deform = LipDeform.Lerp(_prevLipDeform, _currLipDeform, t);
                    }
                    else
                    {
                        deform = _currLipDeform;
                    }
                }

                PutLipFrame(in deform);
            }
            else
            {
                PutLipFrame(LipDeform.Silence());
            }
        }
Пример #2
0
        private void InitStates()
        {
            _currentTick = 0;

            _isSinging = true;

            _currLipDeform = LipDeform.Silence();
            _prevLipDeform = LipDeform.Silence();

            Array.Clear(_currFacialExpression, 0, _currFacialExpression.Length);
            Array.Clear(_prevFacialExpression, 0, _prevFacialExpression.Length);
            _currFacialExprKey = 0;
            _prevFacialExprKey = 0;

            _prevEyeClosed = false;
            _currEyeClosed = false;

            Array.Clear(_currBlendShapeValues, 0, _currBlendShapeValues.Length);

            AnimateFace(true);
        }