// Token: 0x060001AB RID: 427 RVA: 0x000102D8 File Offset: 0x0000E4D8 public void ToStreamEx_TexTable(Stream s, PmxTextureTable tx, PmxElementFormat f) { PmxStreamHelper.WriteString(s, this.Name, f); PmxStreamHelper.WriteString(s, this.NameE, f); V4_BytesConvert.ToStream(s, V4_BytesConvert.ColorToVector4(this.Diffuse)); V3_BytesConvert.ToStream(s, V3_BytesConvert.ColorToVector3(this.Specular)); PmxStreamHelper.WriteElement_Float(s, this.Power); V3_BytesConvert.ToStream(s, V3_BytesConvert.ColorToVector3(this.Ambient)); s.WriteByte((byte)this.Flags); V4_BytesConvert.ToStream(s, V4_BytesConvert.ColorToVector4(this.EdgeColor)); PmxStreamHelper.WriteElement_Float(s, this.EdgeSize); PmxStreamHelper.WriteElement_Int32(s, tx.GetIndex(this.Tex), f.TexSize, true); PmxStreamHelper.WriteElement_Int32(s, tx.GetIndex(this.Sphere), f.TexSize, true); s.WriteByte((byte)this.SphereMode); int toonIndex = SystemToon.GetToonIndex(this.Toon); bool flag = toonIndex < 0; if (flag) { s.WriteByte(0); PmxStreamHelper.WriteElement_Int32(s, tx.GetIndex(this.Toon), f.TexSize, true); } else { s.WriteByte(1); s.WriteByte((byte)toonIndex); } PmxStreamHelper.WriteString(s, this.Memo, f); PmxStreamHelper.WriteElement_Int32(s, this.FaceCount, 4, true); }
public void ToStreamEx_TexTable(Stream s, PmxTextureTable tx, PmxElementFormat f = null) { PmxStreamHelper.WriteString(s, Name, f); PmxStreamHelper.WriteString(s, NameE, f); V4_BytesConvert.ToStream(s, Diffuse); V3_BytesConvert.ToStream(s, Specular); PmxStreamHelper.WriteElement_Float(s, Power); V3_BytesConvert.ToStream(s, Ambient); s.WriteByte((byte)Flags); V4_BytesConvert.ToStream(s, EdgeColor); PmxStreamHelper.WriteElement_Float(s, EdgeSize); PmxStreamHelper.WriteElement_Int32(s, tx.GetIndex(Tex), f.TexSize); PmxStreamHelper.WriteElement_Int32(s, tx.GetIndex(Sphere), f.TexSize); s.WriteByte((byte)SphereMode); int toonIndex = SystemToon.GetToonIndex(Toon); if (toonIndex < 0) { s.WriteByte(0); PmxStreamHelper.WriteElement_Int32(s, tx.GetIndex(Toon), f.TexSize); } else { s.WriteByte(1); s.WriteByte((byte)toonIndex); } PmxStreamHelper.WriteString(s, Memo, f); PmxStreamHelper.WriteElement_Int32(s, FaceCount); if (f.WithID) { PmxStreamHelper.WriteElement_UInt(s, base.UID); PmxStreamHelper.WriteElement_UInt(s, base.CID); } }
// 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); }
// Token: 0x060000B4 RID: 180 RVA: 0x0000D190 File Offset: 0x0000B390 public void ToStreamEx(Stream s, PmxElementFormat f) { PmxHeader header = this.Header; PmxTextureTable pmxTextureTable = new PmxTextureTable(this.MaterialList); this.UpdateElementFormatSize(header.ElementFormat, pmxTextureTable); header.ToStreamEx(s, null); this.ModelInfo.ToStreamEx(s, header.ElementFormat); PmxStreamHelper.WriteElement_Int32(s, this.VertexList.Count, 4, true); for (int i = 0; i < this.VertexList.Count; i++) { this.VertexList[i].ToStreamEx(s, header.ElementFormat); } PmxStreamHelper.WriteElement_Int32(s, this.FaceList.Count, 4, true); for (int j = 0; j < this.FaceList.Count; j++) { PmxStreamHelper.WriteElement_Int32(s, this.FaceList[j], header.ElementFormat.VertexSize, false); } pmxTextureTable.ToStreamEx(s, header.ElementFormat); PmxStreamHelper.WriteElement_Int32(s, this.MaterialList.Count, 4, true); for (int k = 0; k < this.MaterialList.Count; k++) { this.MaterialList[k].ToStreamEx_TexTable(s, pmxTextureTable, header.ElementFormat); } PmxStreamHelper.WriteElement_Int32(s, this.BoneList.Count, 4, true); for (int l = 0; l < this.BoneList.Count; l++) { this.BoneList[l].ToStreamEx(s, header.ElementFormat); } PmxStreamHelper.WriteElement_Int32(s, this.MorphList.Count, 4, true); for (int m = 0; m < this.MorphList.Count; m++) { this.MorphList[m].ToStreamEx(s, header.ElementFormat); } PmxStreamHelper.WriteElement_Int32(s, this.NodeList.Count, 4, true); for (int n = 0; n < this.NodeList.Count; n++) { this.NodeList[n].ToStreamEx(s, header.ElementFormat); } PmxStreamHelper.WriteElement_Int32(s, this.BodyList.Count, 4, true); for (int num = 0; num < this.BodyList.Count; num++) { this.BodyList[num].ToStreamEx(s, header.ElementFormat); } PmxStreamHelper.WriteElement_Int32(s, this.JointList.Count, 4, true); for (int num2 = 0; num2 < this.JointList.Count; num2++) { this.JointList[num2].ToStreamEx(s, header.ElementFormat); } bool flag = header.Ver >= 2.1f; if (flag) { PmxStreamHelper.WriteElement_Int32(s, this.SoftBodyList.Count, 4, true); for (int num3 = 0; num3 < this.SoftBodyList.Count; num3++) { this.SoftBodyList[num3].ToStreamEx(s, header.ElementFormat); } } }
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 UpdateElementFormatSize(PmxElementFormat f = null, PmxTextureTable tx = null) { if (f == null) { f = Header.ElementFormat; } f.VertexSize = PmxElementFormat.GetUnsignedBufSize(VertexList.Count); f.MaterialSize = PmxElementFormat.GetSignedBufSize(MaterialList.Count); f.BoneSize = PmxElementFormat.GetSignedBufSize(BoneList.Count); f.MorphSize = PmxElementFormat.GetSignedBufSize(MorphList.Count); f.BodySize = PmxElementFormat.GetSignedBufSize(BodyList.Count); if (tx == null) { tx = new PmxTextureTable(MaterialList); } f.TexSize = PmxElementFormat.GetSignedBufSize(tx.Count); }
// Token: 0x060000B3 RID: 179 RVA: 0x0000D0CC File Offset: 0x0000B2CC public void UpdateElementFormatSize(PmxElementFormat f, PmxTextureTable tx) { bool flag = f == null; if (flag) { f = this.Header.ElementFormat; } f.VertexSize = PmxElementFormat.GetUnsignedBufSize(this.VertexList.Count); f.MaterialSize = PmxElementFormat.GetSignedBufSize(this.MaterialList.Count); f.BoneSize = PmxElementFormat.GetSignedBufSize(this.BoneList.Count); f.MorphSize = PmxElementFormat.GetSignedBufSize(this.MorphList.Count); f.BodySize = PmxElementFormat.GetSignedBufSize(this.BodyList.Count); bool flag2 = tx == null; if (flag2) { tx = new PmxTextureTable(this.MaterialList); } f.TexSize = PmxElementFormat.GetSignedBufSize(tx.Count); }
public virtual void ToStream(Stream s, bool id) { PmxHeader header = Header; header.ElementFormat.WithID = id; PmxTextureTable pmxTextureTable = new PmxTextureTable(MaterialList); UpdateElementFormatSize(header.ElementFormat, pmxTextureTable); header.ToStreamEx(s); ModelInfo.ToStreamEx(s, header.ElementFormat); PmxStreamHelper.WriteElement_Int32(s, VertexList.Count); for (int i = 0; i < VertexList.Count; i++) { VertexList[i].ToStreamEx(s, header.ElementFormat); } PmxStreamHelper.WriteElement_Int32(s, FaceList.Count); for (int j = 0; j < FaceList.Count; j++) { PmxStreamHelper.WriteElement_Int32(s, FaceList[j], header.ElementFormat.VertexSize, signed: false); } pmxTextureTable.ToStreamEx(s, header.ElementFormat); PmxStreamHelper.WriteElement_Int32(s, MaterialList.Count); for (int k = 0; k < MaterialList.Count; k++) { MaterialList[k].ToStreamEx_TexTable(s, pmxTextureTable, header.ElementFormat); } PmxStreamHelper.WriteElement_Int32(s, BoneList.Count); for (int l = 0; l < BoneList.Count; l++) { BoneList[l].ToStreamEx(s, header.ElementFormat); } if (header.Ver < 2.1f) { int num = MorphList.Where((PmxMorph mp) => mp.IsImpulse).Count(); PmxStreamHelper.WriteElement_Int32(s, MorphList.Count - num); } else { PmxStreamHelper.WriteElement_Int32(s, MorphList.Count); } for (int m = 0; m < MorphList.Count; m++) { MorphList[m].ToStreamEx(s, header.ElementFormat); } PmxStreamHelper.WriteElement_Int32(s, NodeList.Count); for (int n = 0; n < NodeList.Count; n++) { NodeList[n].ToStreamEx(s, header.ElementFormat); } PmxStreamHelper.WriteElement_Int32(s, BodyList.Count); for (int num2 = 0; num2 < BodyList.Count; num2++) { BodyList[num2].ToStreamEx(s, header.ElementFormat); } PmxStreamHelper.WriteElement_Int32(s, JointList.Count); for (int num3 = 0; num3 < JointList.Count; num3++) { JointList[num3].ToStreamEx(s, header.ElementFormat); } if (header.Ver >= 2.1f) { PmxStreamHelper.WriteElement_Int32(s, SoftBodyList.Count); for (int num4 = 0; num4 < SoftBodyList.Count; num4++) { SoftBodyList[num4].ToStreamEx(s, header.ElementFormat); } } if (id) { PmxStreamHelper.WriteString(s, FilePath, header.ElementFormat); } header.ElementFormat.WithID = false; }
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; }
public void FromPmxTextureTable(PmxTextureTable tx) { string[] array = new string[tx.Count]; tx.NameToIndex.Keys.CopyTo(array, 0); CreateTable(array); }
public PmxTextureTable(PmxTextureTable tx) { FromPmxTextureTable(tx); }
// Token: 0x06000256 RID: 598 RVA: 0x00012FBA File Offset: 0x000111BA public PmxTextureTable(PmxTextureTable tx) { this.FromPmxTextureTable(tx); }
// Token: 0x060000B2 RID: 178 RVA: 0x0000CC80 File Offset: 0x0000AE80 public virtual void FromStreamEx(Stream s, PmxElementFormat f) { PmxHeader pmxHeader = new PmxHeader(2.1f); pmxHeader.FromStreamEx(s, null); this.Header.FromHeader(pmxHeader); this.ModelInfo.FromStreamEx(s, pmxHeader.ElementFormat); int num = PmxStreamHelper.ReadElement_Int32(s, 4, true); this.VertexList.Clear(); this.VertexList.Capacity = num; for (int i = 0; i < num; i++) { PmxVertex pmxVertex = new PmxVertex(); pmxVertex.FromStreamEx(s, pmxHeader.ElementFormat); this.VertexList.Add(pmxVertex); } num = PmxStreamHelper.ReadElement_Int32(s, 4, true); this.FaceList.Clear(); this.FaceList.Capacity = num; for (int j = 0; j < num; j++) { int item = PmxStreamHelper.ReadElement_Int32(s, pmxHeader.ElementFormat.VertexSize, false); this.FaceList.Add(item); } PmxTextureTable pmxTextureTable = new PmxTextureTable(); pmxTextureTable.FromStreamEx(s, pmxHeader.ElementFormat); num = PmxStreamHelper.ReadElement_Int32(s, 4, true); this.MaterialList.Clear(); this.MaterialList.Capacity = num; for (int k = 0; k < num; k++) { PmxMaterial pmxMaterial = new PmxMaterial(); pmxMaterial.FromStreamEx_TexTable(s, pmxTextureTable, pmxHeader.ElementFormat); this.MaterialList.Add(pmxMaterial); } num = PmxStreamHelper.ReadElement_Int32(s, 4, true); this.BoneList.Clear(); this.BoneList.Capacity = num; for (int l = 0; l < num; l++) { PmxBone pmxBone = new PmxBone(); pmxBone.FromStreamEx(s, pmxHeader.ElementFormat); this.BoneList.Add(pmxBone); } num = PmxStreamHelper.ReadElement_Int32(s, 4, true); this.MorphList.Clear(); this.MorphList.Capacity = num; for (int m = 0; m < num; m++) { PmxMorph pmxMorph = new PmxMorph(); pmxMorph.FromStreamEx(s, pmxHeader.ElementFormat); this.MorphList.Add(pmxMorph); } num = PmxStreamHelper.ReadElement_Int32(s, 4, true); this.NodeList.Clear(); this.NodeList.Capacity = num; for (int n = 0; n < num; n++) { PmxNode pmxNode = new PmxNode(); pmxNode.FromStreamEx(s, pmxHeader.ElementFormat); this.NodeList.Add(pmxNode); bool systemNode = this.NodeList[n].SystemNode; if (systemNode) { bool flag = this.NodeList[n].Name == "Root"; if (flag) { this.RootNode = this.NodeList[n]; } else { bool flag2 = this.NodeList[n].Name == "表情"; if (flag2) { this.ExpNode = this.NodeList[n]; } } } } num = PmxStreamHelper.ReadElement_Int32(s, 4, true); this.BodyList.Clear(); this.BodyList.Capacity = num; for (int num2 = 0; num2 < num; num2++) { PmxBody pmxBody = new PmxBody(); pmxBody.FromStreamEx(s, pmxHeader.ElementFormat); this.BodyList.Add(pmxBody); } num = PmxStreamHelper.ReadElement_Int32(s, 4, true); this.JointList.Clear(); this.JointList.Capacity = num; for (int num3 = 0; num3 < num; num3++) { PmxJoint pmxJoint = new PmxJoint(); pmxJoint.FromStreamEx(s, pmxHeader.ElementFormat); this.JointList.Add(pmxJoint); } bool flag3 = pmxHeader.Ver >= 2.1f; if (flag3) { num = PmxStreamHelper.ReadElement_Int32(s, 4, true); this.SoftBodyList.Clear(); this.SoftBodyList.Capacity = num; for (int num4 = 0; num4 < num; num4++) { PmxSoftBody pmxSoftBody = new PmxSoftBody(); pmxSoftBody.FromStreamEx(s, pmxHeader.ElementFormat); this.SoftBodyList.Add(pmxSoftBody); } } }