コード例 #1
0
 // Token: 0x06000328 RID: 808 RVA: 0x00016E58 File Offset: 0x00015058
 public VmdCamera(VmdCamera camera)
 {
     this.FrameIndex = camera.FrameIndex;
     this.Distance   = camera.Distance;
     this.Position   = camera.Position;
     this.Rotate     = camera.Rotate;
     this.IPL        = (VmdCameraIPL)camera.IPL.Clone();
     this.Angle      = camera.Angle;
     this.Pers       = camera.Pers;
 }
コード例 #2
0
 public VmdCamera(VmdCamera camera)
 {
     FrameIndex = camera.FrameIndex;
     Distance   = camera.Distance;
     Position   = camera.Position;
     Rotate     = camera.Rotate;
     IPL        = (VmdCameraIPL)camera.IPL.Clone();
     Angle      = camera.Angle;
     Pers       = camera.Pers;
 }
コード例 #3
0
ファイル: Vmd.cs プロジェクト: superowner/KoikatsuPmxExporter
        // Token: 0x06000323 RID: 803 RVA: 0x000169D8 File Offset: 0x00014BD8
        public void FromBytes(byte[] bytes, int startIndex)
        {
            byte[] array = new byte[30];
            Array.Copy(bytes, startIndex, array, 0, 30);
            this.VMDHeader = BytesStringProc.GetString(array, 0);
            bool flag = string.Compare(this.VMDHeader, "Vocaloid Motion Data file", true) == 0;
            int  num;

            if (flag)
            {
                this.ModelNameBytes = 10;
                num        = 1;
                this.m_ver = Vmd.VmdVersion.v1;
            }
            else
            {
                bool flag2 = string.Compare(this.VMDHeader, "Vocaloid Motion Data 0002", true) != 0;
                if (flag2)
                {
                    throw new Exception("対応したVMDファイルではありません");
                }
                this.ModelNameBytes = 20;
                num        = 2;
                this.m_ver = Vmd.VmdVersion.v2;
            }
            int num2 = startIndex + 30;

            Array.Copy(bytes, num2, array, 0, this.ModelNameBytes);
            this.ModelName = BytesStringProc.GetString(array, 0);
            num2          += this.ModelNameBytes;
            int num3 = BitConverter.ToInt32(bytes, num2);

            num2 += 4;
            this.MotionList.Clear();
            this.MotionList.Capacity = num3;
            for (int i = 0; i < num3; i++)
            {
                VmdMotion vmdMotion = new VmdMotion();
                vmdMotion.FromBytes(bytes, num2);
                num2 += vmdMotion.ByteCount;
                this.MotionList.Add(vmdMotion);
            }
            bool flag3 = bytes.Length > num2;

            if (flag3)
            {
                num3  = BitConverter.ToInt32(bytes, num2);
                num2 += 4;
                this.MorphList.Clear();
                this.MorphList.Capacity = num3;
                for (int j = 0; j < num3; j++)
                {
                    VmdMorph vmdMorph = new VmdMorph();
                    vmdMorph.FromBytes(bytes, num2);
                    num2 += vmdMorph.ByteCount;
                    this.MorphList.Add(vmdMorph);
                }
                bool flag4 = bytes.Length > num2;
                if (flag4)
                {
                    num3  = BitConverter.ToInt32(bytes, num2);
                    num2 += 4;
                    this.CameraList.Clear();
                    this.CameraList.Capacity = num3;
                    bool flag5 = num == 1;
                    if (flag5)
                    {
                        for (int k = 0; k < num3; k++)
                        {
                            VmdCamera_v1 vmdCamera_v = new VmdCamera_v1();
                            vmdCamera_v.FromBytes(bytes, num2);
                            num2 += vmdCamera_v.ByteCount;
                            this.CameraList.Add(vmdCamera_v.ToVmdCamera());
                        }
                    }
                    else
                    {
                        bool flag6 = num == 2;
                        if (flag6)
                        {
                            for (int l = 0; l < num3; l++)
                            {
                                VmdCamera vmdCamera = new VmdCamera();
                                vmdCamera.FromBytes(bytes, num2);
                                num2 += vmdCamera.ByteCount;
                                this.CameraList.Add(vmdCamera);
                            }
                        }
                    }
                    bool flag7 = bytes.Length > num2;
                    if (flag7)
                    {
                        num3  = BitConverter.ToInt32(bytes, num2);
                        num2 += 4;
                        this.LightList.Clear();
                        this.LightList.Capacity = num3;
                        for (int m = 0; m < num3; m++)
                        {
                            VmdLight vmdLight = new VmdLight();
                            vmdLight.FromBytes(bytes, num2);
                            num2 += vmdLight.ByteCount;
                            this.LightList.Add(vmdLight);
                        }
                        bool flag8 = bytes.Length > num2;
                        if (flag8)
                        {
                            num3  = BitConverter.ToInt32(bytes, num2);
                            num2 += 4;
                            this.SelfShadowList.Clear();
                            this.SelfShadowList.Capacity = num3;
                            for (int n = 0; n < num3; n++)
                            {
                                VmdSelfShadow vmdSelfShadow = new VmdSelfShadow();
                                vmdSelfShadow.FromBytes(bytes, num2);
                                num2 += vmdSelfShadow.ByteCount;
                                this.SelfShadowList.Add(vmdSelfShadow);
                            }
                            bool flag9 = bytes.Length > num2;
                            if (flag9)
                            {
                                num3  = BitConverter.ToInt32(bytes, num2);
                                num2 += 4;
                                this.VisibleIKList.Clear();
                                this.VisibleIKList.Capacity = num3;
                                for (int num4 = 0; num4 < num3; num4++)
                                {
                                    VmdVisibleIK vmdVisibleIK = new VmdVisibleIK();
                                    vmdVisibleIK.FromBytes(bytes, num2);
                                    num2 += vmdVisibleIK.ByteCount;
                                    this.VisibleIKList.Add(vmdVisibleIK);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #4
0
        public void FromBytes(byte[] bytes, int startIndex)
        {
            int num = startIndex;

            byte[] array = new byte[30];
            Array.Copy(bytes, num, array, 0, 30);
            VMDHeader = BytesStringProc.GetString(array, 0);
            int num2 = 0;

            if (string.Compare(VMDHeader, "Vocaloid Motion Data file", ignoreCase: true) == 0)
            {
                ModelNameBytes = 10;
                num2           = 1;
                m_ver          = VmdVersion.v1;
            }
            else
            {
                if (string.Compare(VMDHeader, "Vocaloid Motion Data 0002", ignoreCase: true) != 0)
                {
                    throw new Exception("対応したVMDファイルではありません");
                }
                ModelNameBytes = 20;
                num2           = 2;
                m_ver          = VmdVersion.v2;
            }
            num += 30;
            _    = new byte[ModelNameBytes];
            Array.Copy(bytes, num, array, 0, ModelNameBytes);
            ModelName = BytesStringProc.GetString(array, 0);
            num      += ModelNameBytes;
            int num3 = BitConverter.ToInt32(bytes, num);

            num += 4;
            MotionList.Clear();
            MotionList.Capacity = num3;
            for (int i = 0; i < num3; i++)
            {
                VmdMotion vmdMotion = new VmdMotion();
                vmdMotion.FromBytes(bytes, num);
                num += vmdMotion.ByteCount;
                MotionList.Add(vmdMotion);
            }
            if (bytes.Length <= num)
            {
                return;
            }
            num3 = BitConverter.ToInt32(bytes, num);
            num += 4;
            MorphList.Clear();
            MorphList.Capacity = num3;
            for (int j = 0; j < num3; j++)
            {
                VmdMorph vmdMorph = new VmdMorph();
                vmdMorph.FromBytes(bytes, num);
                num += vmdMorph.ByteCount;
                MorphList.Add(vmdMorph);
            }
            if (bytes.Length <= num)
            {
                return;
            }
            num3 = BitConverter.ToInt32(bytes, num);
            num += 4;
            CameraList.Clear();
            CameraList.Capacity = num3;
            switch (num2)
            {
            case 1:
            {
                for (int l = 0; l < num3; l++)
                {
                    VmdCamera_v1 vmdCamera_v = new VmdCamera_v1();
                    vmdCamera_v.FromBytes(bytes, num);
                    num += vmdCamera_v.ByteCount;
                    CameraList.Add(vmdCamera_v.ToVmdCamera());
                }
                break;
            }

            case 2:
            {
                for (int k = 0; k < num3; k++)
                {
                    VmdCamera vmdCamera = new VmdCamera();
                    vmdCamera.FromBytes(bytes, num);
                    num += vmdCamera.ByteCount;
                    CameraList.Add(vmdCamera);
                }
                break;
            }
            }
            if (bytes.Length <= num)
            {
                return;
            }
            num3 = BitConverter.ToInt32(bytes, num);
            num += 4;
            LightList.Clear();
            LightList.Capacity = num3;
            for (int m = 0; m < num3; m++)
            {
                VmdLight vmdLight = new VmdLight();
                vmdLight.FromBytes(bytes, num);
                num += vmdLight.ByteCount;
                LightList.Add(vmdLight);
            }
            if (bytes.Length <= num)
            {
                return;
            }
            num3 = BitConverter.ToInt32(bytes, num);
            num += 4;
            SelfShadowList.Clear();
            SelfShadowList.Capacity = num3;
            for (int n = 0; n < num3; n++)
            {
                VmdSelfShadow vmdSelfShadow = new VmdSelfShadow();
                vmdSelfShadow.FromBytes(bytes, num);
                num += vmdSelfShadow.ByteCount;
                SelfShadowList.Add(vmdSelfShadow);
            }
            if (bytes.Length > num)
            {
                num3 = BitConverter.ToInt32(bytes, num);
                num += 4;
                VisibleIKList.Clear();
                VisibleIKList.Capacity = num3;
                for (int num4 = 0; num4 < num3; num4++)
                {
                    VmdVisibleIK vmdVisibleIK = new VmdVisibleIK();
                    vmdVisibleIK.FromBytes(bytes, num);
                    num += vmdVisibleIK.ByteCount;
                    VisibleIKList.Add(vmdVisibleIK);
                }
            }
        }