public void FromStreamEx(Stream s, PmxElementFormat f = null)
        {
            Name  = PmxStreamHelper.ReadString(s, f);
            NameE = PmxStreamHelper.ReadString(s, f);
            Bone  = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize);
            Group = PmxStreamHelper.ReadElement_Int32(s, 1);
            ushort bits = (ushort)PmxStreamHelper.ReadElement_Int32(s, 2, signed: false);

            PassGroup.FromFlagBits(bits);
            BoxType  = (BoxKind)s.ReadByte();
            BoxSize  = V3_BytesConvert.FromStream(s);
            Position = V3_BytesConvert.FromStream(s);
            Rotation = V3_BytesConvert.FromStream(s);
            Mass     = PmxStreamHelper.ReadElement_Float(s);
            Vector4 vector = V4_BytesConvert.FromStream(s);

            PositionDamping = vector.X;
            RotationDamping = vector.Y;
            Restitution     = vector.Z;
            Friction        = vector.W;
            Mode            = (ModeType)s.ReadByte();
            if (f.WithID)
            {
                base.UID = PmxStreamHelper.ReadElement_UInt(s);
                base.CID = PmxStreamHelper.ReadElement_UInt(s);
            }
        }
 public void FromStreamEx_TexTable(Stream s, PmxTextureTable tx, PmxElementFormat f = null)
 {
     Name       = PmxStreamHelper.ReadString(s, f);
     NameE      = PmxStreamHelper.ReadString(s, f);
     Diffuse    = V4_BytesConvert.FromStream(s);
     Specular   = V3_BytesConvert.FromStream(s);
     Power      = PmxStreamHelper.ReadElement_Float(s);
     Ambient    = V3_BytesConvert.FromStream(s);
     Flags      = (MaterialFlags)s.ReadByte();
     EdgeColor  = V4_BytesConvert.FromStream(s);
     EdgeSize   = PmxStreamHelper.ReadElement_Float(s);
     Tex        = tx.GetName(PmxStreamHelper.ReadElement_Int32(s, f.TexSize));
     Sphere     = tx.GetName(PmxStreamHelper.ReadElement_Int32(s, f.TexSize));
     SphereMode = (SphereModeType)s.ReadByte();
     if (s.ReadByte() == 0)
     {
         Toon = tx.GetName(PmxStreamHelper.ReadElement_Int32(s, f.TexSize));
     }
     else
     {
         int n = s.ReadByte();
         Toon = SystemToon.GetToonName(n);
     }
     Memo = PmxStreamHelper.ReadString(s, f);
     UpdateAttributeFromMemo();
     FaceCount = PmxStreamHelper.ReadElement_Int32(s);
     if (f.WithID)
     {
         base.UID = PmxStreamHelper.ReadElement_UInt(s);
         base.CID = PmxStreamHelper.ReadElement_UInt(s);
     }
 }
 public void FromStreamEx(Stream s, PmxElementFormat f = null)
 {
     ModelName  = PmxStreamHelper.ReadString(s, f);
     ModelNameE = PmxStreamHelper.ReadString(s, f);
     Comment    = PmxStreamHelper.ReadString(s, f);
     CommentE   = PmxStreamHelper.ReadString(s, f);
 }
 // Token: 0x060001DE RID: 478 RVA: 0x00010B88 File Offset: 0x0000ED88
 public void FromStreamEx(Stream s, PmxElementFormat f)
 {
     this.ModelName  = PmxStreamHelper.ReadString(s, f);
     this.ModelNameE = PmxStreamHelper.ReadString(s, f);
     this.Comment    = PmxStreamHelper.ReadString(s, f);
     this.CommentE   = PmxStreamHelper.ReadString(s, f);
 }
        // Token: 0x060001AA RID: 426 RVA: 0x000101A0 File Offset: 0x0000E3A0
        public void FromStreamEx_TexTable(Stream s, PmxTextureTable tx, PmxElementFormat f)
        {
            this.Name       = PmxStreamHelper.ReadString(s, f);
            this.NameE      = PmxStreamHelper.ReadString(s, f);
            this.Diffuse    = V4_BytesConvert.Vector4ToColor(V4_BytesConvert.FromStream(s));
            this.Specular   = V4_BytesConvert.Vector4ToColor(V4_BytesConvert.FromStream(s));
            this.Power      = PmxStreamHelper.ReadElement_Float(s);
            this.Ambient    = V4_BytesConvert.Vector4ToColor(V4_BytesConvert.FromStream(s));
            this.Flags      = (PmxMaterial.MaterialFlags)s.ReadByte();
            this.EdgeColor  = V4_BytesConvert.Vector4ToColor(V4_BytesConvert.FromStream(s));
            this.EdgeSize   = PmxStreamHelper.ReadElement_Float(s);
            this.Tex        = tx.GetName(PmxStreamHelper.ReadElement_Int32(s, f.TexSize, true));
            this.Sphere     = tx.GetName(PmxStreamHelper.ReadElement_Int32(s, f.TexSize, true));
            this.SphereMode = (PmxMaterial.SphereModeType)s.ReadByte();
            bool flag = s.ReadByte() == 0;

            if (flag)
            {
                this.Toon = tx.GetName(PmxStreamHelper.ReadElement_Int32(s, f.TexSize, true));
            }
            else
            {
                int n = s.ReadByte();
                this.Toon = SystemToon.GetToonName(n);
            }
            this.Memo = PmxStreamHelper.ReadString(s, f);
            this.UpdateAttributeFromMemo();
            this.FaceCount = PmxStreamHelper.ReadElement_Int32(s, 4, true);
        }
        public void FromStreamEx(Stream s, PmxElementFormat f = null)
        {
            int num = PmxStreamHelper.ReadElement_Int32(s);

            string[] array = new string[num];
            for (int i = 0; i < num; i++)
            {
                array[i] = PmxStreamHelper.ReadString(s, f);
            }
            CreateTable(array);
        }
Beispiel #7
0
        // Token: 0x06000106 RID: 262 RVA: 0x0000E550 File Offset: 0x0000C750
        public void FromStreamEx(Stream s, PmxElementFormat f)
        {
            this.Name     = PmxStreamHelper.ReadString(s, f);
            this.NameE    = PmxStreamHelper.ReadString(s, f);
            this.Position = V3_BytesConvert.FromStream(s);
            this.Parent   = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize, true);
            this.Level    = PmxStreamHelper.ReadElement_Int32(s, 4, true);
            this.Flags    = (PmxBone.BoneFlags)PmxStreamHelper.ReadElement_Int32(s, 2, false);
            bool flag = this.GetFlag(PmxBone.BoneFlags.ToBone);

            if (flag)
            {
                this.To_Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize, true);
            }
            else
            {
                this.To_Offset = V3_BytesConvert.FromStream(s);
            }
            bool flag2 = this.GetFlag(PmxBone.BoneFlags.AppendRotation) || this.GetFlag(PmxBone.BoneFlags.AppendTranslation);

            if (flag2)
            {
                this.AppendParent = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize, true);
                this.AppendRatio  = PmxStreamHelper.ReadElement_Float(s);
            }
            bool flag3 = this.GetFlag(PmxBone.BoneFlags.FixAxis);

            if (flag3)
            {
                this.Axis = V3_BytesConvert.FromStream(s);
            }
            bool flag4 = this.GetFlag(PmxBone.BoneFlags.LocalFrame);

            if (flag4)
            {
                this.LocalX = V3_BytesConvert.FromStream(s);
                this.LocalZ = V3_BytesConvert.FromStream(s);
                this.NormalizeLocal();
            }
            bool flag5 = this.GetFlag(PmxBone.BoneFlags.ExtParent);

            if (flag5)
            {
                this.ExtKey = PmxStreamHelper.ReadElement_Int32(s, 4, true);
            }
            bool flag6 = this.GetFlag(PmxBone.BoneFlags.IK);

            if (flag6)
            {
                this.IK.FromStreamEx(s, f);
            }
        }
 public void FromStreamEx(Stream s, PmxElementFormat f = null)
 {
     Name     = PmxStreamHelper.ReadString(s, f);
     NameE    = PmxStreamHelper.ReadString(s, f);
     Position = V3_BytesConvert.FromStream(s);
     Parent   = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize);
     Level    = PmxStreamHelper.ReadElement_Int32(s);
     Flags    = (BoneFlags)PmxStreamHelper.ReadElement_Int32(s, 2, signed: false);
     if (GetFlag(BoneFlags.ToBone))
     {
         To_Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize);
     }
     else
     {
         To_Offset = V3_BytesConvert.FromStream(s);
     }
     if (GetFlag(BoneFlags.AddRotation) || GetFlag(BoneFlags.AddTranslation))
     {
         AddParent = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize);
         AddRatio  = PmxStreamHelper.ReadElement_Float(s);
     }
     if (GetFlag(BoneFlags.FixAxis))
     {
         Axis = V3_BytesConvert.FromStream(s);
     }
     if (GetFlag(BoneFlags.LocalFrame))
     {
         LocalX = V3_BytesConvert.FromStream(s);
         LocalZ = V3_BytesConvert.FromStream(s);
         if (!f.WithID)
         {
             NormalizeLocal();
         }
     }
     if (GetFlag(BoneFlags.ExtParent))
     {
         ExtKey = PmxStreamHelper.ReadElement_Int32(s);
     }
     if (GetFlag(BoneFlags.IK))
     {
         IK.FromStreamEx(s, f);
     }
     if (f.WithID)
     {
         base.UID = PmxStreamHelper.ReadElement_UInt(s);
         base.CID = PmxStreamHelper.ReadElement_UInt(s);
     }
 }
 // Token: 0x06000187 RID: 391 RVA: 0x0000F9D4 File Offset: 0x0000DBD4
 public void FromStreamEx(Stream s, PmxElementFormat f)
 {
     this.Name            = PmxStreamHelper.ReadString(s, f);
     this.NameE           = PmxStreamHelper.ReadString(s, f);
     this.Kind            = (PmxJoint.JointKind)s.ReadByte();
     this.BodyA           = PmxStreamHelper.ReadElement_Int32(s, f.BodySize, true);
     this.BodyB           = PmxStreamHelper.ReadElement_Int32(s, f.BodySize, true);
     this.Position        = V3_BytesConvert.FromStream(s);
     this.Rotation        = V3_BytesConvert.FromStream(s);
     this.Limit_MoveLow   = V3_BytesConvert.FromStream(s);
     this.Limit_MoveHigh  = V3_BytesConvert.FromStream(s);
     this.Limit_AngleLow  = V3_BytesConvert.FromStream(s);
     this.Limit_AngleHigh = V3_BytesConvert.FromStream(s);
     this.SpConst_Move    = V3_BytesConvert.FromStream(s);
     this.SpConst_Rotate  = V3_BytesConvert.FromStream(s);
 }
        // Token: 0x06000204 RID: 516 RVA: 0x000113DC File Offset: 0x0000F5DC
        public void FromStreamEx(Stream s, PmxElementFormat f)
        {
            this.Name       = PmxStreamHelper.ReadString(s, f);
            this.NameE      = PmxStreamHelper.ReadString(s, f);
            this.SystemNode = (s.ReadByte() != 0);
            int num = PmxStreamHelper.ReadElement_Int32(s, 4, true);

            this.ElementList.Clear();
            this.ElementList.Capacity = num;
            for (int i = 0; i < num; i++)
            {
                PmxNode.NodeElement nodeElement = new PmxNode.NodeElement();
                nodeElement.FromStreamEx(s, f);
                this.ElementList.Add(nodeElement);
            }
        }
 // Token: 0x060001A8 RID: 424 RVA: 0x0000FFCC File Offset: 0x0000E1CC
 public void FromStreamEx(Stream s, PmxElementFormat f)
 {
     this.Name       = PmxStreamHelper.ReadString(s, f);
     this.NameE      = PmxStreamHelper.ReadString(s, f);
     this.Diffuse    = V4_BytesConvert.Vector4ToColor(V4_BytesConvert.FromStream(s));
     this.Specular   = V3_BytesConvert.Vector3ToColor(V3_BytesConvert.FromStream(s));
     this.Power      = PmxStreamHelper.ReadElement_Float(s);
     this.Ambient    = V3_BytesConvert.Vector3ToColor(V3_BytesConvert.FromStream(s));
     this.Flags      = (PmxMaterial.MaterialFlags)s.ReadByte();
     this.EdgeColor  = V4_BytesConvert.Vector4ToColor(V4_BytesConvert.FromStream(s));
     this.EdgeSize   = PmxStreamHelper.ReadElement_Float(s);
     this.Tex        = PmxStreamHelper.ReadString(s, f);
     this.Sphere     = PmxStreamHelper.ReadString(s, f);
     this.SphereMode = (PmxMaterial.SphereModeType)s.ReadByte();
     this.Toon       = PmxStreamHelper.ReadString(s, f);
     this.Memo       = PmxStreamHelper.ReadString(s, f);
     this.FaceCount  = PmxStreamHelper.ReadElement_Int32(s, 4, true);
 }
 public void FromStreamEx(Stream s, PmxElementFormat f = null)
 {
     Name       = PmxStreamHelper.ReadString(s, f);
     NameE      = PmxStreamHelper.ReadString(s, f);
     Diffuse    = V4_BytesConvert.FromStream(s);
     Specular   = V3_BytesConvert.FromStream(s);
     Power      = PmxStreamHelper.ReadElement_Float(s);
     Ambient    = V3_BytesConvert.FromStream(s);
     Flags      = (MaterialFlags)s.ReadByte();
     EdgeColor  = V4_BytesConvert.FromStream(s);
     EdgeSize   = PmxStreamHelper.ReadElement_Float(s);
     Tex        = PmxStreamHelper.ReadString(s, f);
     Sphere     = PmxStreamHelper.ReadString(s, f);
     SphereMode = (SphereModeType)s.ReadByte();
     Toon       = PmxStreamHelper.ReadString(s, f);
     Memo       = PmxStreamHelper.ReadString(s, f);
     FaceCount  = PmxStreamHelper.ReadElement_Int32(s);
 }
Beispiel #13
0
 public void FromStreamEx(Stream s, PmxElementFormat f = null)
 {
     Name            = PmxStreamHelper.ReadString(s, f);
     NameE           = PmxStreamHelper.ReadString(s, f);
     Kind            = (JointKind)s.ReadByte();
     BodyA           = PmxStreamHelper.ReadElement_Int32(s, f.BodySize);
     BodyB           = PmxStreamHelper.ReadElement_Int32(s, f.BodySize);
     Position        = V3_BytesConvert.FromStream(s);
     Rotation        = V3_BytesConvert.FromStream(s);
     Limit_MoveLow   = V3_BytesConvert.FromStream(s);
     Limit_MoveHigh  = V3_BytesConvert.FromStream(s);
     Limit_AngleLow  = V3_BytesConvert.FromStream(s);
     Limit_AngleHigh = V3_BytesConvert.FromStream(s);
     SpConst_Move    = V3_BytesConvert.FromStream(s);
     SpConst_Rotate  = V3_BytesConvert.FromStream(s);
     if (f.WithID)
     {
         base.UID = PmxStreamHelper.ReadElement_UInt(s);
         base.CID = PmxStreamHelper.ReadElement_UInt(s);
     }
 }
        public void FromStreamEx(Stream s, PmxElementFormat f = null)
        {
            Name       = PmxStreamHelper.ReadString(s, f);
            NameE      = PmxStreamHelper.ReadString(s, f);
            SystemNode = (s.ReadByte() != 0);
            int num = PmxStreamHelper.ReadElement_Int32(s);

            ElementList.Clear();
            ElementList.Capacity = num;
            for (int i = 0; i < num; i++)
            {
                NodeElement nodeElement = new NodeElement();
                nodeElement.FromStreamEx(s, f);
                ElementList.Add(nodeElement);
            }
            if (f.WithID)
            {
                base.UID = PmxStreamHelper.ReadElement_UInt(s);
                base.CID = PmxStreamHelper.ReadElement_UInt(s);
            }
        }
        // Token: 0x060000DD RID: 221 RVA: 0x0000DD78 File Offset: 0x0000BF78
        public void FromStreamEx(Stream s, PmxElementFormat f)
        {
            this.Name  = PmxStreamHelper.ReadString(s, f);
            this.NameE = PmxStreamHelper.ReadString(s, f);
            this.Bone  = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize, true);
            this.Group = PmxStreamHelper.ReadElement_Int32(s, 1, true);
            ushort bits = (ushort)PmxStreamHelper.ReadElement_Int32(s, 2, false);

            this.PassGroup.FromFlagBits(bits);
            this.BoxType  = (PmxBody.BoxKind)s.ReadByte();
            this.BoxSize  = V3_BytesConvert.FromStream(s);
            this.Position = V3_BytesConvert.FromStream(s);
            this.Rotation = V3_BytesConvert.FromStream(s);
            this.Mass     = PmxStreamHelper.ReadElement_Float(s);
            Vector4 vector = V4_BytesConvert.FromStream(s);

            this.PositionDamping = vector.x;
            this.RotationDamping = vector.y;
            this.Restitution     = vector.z;
            this.Friction        = vector.w;
            this.Mode            = (PmxBody.ModeType)s.ReadByte();
        }
Beispiel #16
0
        // Token: 0x060001F6 RID: 502 RVA: 0x00010F20 File Offset: 0x0000F120
        public void FromStreamEx(Stream s, PmxElementFormat f)
        {
            this.Name  = PmxStreamHelper.ReadString(s, f);
            this.NameE = PmxStreamHelper.ReadString(s, f);
            this.Panel = PmxStreamHelper.ReadElement_Int32(s, 1, true);
            this.Kind  = (PmxMorph.OffsetKind)PmxStreamHelper.ReadElement_Int32(s, 1, true);
            int num = PmxStreamHelper.ReadElement_Int32(s, 4, true);

            this.OffsetList.Clear();
            this.OffsetList.Capacity = num;
            for (int i = 0; i < num; i++)
            {
                switch (this.Kind)
                {
                case PmxMorph.OffsetKind.Group:
                case PmxMorph.OffsetKind.Flip:
                {
                    PmxGroupMorph pmxGroupMorph = new PmxGroupMorph();
                    pmxGroupMorph.FromStreamEx(s, f);
                    this.OffsetList.Add(pmxGroupMorph);
                    break;
                }

                case PmxMorph.OffsetKind.Vertex:
                {
                    PmxVertexMorph pmxVertexMorph = new PmxVertexMorph();
                    pmxVertexMorph.FromStreamEx(s, f);
                    this.OffsetList.Add(pmxVertexMorph);
                    break;
                }

                case PmxMorph.OffsetKind.Bone:
                {
                    PmxBoneMorph pmxBoneMorph = new PmxBoneMorph();
                    pmxBoneMorph.FromStreamEx(s, f);
                    this.OffsetList.Add(pmxBoneMorph);
                    break;
                }

                case PmxMorph.OffsetKind.UV:
                case PmxMorph.OffsetKind.UVA1:
                case PmxMorph.OffsetKind.UVA2:
                case PmxMorph.OffsetKind.UVA3:
                case PmxMorph.OffsetKind.UVA4:
                {
                    PmxUVMorph pmxUVMorph = new PmxUVMorph();
                    pmxUVMorph.FromStreamEx(s, f);
                    this.OffsetList.Add(pmxUVMorph);
                    break;
                }

                case PmxMorph.OffsetKind.Material:
                {
                    PmxMaterialMorph pmxMaterialMorph = new PmxMaterialMorph();
                    pmxMaterialMorph.FromStreamEx(s, f);
                    this.OffsetList.Add(pmxMaterialMorph);
                    break;
                }

                case PmxMorph.OffsetKind.Impulse:
                {
                    PmxImpulseMorph pmxImpulseMorph = new PmxImpulseMorph();
                    pmxImpulseMorph.FromStreamEx(s, f);
                    this.OffsetList.Add(pmxImpulseMorph);
                    break;
                }
                }
            }
        }
Beispiel #17
0
        public void FromStreamEx(Stream s, PmxElementFormat f = null)
        {
            Name     = PmxStreamHelper.ReadString(s, f);
            NameE    = PmxStreamHelper.ReadString(s, f);
            Shape    = (ShapeKind)PmxStreamHelper.ReadElement_Int32(s, 1);
            Material = PmxStreamHelper.ReadElement_Int32(s, f.MaterialSize);
            Group    = PmxStreamHelper.ReadElement_Int32(s, 1);
            ushort bits = (ushort)PmxStreamHelper.ReadElement_Int32(s, 2, signed: false);

            PassGroup.FromFlagBits(bits);
            Flags = (SoftBodyFlags)PmxStreamHelper.ReadElement_Int32(s, 1);
            BendingLinkDistance = PmxStreamHelper.ReadElement_Int32(s);
            ClusterCount        = PmxStreamHelper.ReadElement_Int32(s);
            TotalMass           = PmxStreamHelper.ReadElement_Float(s);
            Margin             = PmxStreamHelper.ReadElement_Float(s);
            Config.AeroModel   = PmxStreamHelper.ReadElement_Int32(s);
            Config.VCF         = PmxStreamHelper.ReadElement_Float(s);
            Config.DP          = PmxStreamHelper.ReadElement_Float(s);
            Config.DG          = PmxStreamHelper.ReadElement_Float(s);
            Config.LF          = PmxStreamHelper.ReadElement_Float(s);
            Config.PR          = PmxStreamHelper.ReadElement_Float(s);
            Config.VC          = PmxStreamHelper.ReadElement_Float(s);
            Config.DF          = PmxStreamHelper.ReadElement_Float(s);
            Config.MT          = PmxStreamHelper.ReadElement_Float(s);
            Config.CHR         = PmxStreamHelper.ReadElement_Float(s);
            Config.KHR         = PmxStreamHelper.ReadElement_Float(s);
            Config.SHR         = PmxStreamHelper.ReadElement_Float(s);
            Config.AHR         = PmxStreamHelper.ReadElement_Float(s);
            Config.SRHR_CL     = PmxStreamHelper.ReadElement_Float(s);
            Config.SKHR_CL     = PmxStreamHelper.ReadElement_Float(s);
            Config.SSHR_CL     = PmxStreamHelper.ReadElement_Float(s);
            Config.SR_SPLT_CL  = PmxStreamHelper.ReadElement_Float(s);
            Config.SK_SPLT_CL  = PmxStreamHelper.ReadElement_Float(s);
            Config.SS_SPLT_CL  = PmxStreamHelper.ReadElement_Float(s);
            Config.V_IT        = PmxStreamHelper.ReadElement_Int32(s);
            Config.P_IT        = PmxStreamHelper.ReadElement_Int32(s);
            Config.D_IT        = PmxStreamHelper.ReadElement_Int32(s);
            Config.C_IT        = PmxStreamHelper.ReadElement_Int32(s);
            MaterialConfig.LST = PmxStreamHelper.ReadElement_Float(s);
            MaterialConfig.AST = PmxStreamHelper.ReadElement_Float(s);
            MaterialConfig.VST = PmxStreamHelper.ReadElement_Float(s);
            int num = PmxStreamHelper.ReadElement_Int32(s);

            BodyAnchorList.Clear();
            BodyAnchorList.Capacity = num;
            for (int i = 0; i < num; i++)
            {
                int body   = PmxStreamHelper.ReadElement_Int32(s, f.BodySize);
                int vertex = PmxStreamHelper.ReadElement_Int32(s, f.VertexSize);
                int num2   = PmxStreamHelper.ReadElement_Int32(s, 1);
                BodyAnchorList.Add(new BodyAnchor
                {
                    Body   = body,
                    Vertex = vertex,
                    IsNear = (num2 != 0)
                });
            }
            num = PmxStreamHelper.ReadElement_Int32(s);
            VertexPinList.Clear();
            VertexPinList.Capacity = num;
            for (int j = 0; j < num; j++)
            {
                int vertex2 = PmxStreamHelper.ReadElement_Int32(s, f.VertexSize);
                VertexPinList.Add(new VertexPin
                {
                    Vertex = vertex2
                });
            }
            NormalizeBodyAnchorList();
            NormalizeVertexPinList();
            if (f.WithID)
            {
                base.UID = PmxStreamHelper.ReadElement_UInt(s);
                base.CID = PmxStreamHelper.ReadElement_UInt(s);
            }
        }
Beispiel #18
0
        // Token: 0x0600022A RID: 554 RVA: 0x00011DDC File Offset: 0x0000FFDC
        public void FromStreamEx(Stream s, PmxElementFormat f)
        {
            this.Name     = PmxStreamHelper.ReadString(s, f);
            this.NameE    = PmxStreamHelper.ReadString(s, f);
            this.Shape    = (PmxSoftBody.ShapeKind)PmxStreamHelper.ReadElement_Int32(s, 1, true);
            this.Material = PmxStreamHelper.ReadElement_Int32(s, f.MaterialSize, true);
            this.Group    = PmxStreamHelper.ReadElement_Int32(s, 1, true);
            ushort bits = (ushort)PmxStreamHelper.ReadElement_Int32(s, 2, false);

            this.PassGroup.FromFlagBits(bits);
            this.Flags = (PmxSoftBody.SoftBodyFlags)PmxStreamHelper.ReadElement_Int32(s, 1, true);
            this.BendingLinkDistance = PmxStreamHelper.ReadElement_Int32(s, 4, true);
            this.ClusterCount        = PmxStreamHelper.ReadElement_Int32(s, 4, true);
            this.TotalMass           = PmxStreamHelper.ReadElement_Float(s);
            this.Margin             = PmxStreamHelper.ReadElement_Float(s);
            this.Config.AeroModel   = PmxStreamHelper.ReadElement_Int32(s, 4, true);
            this.Config.VCF         = PmxStreamHelper.ReadElement_Float(s);
            this.Config.DP          = PmxStreamHelper.ReadElement_Float(s);
            this.Config.DG          = PmxStreamHelper.ReadElement_Float(s);
            this.Config.LF          = PmxStreamHelper.ReadElement_Float(s);
            this.Config.PR          = PmxStreamHelper.ReadElement_Float(s);
            this.Config.VC          = PmxStreamHelper.ReadElement_Float(s);
            this.Config.DF          = PmxStreamHelper.ReadElement_Float(s);
            this.Config.MT          = PmxStreamHelper.ReadElement_Float(s);
            this.Config.CHR         = PmxStreamHelper.ReadElement_Float(s);
            this.Config.KHR         = PmxStreamHelper.ReadElement_Float(s);
            this.Config.SHR         = PmxStreamHelper.ReadElement_Float(s);
            this.Config.AHR         = PmxStreamHelper.ReadElement_Float(s);
            this.Config.SRHR_CL     = PmxStreamHelper.ReadElement_Float(s);
            this.Config.SKHR_CL     = PmxStreamHelper.ReadElement_Float(s);
            this.Config.SSHR_CL     = PmxStreamHelper.ReadElement_Float(s);
            this.Config.SR_SPLT_CL  = PmxStreamHelper.ReadElement_Float(s);
            this.Config.SK_SPLT_CL  = PmxStreamHelper.ReadElement_Float(s);
            this.Config.SS_SPLT_CL  = PmxStreamHelper.ReadElement_Float(s);
            this.Config.V_IT        = PmxStreamHelper.ReadElement_Int32(s, 4, true);
            this.Config.P_IT        = PmxStreamHelper.ReadElement_Int32(s, 4, true);
            this.Config.D_IT        = PmxStreamHelper.ReadElement_Int32(s, 4, true);
            this.Config.C_IT        = PmxStreamHelper.ReadElement_Int32(s, 4, true);
            this.MaterialConfig.LST = PmxStreamHelper.ReadElement_Float(s);
            this.MaterialConfig.AST = PmxStreamHelper.ReadElement_Float(s);
            this.MaterialConfig.VST = PmxStreamHelper.ReadElement_Float(s);
            int num = PmxStreamHelper.ReadElement_Int32(s, 4, true);

            this.BodyAnchorList.Clear();
            this.BodyAnchorList.Capacity = num;
            for (int i = 0; i < num; i++)
            {
                int body   = PmxStreamHelper.ReadElement_Int32(s, f.BodySize, true);
                int vertex = PmxStreamHelper.ReadElement_Int32(s, f.VertexSize, true);
                int num2   = PmxStreamHelper.ReadElement_Int32(s, 1, true);
                this.BodyAnchorList.Add(new PmxSoftBody.BodyAnchor
                {
                    Body   = body,
                    Vertex = vertex,
                    IsNear = (num2 != 0)
                });
            }
            num = PmxStreamHelper.ReadElement_Int32(s, 4, true);
            this.VertexPinList.Clear();
            this.VertexPinList.Capacity = num;
            for (int j = 0; j < num; j++)
            {
                int vertex2 = PmxStreamHelper.ReadElement_Int32(s, f.VertexSize, true);
                this.VertexPinList.Add(new PmxSoftBody.VertexPin
                {
                    Vertex = vertex2
                });
            }
            this.NormalizeBodyAnchorList();
            this.NormalizeVertexPinList();
        }
        public void FromStreamEx(Stream s, PmxElementFormat f = null)
        {
            Name  = PmxStreamHelper.ReadString(s, f);
            NameE = PmxStreamHelper.ReadString(s, f);
            Panel = PmxStreamHelper.ReadElement_Int32(s, 1);
            Kind  = (OffsetKind)PmxStreamHelper.ReadElement_Int32(s, 1);
            int num = PmxStreamHelper.ReadElement_Int32(s);

            OffsetList.Clear();
            OffsetList.Capacity = num;
            for (int i = 0; i < num; i++)
            {
                switch (Kind)
                {
                case OffsetKind.Group:
                case OffsetKind.Flip:
                {
                    PmxGroupMorph pmxGroupMorph = new PmxGroupMorph();
                    pmxGroupMorph.FromStreamEx(s, f);
                    OffsetList.Add(pmxGroupMorph);
                    break;
                }

                case OffsetKind.Vertex:
                {
                    PmxVertexMorph pmxVertexMorph = new PmxVertexMorph();
                    pmxVertexMorph.FromStreamEx(s, f);
                    OffsetList.Add(pmxVertexMorph);
                    break;
                }

                case OffsetKind.Bone:
                {
                    PmxBoneMorph pmxBoneMorph = new PmxBoneMorph();
                    pmxBoneMorph.FromStreamEx(s, f);
                    OffsetList.Add(pmxBoneMorph);
                    break;
                }

                case OffsetKind.Impulse:
                {
                    PmxImpulseMorph pmxImpulseMorph = new PmxImpulseMorph();
                    pmxImpulseMorph.FromStreamEx(s, f);
                    OffsetList.Add(pmxImpulseMorph);
                    break;
                }

                case OffsetKind.Material:
                {
                    PmxMaterialMorph pmxMaterialMorph = new PmxMaterialMorph();
                    pmxMaterialMorph.FromStreamEx(s, f);
                    OffsetList.Add(pmxMaterialMorph);
                    break;
                }

                case OffsetKind.UV:
                case OffsetKind.UVA1:
                case OffsetKind.UVA2:
                case OffsetKind.UVA3:
                case OffsetKind.UVA4:
                {
                    PmxUVMorph pmxUVMorph = new PmxUVMorph();
                    pmxUVMorph.FromStreamEx(s, f);
                    OffsetList.Add(pmxUVMorph);
                    break;
                }
                }
            }
            if (f.WithID)
            {
                base.UID = PmxStreamHelper.ReadElement_UInt(s);
                base.CID = PmxStreamHelper.ReadElement_UInt(s);
            }
        }
Beispiel #20
0
        public virtual void FromStream(Stream s, bool id)
        {
            Action <Action> action = delegate(Action a)
            {
                try
                {
                    a();
                }
                catch (Exception)
                {
                    LoadErrCount++;
                }
            };
            PmxHeader head = new PmxHeader();

            head.FromStreamEx(s);
            Header.FromHeader(head);
            head.ElementFormat.WithID = id;
            action(delegate
            {
                ModelInfo.FromStreamEx(s, head.ElementFormat);
            });
            int count = 0;

            action(delegate
            {
                count = PmxStreamHelper.ReadElement_Int32(s);
            });
            VertexList.Clear();
            VertexList.Capacity = count;
            for (int k = 0; k < count; k++)
            {
                PmxVertex v = new PmxVertex();
                action(delegate
                {
                    v.FromStreamEx(s, head.ElementFormat);
                });
                VertexList.Add(v);
            }
            action(delegate
            {
                count = PmxStreamHelper.ReadElement_Int32(s);
            });
            FaceList.Clear();
            FaceList.Capacity = count;
            for (int l = 0; l < count; l++)
            {
                int ix = 0;
                action(delegate
                {
                    ix = PmxStreamHelper.ReadElement_Int32(s, head.ElementFormat.VertexSize, signed: false);
                });
                FaceList.Add(ix);
            }
            PmxTextureTable tx = new PmxTextureTable();

            action(delegate
            {
                tx.FromStreamEx(s, head.ElementFormat);
            });
            action(delegate
            {
                count = PmxStreamHelper.ReadElement_Int32(s);
            });
            MaterialList.Clear();
            MaterialList.Capacity = count;
            for (int m = 0; m < count; m++)
            {
                PmxMaterial j = new PmxMaterial();
                action(delegate
                {
                    j.FromStreamEx_TexTable(s, tx, head.ElementFormat);
                });
                MaterialList.Add(j);
            }
            action(delegate
            {
                count = PmxStreamHelper.ReadElement_Int32(s);
            });
            BoneList.Clear();
            BoneList.Capacity = count;
            for (int n = 0; n < count; n++)
            {
                PmxBone b = new PmxBone();
                action(delegate
                {
                    b.FromStreamEx(s, head.ElementFormat);
                });
                BoneList.Add(b);
            }
            action(delegate
            {
                count = PmxStreamHelper.ReadElement_Int32(s);
            });
            MorphList.Clear();
            MorphList.Capacity = count;
            for (int num = 0; num < count; num++)
            {
                PmxMorph morph = new PmxMorph();
                action(delegate
                {
                    morph.FromStreamEx(s, head.ElementFormat);
                });
                MorphList.Add(morph);
            }
            action(delegate
            {
                count = PmxStreamHelper.ReadElement_Int32(s);
            });
            NodeList.Clear();
            NodeList.Capacity = count;
            for (int num2 = 0; num2 < count; num2++)
            {
                PmxNode node = new PmxNode();
                action(delegate
                {
                    node.FromStreamEx(s, head.ElementFormat);
                });
                NodeList.Add(node);
                if (NodeList[num2].SystemNode)
                {
                    if (NodeList[num2].Name == "Root")
                    {
                        RootNode = NodeList[num2];
                    }
                    else if (NodeList[num2].Name == "表情")
                    {
                        ExpNode = NodeList[num2];
                    }
                }
            }
            action(delegate
            {
                count = PmxStreamHelper.ReadElement_Int32(s);
            });
            BodyList.Clear();
            BodyList.Capacity = count;
            for (int num3 = 0; num3 < count; num3++)
            {
                PmxBody b2 = new PmxBody();
                action(delegate
                {
                    b2.FromStreamEx(s, head.ElementFormat);
                });
                BodyList.Add(b2);
            }
            action(delegate
            {
                count = PmxStreamHelper.ReadElement_Int32(s);
            });
            JointList.Clear();
            JointList.Capacity = count;
            for (int num4 = 0; num4 < count; num4++)
            {
                PmxJoint i = new PmxJoint();
                action(delegate
                {
                    i.FromStreamEx(s, head.ElementFormat);
                });
                JointList.Add(i);
            }
            if (head.Ver >= 2.1f)
            {
                action(delegate
                {
                    count = PmxStreamHelper.ReadElement_Int32(s);
                });
                SoftBodyList.Clear();
                SoftBodyList.Capacity = count;
                for (int num5 = 0; num5 < count; num5++)
                {
                    PmxSoftBody b3 = new PmxSoftBody();
                    action(delegate
                    {
                        b3.FromStreamEx(s, head.ElementFormat);
                    });
                    SoftBodyList.Add(b3);
                }
            }
            if (id)
            {
                action(delegate
                {
                    FilePath = PmxStreamHelper.ReadString(s, head.ElementFormat);
                });
            }
            head.ElementFormat.WithID = false;
        }