public bool Read(BundleEntry entry, ILoader loader = null) { Clear(); Entry = entry; MemoryStream ms = entry.MakeStream(); BinaryReader2 br = new BinaryReader2(ms); br.BigEndian = entry.Console; Unknown1 = br.ReadInt32(); int instanceCount = br.ReadInt32(); Unknown2 = br.ReadInt32(); Unknown3 = br.ReadInt32(); for (int i = 0; i < instanceCount; i++) { ModelInstance instance = ModelInstance.Read(br); instance.ModelEntryID = entry.GetDependencies()[i].EntryID; Instances.Add(instance); } RemainingBytes = br.ReadBytes((int)(br.BaseStream.Length - br.BaseStream.Position)); br.Close(); ms.Close(); //_scene = MakeScene(loader); return(true); }
public bool Write(BundleEntry entry) { MemoryStream ms = new MemoryStream(); BinaryWriter bw = new BinaryWriter(ms); bw.Write(Unknown1); bw.Write(Instances.Count); bw.Write(Unknown2); bw.Write(Unknown3); for (int i = 0; i < Instances.Count; i++) { ModelInstance instance = Instances[i]; instance.Write(bw); } bw.Write(RemainingBytes); bw.Flush(); byte[] data = ms.GetBuffer(); bw.Close(); ms.Close(); entry.EntryBlocks[0].Data = data; entry.Dirty = true; return(true); }
public static ModelInstance Read(BinaryReader br) { ModelInstance result = new ModelInstance(); result.ModelEntryPtr = br.ReadInt32(); result.Unknown2 = br.ReadInt32(); result.Unknown3 = br.ReadInt32(); result.Unknown4 = br.ReadInt32(); result.Transform = br.ReadMatrix4(); return(result); }
private bool InRange(ModelInstance instance) { return(true); }