private static void WriteMdbPacket(this BinaryWriter writer, MdbPacket_SKIN packet) { writer.Write(packet.Name); writer.Write(packet.Skeleton); writer.Write(packet.Mat); writer.Write(packet.NumVerts); writer.Write(packet.NumFaces); foreach (var i in packet.Verts) { writer.Write(i); } foreach (var i in packet.Faces) { writer.Write(i); } }
private static MdbPacket_SKIN ReadMdbPacket_SKIN(this BinaryReader reader, UInt32 size) { var ret = new MdbPacket_SKIN(); ret.Name = reader.ReadName32(); ret.Skeleton = reader.ReadName32(); ret.Mat = reader.ReadMaterial(); ret.NumVerts = reader.ReadUInt32(); ret.NumFaces = reader.ReadUInt32(); ret.Verts = new SVert[ret.NumVerts]; ret.Faces = new Tri[ret.NumFaces]; for (int i = 0; i < ret.NumVerts; ++i) { ret.Verts[i] = reader.ReadSVert(); } for (int i = 0; i < ret.NumFaces; ++i) { ret.Faces[i] = reader.ReadTri(); } return(ret); }