Exemplo n.º 1
0
 private bool ResultMatrixBone(FakeTransform _ftransResult, CBoneData _Bone, int _nIdx)
 {
     _ftransResult.Pos   = _Bone.Bone.transFrame.get_localPosition();
     _ftransResult.Rot   = _Bone.Bone.transFrame.get_localRotation();
     _ftransResult.Scale = _Bone.Bone.transFrame.get_localScale();
     return(true);
 }
Exemplo n.º 2
0
        private bool CalcAutoRotation(
            FakeTransform _ftransBlend,
            FakeTransform _ftransBase,
            Transform _transRef,
            CSwayParamDetail _Detail)
        {
            Quaternion.get_identity();
            float  num1 = 1f;
            float  num2 = 1f;
            double num3;
            float  num4 = (float)(num3 = 1.0);
            float  num5 = 0.0f;

            num4 = 0.0f;
            float num6 = Vector3.Dot(Vector3.get_up(), _transRef.get_up());
            float num7 = Vector3.Dot(Vector3.get_up(), _transRef.get_forward());
            float num8 = Vector3.Dot(Vector3.get_up(), _transRef.get_right());
            float num9 = Mathf.Abs(num6);

            if ((double)num7 > 0.0)
            {
                num1 = -1f;
            }
            float num10 = Mathf.Abs(num7);

            if ((double)num8 > 0.0)
            {
                num2 = -1f;
            }
            float num11     = Mathf.Abs(num8);
            float num12     = Mathf.InverseLerp(1f, 0.0f, num9) * Mathf.InverseLerp(0.0f, 1f, num11);
            float fAutoRot1 = _Detail.fAutoRot;

            if ((double)num2 < 0.0)
            {
                fAutoRot1 *= -1f;
            }
            float num13 = Mathf.Lerp(0.0f, fAutoRot1, num12);

            if (!_Detail.bAutoRotUp || (double)num1 > 0.0)
            {
                float num14     = Mathf.InverseLerp(1f, 0.0f, num9) * Mathf.InverseLerp(0.0f, 1f, num10);
                float fAutoRot2 = _Detail.fAutoRot;
                if (!((double)num1 <= 0.0 ? !this.m_bLR : this.m_bLR))
                {
                    fAutoRot2 *= -1f;
                }
                num5 = Mathf.Lerp(0.0f, fAutoRot2, num14);
            }
            Quaternion quaternion = Quaternion.AngleAxis(MathfEx.ToDegree(num5 + num13), Vector3.get_up());

            _ftransBlend.Rot   = Quaternion.op_Multiply(_ftransBase.Rot, quaternion);
            _ftransBlend.Pos   = _ftransBase.Pos;
            _ftransBlend.Scale = _ftransBase.Scale;
            return(true);
        }
Exemplo n.º 3
0
        private bool ResultMatrixLocater(FakeTransform _ftransResult, CBoneData _Bone, int _nIdx)
        {
            bool          flag1         = true;
            bool          bAutoRotProc  = this.m_Param.listDetail[_nIdx].bAutoRotProc;
            FakeTransform _ftransBlend1 = new FakeTransform();
            FakeTransform _ftransBlend2 = new FakeTransform();
            bool          flag2         = flag1 & this.CalcBlendMatrixR(_ftransBlend1, _Bone, false, this.m_Param.listDetail[_nIdx], true, bAutoRotProc) & this.CalcBlendMatrixT(_ftransBlend2, _Bone, false, this.m_Param.listDetail[_nIdx]);

            _ftransResult.Pos   = _ftransBlend2.Pos;
            _ftransResult.Rot   = _ftransBlend1.Rot;
            _ftransResult.Scale = _ftransBlend1.Scale;
            return(true);
        }
Exemplo n.º 4
0
        private bool TransformRotateAndTrans(
            FakeTransform _ftransResult,
            CBoneData _Bone,
            int _nIdx,
            FakeTransform _ftransBaseT,
            FakeTransform _ftransBaseR)
        {
            FakeTransform    fakeTransform1   = new FakeTransform();
            CSwayParamDetail cswayParamDetail = this.m_Param.listDetail[_nIdx];
            Quaternion       quaternion1      = Quaternion.AngleAxis((float)this.m_listRot[_nIdx].x * _Bone.fScaleR, Vector3.get_right());
            Quaternion       quaternion2      = Quaternion.AngleAxis((float)this.m_listRot[_nIdx].y * _Bone.fScaleR, Vector3.get_up());

            fakeTransform1.Rot = Quaternion.op_Multiply(quaternion1, quaternion2);
            Vector3 vector3;

            ((Vector3) ref vector3).\u002Ector(_Bone.fScaleT, _Bone.fScaleT, _Bone.fScaleT);
            if (this.m_listSpringCtrl[_nIdx].listPoint[0].vPos.y >= 0.0)
            {
                vector3.y = (__Null)(double)_Bone.fScaleYT;
            }
            fakeTransform1.Pos = Vector3.Scale(this.m_listSpringCtrl[_nIdx].listPoint[0].vPos, vector3);
            FakeTransform fakeTransform2 = fakeTransform1;

            fakeTransform2.Pos = Vector3.op_Addition(fakeTransform2.Pos, _ftransBaseT.Pos);
            float num1;
            float num2;
            float num3;

            if (fakeTransform1.Pos.z > 0.0)
            {
                float num4 = Mathf.InverseLerp(0.0f, (float)cswayParamDetail.vLimitMaxT.z, (float)fakeTransform1.Pos.z);
                num1 = Mathf.Lerp(1f, cswayParamDetail.fCrushZMax, num4) * (float)cswayParamDetail.vAddS.z;
                float num5 = Mathf.Lerp(1f, cswayParamDetail.fCrushXYMin, num4);
                num2 = num5 * (float)cswayParamDetail.vAddS.y;
                num3 = num5 * (float)cswayParamDetail.vAddS.x;
            }
            else
            {
                float num4 = Mathf.InverseLerp(0.0f, (float)cswayParamDetail.vLimitMinT.z, (float)fakeTransform1.Pos.z);
                num1 = Mathf.Lerp(1f, cswayParamDetail.fCrushZMin, num4) * (float)cswayParamDetail.vAddS.z;
                float num5 = Mathf.Lerp(1f, cswayParamDetail.fCrushXYMax, num4);
                num2 = num5 * (float)cswayParamDetail.vAddS.y;
                num3 = num5 * (float)cswayParamDetail.vAddS.x;
            }
            _ftransResult.Rot   = Quaternion.op_Multiply(fakeTransform1.Rot, _ftransBaseR.Rot);
            _ftransResult.Pos   = fakeTransform1.Pos;
            _ftransResult.Scale = Vector3.Scale(new Vector3(num3, num2, num1), _ftransBaseR.Scale);
            return(true);
        }
Exemplo n.º 5
0
        private bool CalcBlendMatrixT(
            FakeTransform _ftransBlend,
            CBoneData _Bone,
            bool _bWorld,
            CSwayParamDetail _Detail)
        {
            CFrameInfo    cframeInfo1    = _Bone.listLocater[(int)_Bone.anLocaterTIdx[0]];
            CFrameInfo    cframeInfo2    = _Bone.listLocater[(int)_Bone.anLocaterTIdx[1]];
            FakeTransform target         = new FakeTransform();
            FakeTransform fakeTransform1 = new FakeTransform();
            FakeTransform fakeTransform2 = new FakeTransform();

            target.Pos           = cframeInfo1.transFrame.get_localPosition();
            target.Rot           = cframeInfo1.transFrame.get_localRotation();
            target.Scale         = cframeInfo1.transFrame.get_localScale();
            fakeTransform1.Pos   = cframeInfo2.transFrame.get_localPosition();
            fakeTransform1.Rot   = cframeInfo2.transFrame.get_localRotation();
            fakeTransform1.Scale = cframeInfo2.transFrame.get_localScale();
            if (this.m_bLR)
            {
                ((Vector3) ref fakeTransform2.Pos).Set((float)-_Detail.vAddT.x, (float)_Detail.vAddT.y, (float)_Detail.vAddT.z);
            }
            else
            {
                ((Vector3) ref fakeTransform2.Pos).Set((float)_Detail.vAddT.x, (float)_Detail.vAddT.y, (float)_Detail.vAddT.z);
            }
            FakeTransform fakeTransform3 = target;

            fakeTransform3.Pos = Vector3.op_Addition(fakeTransform3.Pos, fakeTransform2.Pos);
            FakeTransform fakeTransform4 = fakeTransform1;

            fakeTransform4.Pos = Vector3.op_Addition(fakeTransform4.Pos, fakeTransform2.Pos);
            if (_bWorld)
            {
                target.Pos         = cframeInfo1.transParent.TransformPoint(target.Pos);
                target.Rot         = cframeInfo1.transFrame.get_rotation();
                fakeTransform1.Pos = cframeInfo2.transParent.TransformPoint(fakeTransform1.Pos);
                fakeTransform1.Rot = cframeInfo2.transFrame.get_rotation();
            }
            if ((int)_Bone.anLocaterTIdx[0] == (int)_Bone.anLocaterTIdx[1])
            {
                _ftransBlend = (FakeTransform)target.DeepCopy();
                return(true);
            }
            _ftransBlend.Pos   = Vector3.Lerp(target.Pos, fakeTransform1.Pos, _Bone.fLerp);
            _ftransBlend.Rot   = Quaternion.Slerp(target.Rot, fakeTransform1.Rot, _Bone.fLerp);
            _ftransBlend.Scale = Vector3.Lerp(target.Scale, fakeTransform1.Scale, _Bone.fLerp);
            return(true);
        }
Exemplo n.º 6
0
        private bool ResultMatrixProgram(FakeTransform _ftransResult, CBoneData _Bone, int _nIdx)
        {
            BoneSway.ResultTransformFunc[] resultTransformFuncArray = new BoneSway.ResultTransformFunc[3]
            {
                new BoneSway.ResultTransformFunc(this.TransformRotateAndTrans),
                new BoneSway.ResultTransformFunc(this.TransformRotate),
                new BoneSway.ResultTransformFunc(this.TransformTrans)
            };
            bool          flag           = true;
            bool          bAutoRotProc   = this.m_Param.listDetail[_nIdx].bAutoRotProc;
            FakeTransform fakeTransform1 = new FakeTransform();
            FakeTransform fakeTransform2 = new FakeTransform();

            return(flag & this.CalcBlendMatrixR(fakeTransform1, _Bone, false, this.m_Param.listDetail[_nIdx], true, bAutoRotProc) & this.CalcBlendMatrixT(fakeTransform2, _Bone, false, this.m_Param.listDetail[_nIdx]) & resultTransformFuncArray[(int)_Bone.nTransformKind](_ftransResult, _Bone, _nIdx, fakeTransform2, fakeTransform1));
        }
Exemplo n.º 7
0
        public bool AutoProc(float _ftime, bool _bCatch, CBoneBlend _Blend, int _nBoneIdx)
        {
            bool          flag1        = true;
            FakeTransform _ftransBlend = new FakeTransform();
            bool          flag2        = flag1 & this.CalcBlendMatrixT(_ftransBlend, this.m_listBone[_nBoneIdx], true, this.m_Param.listDetail[_nBoneIdx]);

            this.m_listObjCalc[0].get_transform().set_position(_ftransBlend.Pos);
            this.m_listObjCalc[0].get_transform().set_rotation(_ftransBlend.Rot);
            bool flag3 = flag2 & this.CalcForce(this.m_listObjCalc[0].get_transform(), _nBoneIdx);

            if (_bCatch && (int)this.getBoneCatch() == _nBoneIdx)
            {
                this.m_listSpringCtrl[_nBoneIdx].ResetAllForce();
            }
            else
            {
                flag3 = flag3 & this.m_listSpringCtrl[_nBoneIdx].UpdateEulerMethod(this.m_listObjCalc[0].get_transform(), _ftime) & this.MoveLimit(_nBoneIdx);
            }
            bool flag4 = flag3 & this.CalcRot(_nBoneIdx);

            BoneSway.ResultMatrixFunc[] resultMatrixFuncArray = new BoneSway.ResultMatrixFunc[3]
            {
                new BoneSway.ResultMatrixFunc(this.ResultMatrixProgram),
                new BoneSway.ResultMatrixFunc(this.ResultMatrixLocater),
                new BoneSway.ResultMatrixFunc(this.ResultMatrixBone)
            };
            if (_Blend.bBlend)
            {
                byte          nCalcKind1     = _Blend.pNowParam.listDetail[_nBoneIdx].Calc.nCalcKind;
                byte          nCalcKind2     = _Blend.pNextParam.listDetail[_nBoneIdx].Calc.nCalcKind;
                FakeTransform _ftransResult1 = new FakeTransform();
                FakeTransform _ftransResult2 = new FakeTransform();
                int           num1           = resultMatrixFuncArray[(int)nCalcKind1](_ftransResult1, this.m_listBone[_nBoneIdx], _nBoneIdx) ? 1 : 0;
                int           num2           = resultMatrixFuncArray[(int)nCalcKind2](_ftransResult2, this.m_listBone[_nBoneIdx], _nBoneIdx) ? 1 : 0;
                this.m_listBone[_nBoneIdx].transResult.Pos   = Vector3.Lerp(_ftransResult1.Pos, _ftransResult2.Pos, _Blend.fLerp);
                this.m_listBone[_nBoneIdx].transResult.Rot   = Quaternion.Lerp(_ftransResult1.Rot, _ftransResult2.Rot, _Blend.fLerp);
                this.m_listBone[_nBoneIdx].transResult.Scale = Vector3.Lerp(_ftransResult1.Scale, _ftransResult2.Scale, _Blend.fLerp);
            }
            else
            {
                FakeTransform fakeTransform = new FakeTransform();
                int           num           = resultMatrixFuncArray[(int)this.m_listBone[_nBoneIdx].nCalcKind](fakeTransform, this.m_listBone[_nBoneIdx], _nBoneIdx) ? 1 : 0;
                this.m_listBone[_nBoneIdx].transResult = (FakeTransform)fakeTransform.DeepCopy();
            }
            this.m_listSpringCtrl[_nBoneIdx].setForce = Vector3.get_zero();
            return(true);
        }
Exemplo n.º 8
0
        private bool TransformRotate(
            FakeTransform _ftransResult,
            CBoneData _Bone,
            int _nIdx,
            FakeTransform _ftransBaseT,
            FakeTransform _ftransBaseR)
        {
            FakeTransform    fakeTransform    = new FakeTransform();
            CSwayParamDetail cswayParamDetail = this.m_Param.listDetail[_nIdx];
            Quaternion       quaternion1      = Quaternion.AngleAxis((float)this.m_listRot[_nIdx].x * _Bone.fScaleR, Vector3.get_right());
            Quaternion       quaternion2      = Quaternion.AngleAxis((float)this.m_listRot[_nIdx].y * _Bone.fScaleR, Vector3.get_up());

            fakeTransform.Rot   = Quaternion.op_Multiply(quaternion1, quaternion2);
            _ftransResult.Rot   = Quaternion.op_Multiply(fakeTransform.Rot, _ftransBaseR.Rot);
            _ftransResult.Pos   = _ftransBaseR.Pos;
            _ftransResult.Scale = Vector3.Scale(cswayParamDetail.vAddS, _ftransBaseR.Scale);
            return(true);
        }
Exemplo n.º 9
0
        public bool CatchProc(Transform _transRef, float _fmx, float _fmy, int _nBoneIdx)
        {
            bool          flag1        = true;
            FakeTransform _ftransBlend = new FakeTransform();
            bool          flag2        = flag1 & this.CalcBlendMatrixT(_ftransBlend, this.m_listBone[_nBoneIdx], true, this.m_Param.listDetail[_nBoneIdx]);
            Vector3       vector3_1;

            ((Vector3) ref vector3_1).\u002Ector(_fmx, _fmy, 0.0f);
            Vector3 vector3_2 = _transRef.TransformPoint(vector3_1);

            this.m_listObjCalc[0].get_transform().Identity();
            this.m_listObjCalc[0].get_transform().set_position(_ftransBlend.Pos);
            this.m_listObjCalc[0].get_transform().set_rotation(_ftransBlend.Rot);
            this.m_listObjCalc[0].get_transform().set_localScale(_ftransBlend.Scale);
            Vector3 vector3_3 = this.m_listObjCalc[0].get_transform().InverseTransformVector(_transRef.get_position());
            Vector3 vector3_4 = Vector3.op_Subtraction(this.m_listObjCalc[0].get_transform().InverseTransformVector(vector3_2), vector3_3);

            SpringCtrl.CSpringPoint cspringPoint = this.m_listSpringCtrl[_nBoneIdx].listPoint[0];
            cspringPoint.vPos = Vector3.op_Addition(cspringPoint.vPos, vector3_4);
            return(flag2 & this.MoveLimit(_nBoneIdx));
        }
Exemplo n.º 10
0
        private bool CalcBlendMatrixR(
            FakeTransform _ftransBlend,
            CBoneData _Bone,
            bool _bWorld,
            CSwayParamDetail _Detail,
            bool _bAddRot,
            bool _bRot)
        {
            CFrameInfo    cframeInfo1    = _Bone.listLocater[(int)_Bone.anLocaterRIdx[0]];
            CFrameInfo    cframeInfo2    = _Bone.listLocater[(int)_Bone.anLocaterRIdx[1]];
            CFrameInfo    reference      = _Bone.Reference;
            FakeTransform fakeTransform1 = new FakeTransform();
            FakeTransform fakeTransform2 = new FakeTransform();
            FakeTransform fakeTransform3 = new FakeTransform();
            FakeTransform fakeTransform4 = new FakeTransform();

            fakeTransform1.Pos   = cframeInfo1.transFrame.get_localPosition();
            fakeTransform1.Rot   = cframeInfo1.transFrame.get_localRotation();
            fakeTransform1.Scale = cframeInfo1.transFrame.get_localScale();
            fakeTransform2.Pos   = cframeInfo2.transFrame.get_localPosition();
            fakeTransform2.Rot   = cframeInfo2.transFrame.get_localRotation();
            fakeTransform2.Scale = cframeInfo2.transFrame.get_localScale();
            if (this.m_bLR)
            {
                ((Vector3) ref fakeTransform3.Pos).Set((float)-_Detail.vAddT.x, (float)_Detail.vAddT.y, (float)_Detail.vAddT.z);
            }
            else
            {
                ((Vector3) ref fakeTransform3.Pos).Set((float)_Detail.vAddT.x, (float)_Detail.vAddT.y, (float)_Detail.vAddT.z);
            }
            FakeTransform fakeTransform5 = fakeTransform1;

            fakeTransform5.Pos = Vector3.op_Addition(fakeTransform5.Pos, fakeTransform3.Pos);
            FakeTransform fakeTransform6 = fakeTransform2;

            fakeTransform6.Pos = Vector3.op_Addition(fakeTransform6.Pos, fakeTransform3.Pos);
            if (_bWorld)
            {
                fakeTransform1.Pos = cframeInfo1.transParent.TransformPoint(fakeTransform1.Pos);
                fakeTransform1.Rot = cframeInfo1.transFrame.get_rotation();
                fakeTransform2.Pos = cframeInfo2.transParent.TransformPoint(fakeTransform2.Pos);
                fakeTransform2.Rot = cframeInfo2.transFrame.get_rotation();
            }
            if ((int)_Bone.anLocaterRIdx[0] == (int)_Bone.anLocaterRIdx[1])
            {
                fakeTransform4.Rot = _bAddRot ? (!this.m_bLR ? Quaternion.Euler((float)_Detail.vAddR.x, (float)_Detail.vAddR.y, (float)_Detail.vAddR.z) : Quaternion.Euler((float)_Detail.vAddR.x, (float)-_Detail.vAddR.y, (float)_Detail.vAddR.z)) : Quaternion.get_identity();
                FakeTransform fakeTransform7 = fakeTransform4;
                fakeTransform7.Rot   = Quaternion.op_Multiply(fakeTransform7.Rot, fakeTransform1.Rot);
                fakeTransform4.Pos   = fakeTransform1.Pos;
                fakeTransform4.Scale = fakeTransform1.Scale;
                if (!_bRot || Object.op_Equality((Object)reference.transFrame, (Object)null))
                {
                    _ftransBlend = (FakeTransform)fakeTransform4.DeepCopy();
                }
                else
                {
                    this.CalcAutoRotation(_ftransBlend, fakeTransform4, reference.transFrame, _Detail);
                }
                return(true);
            }
            _ftransBlend.Pos   = Vector3.Lerp(fakeTransform1.Pos, fakeTransform2.Pos, _Bone.fLerp);
            _ftransBlend.Rot   = Quaternion.Slerp(fakeTransform1.Rot, fakeTransform2.Rot, _Bone.fLerp);
            _ftransBlend.Scale = Vector3.Lerp(fakeTransform1.Scale, fakeTransform2.Scale, _Bone.fLerp);
            fakeTransform4.Rot = _bAddRot ? (!this.m_bLR ? Quaternion.Euler((float)_Detail.vAddR.x, (float)_Detail.vAddR.y, (float)_Detail.vAddR.z) : Quaternion.Euler((float)_Detail.vAddR.x, (float)-_Detail.vAddR.y, (float)_Detail.vAddR.z)) : Quaternion.get_identity();
            FakeTransform fakeTransform8 = _ftransBlend;

            fakeTransform8.Rot = Quaternion.op_Multiply(fakeTransform8.Rot, fakeTransform4.Rot);
            if (_bRot && Object.op_Inequality((Object)reference.transFrame, (Object)null))
            {
                this.CalcAutoRotation(_ftransBlend, _ftransBlend, reference.transFrame, _Detail);
            }
            return(true);
        }
Exemplo n.º 11
0
 public FakeTransform(FakeTransform _In)
 {
     this.Pos   = _In.Pos;
     this.Rot   = _In.Rot;
     this.Scale = _In.Scale;
 }