Exemplo n.º 1
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.º 2
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.º 3
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);
        }