public void FromStreamEx(Stream s, PmxElementFormat f = null) { Position = V3_BytesConvert.FromStream(s); Normal = V3_BytesConvert.FromStream(s); UV = V2_BytesConvert.FromStream(s); for (int i = 0; i < f.UVACount; i++) { Vector4 vector = V4_BytesConvert.FromStream(s); if (0 <= i && i < UVA.Length) { UVA[i] = vector; } } Deform = (DeformType)s.ReadByte(); SDEF = false; switch (Deform) { case DeformType.BDEF1: Weight[0].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize); Weight[0].Value = 1f; break; case DeformType.BDEF2: Weight[0].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize); Weight[1].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize); Weight[0].Value = PmxStreamHelper.ReadElement_Float(s); Weight[1].Value = 1f - Weight[0].Value; break; case DeformType.BDEF4: case DeformType.QDEF: Weight[0].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize); Weight[1].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize); Weight[2].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize); Weight[3].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize); Weight[0].Value = PmxStreamHelper.ReadElement_Float(s); Weight[1].Value = PmxStreamHelper.ReadElement_Float(s); Weight[2].Value = PmxStreamHelper.ReadElement_Float(s); Weight[3].Value = PmxStreamHelper.ReadElement_Float(s); break; case DeformType.SDEF: Weight[0].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize); Weight[1].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize); Weight[0].Value = PmxStreamHelper.ReadElement_Float(s); Weight[1].Value = 1f - Weight[0].Value; C0 = V3_BytesConvert.FromStream(s); R0 = V3_BytesConvert.FromStream(s); R1 = V3_BytesConvert.FromStream(s); CalcSDEF_RW(); SDEF = true; break; } EdgeScale = PmxStreamHelper.ReadElement_Float(s); if (f.WithID) { base.UID = PmxStreamHelper.ReadElement_UInt(s); base.CID = PmxStreamHelper.ReadElement_UInt(s); } }
public void ToStreamEx(Stream s, PmxElementFormat f = null) { V3_BytesConvert.ToStream(s, Position); V3_BytesConvert.ToStream(s, Normal); V2_BytesConvert.ToStream(s, UV); for (int i = 0; i < f.UVACount; i++) { V4_BytesConvert.ToStream(s, UVA[i]); } if (Deform == DeformType.QDEF && f.Ver < 2.1f) { s.WriteByte(2); } else { s.WriteByte((byte)Deform); } switch (Deform) { case DeformType.BDEF1: PmxStreamHelper.WriteElement_Int32(s, Weight[0].Bone, f.BoneSize); break; case DeformType.BDEF2: PmxStreamHelper.WriteElement_Int32(s, Weight[0].Bone, f.BoneSize); PmxStreamHelper.WriteElement_Int32(s, Weight[1].Bone, f.BoneSize); PmxStreamHelper.WriteElement_Float(s, Weight[0].Value); break; case DeformType.BDEF4: case DeformType.QDEF: PmxStreamHelper.WriteElement_Int32(s, Weight[0].Bone, f.BoneSize); PmxStreamHelper.WriteElement_Int32(s, Weight[1].Bone, f.BoneSize); PmxStreamHelper.WriteElement_Int32(s, Weight[2].Bone, f.BoneSize); PmxStreamHelper.WriteElement_Int32(s, Weight[3].Bone, f.BoneSize); PmxStreamHelper.WriteElement_Float(s, Weight[0].Value); PmxStreamHelper.WriteElement_Float(s, Weight[1].Value); PmxStreamHelper.WriteElement_Float(s, Weight[2].Value); PmxStreamHelper.WriteElement_Float(s, Weight[3].Value); break; case DeformType.SDEF: PmxStreamHelper.WriteElement_Int32(s, Weight[0].Bone, f.BoneSize); PmxStreamHelper.WriteElement_Int32(s, Weight[1].Bone, f.BoneSize); PmxStreamHelper.WriteElement_Float(s, Weight[0].Value); V3_BytesConvert.ToStream(s, C0); V3_BytesConvert.ToStream(s, R0); V3_BytesConvert.ToStream(s, R1); break; } PmxStreamHelper.WriteElement_Float(s, EdgeScale); if (f.WithID) { PmxStreamHelper.WriteElement_UInt(s, base.UID); PmxStreamHelper.WriteElement_UInt(s, base.CID); } }
// Token: 0x06000281 RID: 641 RVA: 0x00013E78 File Offset: 0x00012078 public void FromStreamEx(Stream s, PmxElementFormat f) { this.Position = V3_BytesConvert.FromStream(s); this.Normal = V3_BytesConvert.FromStream(s); this.UV = V2_BytesConvert.FromStream(s); for (int i = 0; i < f.UVACount; i++) { Vector4 vector = V4_BytesConvert.FromStream(s); bool flag = 0 <= i && i < this.UVA.Length; if (flag) { this.UVA[i] = vector; } } this.Deform = (PmxVertex.DeformType)s.ReadByte(); this.SDEF = false; switch (this.Deform) { case PmxVertex.DeformType.BDEF1: this.Weight[0].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize, true); this.Weight[0].Value = 1f; break; case PmxVertex.DeformType.BDEF2: this.Weight[0].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize, true); this.Weight[1].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize, true); this.Weight[0].Value = PmxStreamHelper.ReadElement_Float(s); this.Weight[1].Value = 1f - this.Weight[0].Value; break; case PmxVertex.DeformType.BDEF4: case PmxVertex.DeformType.QDEF: this.Weight[0].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize, true); this.Weight[1].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize, true); this.Weight[2].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize, true); this.Weight[3].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize, true); this.Weight[0].Value = PmxStreamHelper.ReadElement_Float(s); this.Weight[1].Value = PmxStreamHelper.ReadElement_Float(s); this.Weight[2].Value = PmxStreamHelper.ReadElement_Float(s); this.Weight[3].Value = PmxStreamHelper.ReadElement_Float(s); break; case PmxVertex.DeformType.SDEF: this.Weight[0].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize, true); this.Weight[1].Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize, true); this.Weight[0].Value = PmxStreamHelper.ReadElement_Float(s); this.Weight[1].Value = 1f - this.Weight[0].Value; this.C0 = V3_BytesConvert.FromStream(s); this.R0 = V3_BytesConvert.FromStream(s); this.R1 = V3_BytesConvert.FromStream(s); this.CalcSDEF_RW(); this.SDEF = true; break; } this.EdgeScale = PmxStreamHelper.ReadElement_Float(s); }
// Token: 0x06000282 RID: 642 RVA: 0x0001417C File Offset: 0x0001237C public void ToStreamEx(Stream s, PmxElementFormat f) { V3_BytesConvert.ToStream(s, this.Position); V3_BytesConvert.ToStream(s, this.Normal); V2_BytesConvert.ToStream(s, this.UV); for (int i = 0; i < f.UVACount; i++) { V4_BytesConvert.ToStream(s, this.UVA[i]); } bool flag = this.Deform == PmxVertex.DeformType.QDEF && f.Ver < 2.1f; if (flag) { s.WriteByte(2); } else { s.WriteByte((byte)this.Deform); } switch (this.Deform) { case PmxVertex.DeformType.BDEF1: PmxStreamHelper.WriteElement_Int32(s, this.Weight[0].Bone, f.BoneSize, true); break; case PmxVertex.DeformType.BDEF2: PmxStreamHelper.WriteElement_Int32(s, this.Weight[0].Bone, f.BoneSize, true); PmxStreamHelper.WriteElement_Int32(s, this.Weight[1].Bone, f.BoneSize, true); PmxStreamHelper.WriteElement_Float(s, this.Weight[0].Value); break; case PmxVertex.DeformType.BDEF4: case PmxVertex.DeformType.QDEF: PmxStreamHelper.WriteElement_Int32(s, this.Weight[0].Bone, f.BoneSize, true); PmxStreamHelper.WriteElement_Int32(s, this.Weight[1].Bone, f.BoneSize, true); PmxStreamHelper.WriteElement_Int32(s, this.Weight[2].Bone, f.BoneSize, true); PmxStreamHelper.WriteElement_Int32(s, this.Weight[3].Bone, f.BoneSize, true); PmxStreamHelper.WriteElement_Float(s, this.Weight[0].Value); PmxStreamHelper.WriteElement_Float(s, this.Weight[1].Value); PmxStreamHelper.WriteElement_Float(s, this.Weight[2].Value); PmxStreamHelper.WriteElement_Float(s, this.Weight[3].Value); break; case PmxVertex.DeformType.SDEF: PmxStreamHelper.WriteElement_Int32(s, this.Weight[0].Bone, f.BoneSize, true); PmxStreamHelper.WriteElement_Int32(s, this.Weight[1].Bone, f.BoneSize, true); PmxStreamHelper.WriteElement_Float(s, this.Weight[0].Value); V3_BytesConvert.ToStream(s, this.C0); V3_BytesConvert.ToStream(s, this.R0); V3_BytesConvert.ToStream(s, this.R1); break; } PmxStreamHelper.WriteElement_Float(s, this.EdgeScale); }