Esempio 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);
 }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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));
        }
Esempio n. 6
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);
        }
Esempio n. 7
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);
        }