public override void Save(HSDWriter Writer) { foreach (KAR_GrUnk2_1Model Unk2_1 in GroupsUnk2_1.Elements) { foreach (KAR_GrUnk2_1DModel Unk2_1D in Unk2_1.GroupsUnk2_1D.Elements) { Writer.AddObject(Unk2_1D.DOBJIndices); foreach (var v in Unk2_1D.DOBJIndices) { Writer.Write(v); } Writer.Align(4); } } foreach (KAR_GrUnk2_1Model Unk2_1 in GroupsUnk2_1.Elements) { Unk2_1.GroupsUnk2_1D.Save(Writer); } GroupsUnk2_1.Save(Writer); Writer.AddObject(this); Writer.WritePointer(GroupsUnk2_1.Size > 0 ? GroupsUnk2_1.Elements[0] : null); Writer.Write((ushort)GroupsUnk2_1.Size); Writer.Write((ushort)0); }
public byte[] GetData(GXVertexBuffer Buffer) { MemoryStream o = new MemoryStream(); HSDWriter Writer = new HSDWriter(o); foreach (object ob in Collection) { if (ob is GXVector2) { WriteData(Writer, ((GXVector2)ob).X, Buffer.CompType, Buffer.Scale); WriteData(Writer, ((GXVector2)ob).Y, Buffer.CompType, Buffer.Scale); } if (ob is GXVector3) { WriteData(Writer, ((GXVector3)ob).X, Buffer.CompType, Buffer.Scale); WriteData(Writer, ((GXVector3)ob).Y, Buffer.CompType, Buffer.Scale); WriteData(Writer, ((GXVector3)ob).Z, Buffer.CompType, Buffer.Scale); } } Writer.Align(0x20); byte[] data = o.ToArray(); Writer.Close(); o.Close(); Writer.Dispose(); return(data); }
public override void Save(HSDWriter Writer) { if (MatAnimJoint == null) { Writer.WriteObject(MatAnimJoint); } foreach (HSD_AnimNode node in Nodes) { foreach (HSD_Track t in node.Tracks) { t.Save(Writer); } } object array = new object(); Writer.AddObject(array); HSD_Track FirstTrack = null; foreach (HSD_AnimNode node in Nodes) { Writer.Write((byte)node.Tracks.Count); foreach (HSD_Track t in node.Tracks) { if (FirstTrack == null) { FirstTrack = t; } } } Writer.Write((byte)0xFF); Writer.Align(4); Writer.AddObject(this); Writer.Write(MatAnimJoint == null ? 1 : -1); if (MatAnimJoint == null) { Writer.Write(0); } else { Writer.WritePointer(MatAnimJoint); } Writer.Write(FrameCount); Writer.WritePointer(array); Writer.WritePointer(FirstTrack); }
public override void Save(HSDWriter Writer) { foreach (KAR_GrViewRegion Unk1_1 in ViewRegion.Elements) { Writer.AddObject(Unk1_1.DOBJIndices); foreach (var v in Unk1_1.DOBJIndices) { Writer.Write(v); } Writer.Align(4); } foreach (KAR_GrModel_ModelUnk1_2 Unk1_2 in GroupsUnk1_2.Elements) { Writer.AddObject(Unk1_2.DOBJIndices); foreach (var v in Unk1_2.DOBJIndices) { Writer.Write(v); } Writer.Align(4); } ViewRegion.Save(Writer); Writer.Align(4); GroupsUnk1_2.Save(Writer); Writer.Align(4); GroupsUnk1_3.Save(Writer); Writer.Align(4); Writer.AddObject(DOBJIndices); foreach (var v in DOBJIndices) { Writer.Write(v); } Writer.Align(4); Writer.AddObject(this); Writer.WritePointer(ViewRegion.Size > 0 ? ViewRegion.Elements[0] : null); Writer.Write((ushort)ViewRegion.Size); Writer.Write((ushort)0); Writer.WritePointer(GroupsUnk1_2.Size > 0 ? GroupsUnk1_2.Elements[0] : null); Writer.Write((ushort)GroupsUnk1_2.Size); Writer.Write((ushort)0); Writer.WritePointer(GroupsUnk1_3.Size > 0 ? GroupsUnk1_3.Elements[0] : null); Writer.Write((ushort)GroupsUnk1_3.Size); Writer.Write((ushort)0); Writer.WritePointer(DOBJIndices); Writer.Write((ushort)DOBJIndices.Count); Writer.Write((ushort)0); }
public byte[] ToBuffer(HSD_AttributeGroup Group) { MemoryStream o = new MemoryStream(); HSDWriter Writer = new HSDWriter(o); foreach (GXPrimitiveGroup g in Primitives) { g.Write(Writer, Group); } Writer.Write((byte)0); Writer.Align(0x20); Writer.Close(); byte[] bytes = o.ToArray(); o.Close(); return(bytes); }
public override void Save(HSDWriter Writer) { Writer.AddObject(Partitions); foreach (var p in Partitions) { Writer.WritePointer(p); } foreach (var p in Partitions) { p.Save(Writer); } Writer.AddObject(CollidableTriangles); foreach (var v in CollidableTriangles) { Writer.Write(v); } Writer.Align(4); Writer.AddObject(UnknownIndices); foreach (var v in UnknownIndices) { Writer.Write(v); } Writer.Align(4); Writer.AddObject(UnknownIndices2); foreach (var v in UnknownIndices2) { Writer.Write(v); } Writer.Align(4); Writer.AddObject(CollidableTrianglesBits); Writer.Write(new byte[(CollidableTriangles.Count / 8) + 5]); Writer.Align(4); Writer.AddObject(this); Writer.WritePointer(Partitions); Writer.Write((short)Partitions.Count); Writer.Write((short)0); Writer.Write(0x05000000); Writer.WritePointer(CollidableTriangles); Writer.Write((short)CollidableTriangles.Count); Writer.Write((short)0); Writer.Write(0x05000000); Writer.WritePointer(UnknownIndices); Writer.Write((short)UnknownIndices.Count); Writer.Write((short)0); Writer.Write(0x05000000); Writer.WritePointer(UnknownIndices2); Writer.Write((short)UnknownIndices2.Count); Writer.Write((short)0); Writer.Write(0); Writer.Write(0); Writer.Write(0); Writer.Write(0); Writer.Write(0); Writer.Write(0); Writer.Write(0); Writer.Write(0); Writer.Write(0); Writer.Write(0x00000003); Writer.WritePointer(CollidableTrianglesBits); Writer.Write((short)CollidableTriangles.Count); Writer.Write((short)0); }