Example #1
0
        //[NonSerialized]
        //private apAnimCurveTable _prevTable = null;

        //[NonSerialized]
        //private apAnimCurveTable _nextTable = null;

        // Init
        //-------------------------------------------------
        public apAnimCurve()
        {
            if (_prevCurveResult == null)
            {
                _prevCurveResult = new apAnimCurveResult();
            }
            if (_nextCurveResult == null)
            {
                _nextCurveResult = new apAnimCurveResult();
            }
            Init();
        }
Example #2
0
        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
        }
Example #3
0
        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();
            }
        }
Example #4
0
        public void CopyCurve(apAnimCurveResult srcCurveResult)
        {
            if (_curveKeyA == null || _curveKeyB == null)
            {
                return;
            }

            _tangentType = srcCurveResult._tangentType;

            _curveKeyA._nextTangentType = srcCurveResult._curveKeyA._nextTangentType;
            _curveKeyA._nextSmoothX     = srcCurveResult._curveKeyA._nextSmoothX;
            _curveKeyA._nextSmoothY     = srcCurveResult._curveKeyA._nextSmoothY;

            _curveKeyB._prevTangentType = srcCurveResult._curveKeyB._prevTangentType;
            _curveKeyB._prevSmoothX     = srcCurveResult._curveKeyB._prevSmoothX;
            _curveKeyB._prevSmoothY     = srcCurveResult._curveKeyB._prevSmoothY;

            MakeCurve();
        }
Example #5
0
        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();
            }
        }
Example #6
0
        //----------------------------------------------------------------------------------------
        // Draw Curve And Update
        //----------------------------------------------------------------------------------------

        public static void DrawCurve(apAnimCurve curveA, apAnimCurve curveB, apAnimCurveResult curveResult, Color graphColorA, Color graphColorB)
        {
            if (_matBatch == null)
            {
                return;
            }
            if (_matBatch.IsNotReady())
            {
                return;
            }

            //int leftAxisSize = 40;
            //int bottomAxisSize = 5;
            //int margin = 5;



            int leftAxisSize   = 30;
            int bottomAxisSize = 0;
            int margin         = 15;

            int gridWidth  = _layoutWidth - (leftAxisSize + 2 * margin + 4);
            int gridHeight = _layoutHeight - (bottomAxisSize + 2 * margin + 4);

            //TODO
            //1. Grid를 그린다. + Grid의 축에 글씨를 쓴다. (왼쪽에 Percent)
            DrawGrid(leftAxisSize, bottomAxisSize, margin, gridWidth, gridHeight);

            Vector2 posA = new Vector2(leftAxisSize + margin, margin + gridHeight);
            Vector2 posB = new Vector2(leftAxisSize + margin + gridWidth, margin);

            //3. 계산되는 그래프를 BoldLine으로 그린다.
            switch (curveResult.CurveTangentType)
            {
            case apAnimCurve.TANGENT_TYPE.Linear:
            {
                DrawBoldLine(posA, posB, 3, graphColorA, graphColorB, true);
            }
            break;

            case apAnimCurve.TANGENT_TYPE.Smooth:
            {
                DrawSmoothLine(curveA, curveB, graphColorA, graphColorB, posA, posB);
                DrawSmoothLineControlPoints(curveA, curveB, posA, posB);
            }
            break;

            case apAnimCurve.TANGENT_TYPE.Constant:
            {
                Vector2 posC_Bottom = new Vector2((posA.x + posB.x) * 0.5f, posA.y);
                Vector2 posC_Top    = new Vector2((posA.x + posB.x) * 0.5f, posB.y);

                DrawBoldLine(posA, posC_Bottom, 3, graphColorA, true);
                DrawBoldLine(posC_Bottom, posC_Top, 3, graphColorA, graphColorB, true);
                DrawBoldLine(posC_Top, posB, 3, graphColorB, true);
            }
            break;
            }

            //4. 컨트롤 포인트를 그리고 업데이트를 한다.
            DrawBox(posA, 10, 10, Color.white, true);
            DrawBox(posB, 10, 10, Color.white, true);

            if (_isLockMouse && _isMouseEvent)
            {
                if (_leftBtnStatus == apMouse.MouseBtnStatus.Up ||
                    _leftBtnStatus == apMouse.MouseBtnStatus.Released)
                {
                    _isLockMouse      = false;
                    _selectedCurveKey = null;
                }
            }
        }