//public void SetKeyItpType(KEY_ITP_TYPE keyItpType) //{ // switch (keyItpType) // { // case KEY_ITP_TYPE.AutoSmooth: // //여기서는 값을 처리하지 않는다. // //Flat 처럼 값이 들어가지만 따로 계산하여 사용 // { // if(_keyItpType != KEY_ITP_TYPE.AutoSmooth) // { // //바뀔때는 기본적으로 Flat을 기본으로 하며, 실시간으로 비슷하게 세팅 // SetSmoothAngle(Vector4.zero, KEY_POS.PREV); // SetSmoothAngle(Vector4.zero, KEY_POS.NEXT); // CalculateSmooth(); // } // } // break; // case KEY_ITP_TYPE.FreeSmooth: // //기존 값을 활용/절충한다. // { // if (_keyItpType != KEY_ITP_TYPE.FreeSmooth) // { // Vector4 avgAngle = (_prevSmoothAngle + _nextSmoothAngle) * 0.5f; // SetSmoothAngle(avgAngle, KEY_POS.PREV); // SetSmoothAngle(avgAngle, KEY_POS.NEXT); // } // } // break; // case KEY_ITP_TYPE.FlatSmooth: // { // //언제나 0이다. // SetSmoothAngle(Vector4.zero, KEY_POS.PREV); // SetSmoothAngle(Vector4.zero, KEY_POS.NEXT); // } // break; // case KEY_ITP_TYPE.Broken: // { // if(_keyItpType != KEY_ITP_TYPE.Broken) // { // //Broken이 아니었다면 // //양쪽 Tangent는 모두 Smooth였을 것이다. // _prevTangentType = TANGENT_TYPE.Smooth; // _nextTangentType = TANGENT_TYPE.Smooth; // } // } // break; // } // _keyItpType = keyItpType; //} //public void SetSmoothAngle(Vector4 angle, KEY_POS keyPos) //{ // if (keyPos == KEY_POS.PREV) // { // //Prev // _prevSmoothAngle.x = Mathf.Clamp(angle.x, MIN_ANGLE, MAX_ANGLE); // if (_dimension > 1) { _prevSmoothAngle.y = Mathf.Clamp(angle.y, MIN_ANGLE, MAX_ANGLE); } // if (_dimension > 2) { _prevSmoothAngle.z = Mathf.Clamp(angle.z, MIN_ANGLE, MAX_ANGLE); } // if (_dimension > 3) { _prevSmoothAngle.w = Mathf.Clamp(angle.w, MIN_ANGLE, MAX_ANGLE); } // _prevSmoothYOffset.x = -1.0f * Mathf.Tan(_prevSmoothAngle.x * Mathf.Deg2Rad) * CONTROL_POINT_X_OFFSET * _prevDeltaX; // if (_dimension > 1) { _prevSmoothYOffset.y = -1.0f * Mathf.Tan(_prevSmoothAngle.y * Mathf.Deg2Rad) * CONTROL_POINT_X_OFFSET * _prevDeltaX; } // if (_dimension > 2) { _prevSmoothYOffset.z = -1.0f * Mathf.Tan(_prevSmoothAngle.z * Mathf.Deg2Rad) * CONTROL_POINT_X_OFFSET * _prevDeltaX; } // if (_dimension > 3) { _prevSmoothYOffset.w = -1.0f * Mathf.Tan(_prevSmoothAngle.w * Mathf.Deg2Rad) * CONTROL_POINT_X_OFFSET * _prevDeltaX; } // } // else // { // //Next // _nextSmoothAngle.x = Mathf.Clamp(angle.x, MIN_ANGLE, MAX_ANGLE); // if (_dimension > 1) { _nextSmoothAngle.y = Mathf.Clamp(angle.y, MIN_ANGLE, MAX_ANGLE); } // if (_dimension > 2) { _nextSmoothAngle.z = Mathf.Clamp(angle.z, MIN_ANGLE, MAX_ANGLE); } // if (_dimension > 3) { _nextSmoothAngle.w = Mathf.Clamp(angle.w, MIN_ANGLE, MAX_ANGLE); } // _nextSmoothYOffset.x = Mathf.Tan(_nextSmoothAngle.x * Mathf.Deg2Rad) * CONTROL_POINT_X_OFFSET * _nextDeltaX; // if (_dimension > 1) { _nextSmoothYOffset.y = Mathf.Tan(_nextSmoothAngle.y * Mathf.Deg2Rad) * CONTROL_POINT_X_OFFSET * _nextDeltaX; } // if (_dimension > 2) { _nextSmoothYOffset.z = Mathf.Tan(_nextSmoothAngle.z * Mathf.Deg2Rad) * CONTROL_POINT_X_OFFSET * _nextDeltaX; } // if (_dimension > 3) { _nextSmoothYOffset.w = Mathf.Tan(_nextSmoothAngle.w * Mathf.Deg2Rad) * CONTROL_POINT_X_OFFSET * _nextDeltaX; } // } //} //public void SetSmoothYOffset(Vector4 yOffset, KEY_POS keyPos) //{ // if(keyPos == KEY_POS.PREV) // { // //Prev // float deltaX = Mathf.Max(_prevDeltaX, 0.0001f); // _prevSmoothYOffset = yOffset; // _prevSmoothAngle.x = Mathf.Clamp(Mathf.Atan2(-_prevSmoothYOffset.x, CONTROL_POINT_X_OFFSET * deltaX) * Mathf.Rad2Deg, MIN_ANGLE, MAX_ANGLE); // if (_dimension > 1) { _prevSmoothAngle.y = Mathf.Clamp(Mathf.Atan2(-_prevSmoothYOffset.y, CONTROL_POINT_X_OFFSET * deltaX) * Mathf.Rad2Deg, MIN_ANGLE, MAX_ANGLE); } // if (_dimension > 2) { _prevSmoothAngle.z = Mathf.Clamp(Mathf.Atan2(-_prevSmoothYOffset.z, CONTROL_POINT_X_OFFSET * deltaX) * Mathf.Rad2Deg, MIN_ANGLE, MAX_ANGLE); } // if (_dimension > 3) { _prevSmoothAngle.w = Mathf.Clamp(Mathf.Atan2(-_prevSmoothYOffset.w, CONTROL_POINT_X_OFFSET * deltaX) * Mathf.Rad2Deg, MIN_ANGLE, MAX_ANGLE); } // } // else // { // //Next // float deltaX = Mathf.Max(_nextDeltaX, 0.0001f); // _nextSmoothYOffset = yOffset; // _nextSmoothAngle.x = Mathf.Clamp(Mathf.Atan2(_nextSmoothYOffset.x, CONTROL_POINT_X_OFFSET * deltaX) * Mathf.Rad2Deg, MIN_ANGLE, MAX_ANGLE); // if (_dimension > 1) { _nextSmoothAngle.y = Mathf.Clamp(Mathf.Atan2(_nextSmoothYOffset.y, CONTROL_POINT_X_OFFSET * deltaX) * Mathf.Rad2Deg, MIN_ANGLE, MAX_ANGLE); } // if (_dimension > 2) { _nextSmoothAngle.z = Mathf.Clamp(Mathf.Atan2(_nextSmoothYOffset.z, CONTROL_POINT_X_OFFSET * deltaX) * Mathf.Rad2Deg, MIN_ANGLE, MAX_ANGLE); } // if (_dimension > 3) { _nextSmoothAngle.w = Mathf.Clamp(Mathf.Atan2(_nextSmoothYOffset.w, CONTROL_POINT_X_OFFSET * deltaX) * Mathf.Rad2Deg, MIN_ANGLE, MAX_ANGLE); } // } //} #endregion public void SetTangentType(TANGENT_TYPE tangentType, KEY_POS keyPos) { #region [미사용 코드] //if(_isRelativeKeyValue) { return; } //if(_keyItpType != KEY_ITP_TYPE.Broken) //{ // //Broken 타입이 아니면 무조건 Smooth 타입이다. // _prevTangentType = TANGENT_TYPE.Smooth; // _nextTangentType = TANGENT_TYPE.Smooth; // return; //} #endregion if (keyPos == KEY_POS.PREV) { //Prev _prevTangentType = tangentType; } else { //Next _nextTangentType = tangentType; } Refresh(); }
public apAnimCurve(apAnimCurve srcCurve, int keyIndex) { _prevTangentType = srcCurve._prevTangentType; _prevSmoothX = srcCurve._prevSmoothX; _prevSmoothY = srcCurve._prevSmoothY; #region [미사용 코드] //_prevSmoothAngle = srcCurve._prevSmoothAngle; //_prevSmoothYOffset = srcCurve._prevSmoothYOffset; //_prevDeltaX = srcCurve._prevDeltaX; //_prevDeltaY = srcCurve._prevDeltaY; #endregion _prevLinkedCurveKey = srcCurve._prevLinkedCurveKey; _nextTangentType = srcCurve._nextTangentType; _nextSmoothX = srcCurve._nextSmoothX; _nextSmoothY = srcCurve._nextSmoothY; #region [미사용 코드] //_nextSmoothAngle = srcCurve._nextSmoothAngle; //_nextSmoothYOffset = srcCurve._nextSmoothYOffset; //_nextDeltaX = srcCurve._nextDeltaX; //_nextDeltaY = srcCurve._nextDeltaY; #endregion _nextLinkedCurveKey = srcCurve._nextLinkedCurveKey; //_keyItpType = srcCurve._keyItpType; _keyIndex = keyIndex; //<키 인덱스만 따로 분리해서 복사한다. _prevIndex = keyIndex; _nextIndex = keyIndex; if (_prevCurveResult == null) { _prevCurveResult = new apAnimCurveResult(); } if (_nextCurveResult == null) { _nextCurveResult = new apAnimCurveResult(); } #region [미사용 코드] //_keyValue = srcCurve._keyValue; //_dimension = srcCurve._dimension; //_isRelativeKeyValue = srcCurve._isRelativeKeyValue; //_smoothRelativeWeight = srcCurve._smoothRelativeWeight; #endregion }
public void Init() { //_keyItpType = KEY_ITP_TYPE.AutoSmooth; _prevTangentType = TANGENT_TYPE.Smooth; _nextTangentType = TANGENT_TYPE.Smooth; _prevSmoothX = CONTROL_POINT_X_OFFSET; _prevSmoothY = 0.0f; _nextSmoothX = CONTROL_POINT_X_OFFSET; _nextSmoothY = 0.0f; #region [미사용 코드] //SetSmoothAngle(Vector4.zero, KEY_POS.PREV); //SetSmoothAngle(Vector4.zero, KEY_POS.NEXT); #endregion _prevLinkedCurveKey = null; _nextLinkedCurveKey = null; #region [미사용 코드] //_prevDeltaX = 1.0f; //_prevDeltaY = Vector4.zero; //_nextDeltaX = 1.0f; //_nextDeltaY = Vector4.zero; //_isRelativeKeyValue = false; //_smoothRelativeWeight = MIN_RELATIVE_WEIGHT; #endregion //_prevTable = new apAnimCurveTable(this); //_nextTable = new apAnimCurveTable(this); if (_prevCurveResult == null) { _prevCurveResult = new apAnimCurveResult(); } if (_nextCurveResult == null) { _nextCurveResult = new apAnimCurveResult(); } }
public apAnimCurve(apAnimCurve srcCurve_Prev, apAnimCurve srcCurve_Next, int keyIndex) { //Prev는 Next의 Prev를 사용한다. _prevTangentType = srcCurve_Next._prevTangentType; _prevSmoothX = srcCurve_Next._prevSmoothX; _prevSmoothY = srcCurve_Next._prevSmoothY; _prevLinkedCurveKey = srcCurve_Next._prevLinkedCurveKey; //Next는 Prev의 Next를 사용한다. _nextTangentType = srcCurve_Prev._nextTangentType; _nextSmoothX = srcCurve_Prev._nextSmoothX; _nextSmoothY = srcCurve_Prev._nextSmoothY; _nextLinkedCurveKey = srcCurve_Prev._nextLinkedCurveKey; //_keyItpType = srcCurve._keyItpType; _keyIndex = keyIndex; //<키 인덱스만 따로 분리해서 복사한다. _prevIndex = keyIndex; _nextIndex = keyIndex; if (_prevCurveResult == null) { _prevCurveResult = new apAnimCurveResult(); } if (_nextCurveResult == null) { _nextCurveResult = new apAnimCurveResult(); } }