예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
 private bool InRange(ModelInstance instance)
 {
     return(true);
 }