Ejemplo n.º 1
0
            public void ReadFromFile(BinaryReader reader, int type)
            {
                if (type == 12)
                {
                    unk18         = reader.ReadInt32();
                    numVerts      = reader.ReadInt32();
                    numFaces      = reader.ReadInt32();
                    unk20         = reader.ReadInt32();
                    unk21         = reader.ReadInt32();
                    numSplitGroup = reader.ReadInt32();

                    if (unk18 + unk20 + unk21 + nSizeOfMatBurstEntries + nSizeOfMatSplitEntries != 0xE)
                    {
                        throw new Exception("does not equal 14");
                    }
                }

                if (type == 1)
                {
                    numSplitGroup = 1;
                }

                if (numSplitGroup == 1)
                {
                    availD = reader.ReadBoolean();
                    unk24  = reader.ReadInt32();
                    nSizeOfMatBurstEntries = reader.ReadInt32();
                    nSizeOfMatSplitEntries = reader.ReadInt32();
                    numMatBurst            = reader.ReadInt32();
                    numMatSplit            = reader.ReadInt32();

                    hash = reader.ReadInt64();

                    materialBursts = new MaterialBurst[numMatBurst];
                    materialSplits = new MaterialSplit[numMatSplit];


                    for (int i = 0; i != materialBursts.Length; i++)
                    {
                        materialBursts[i] = new MaterialBurst(reader);
                    }
                    for (int i = 0; i != materialSplits.Length; i++)
                    {
                        materialSplits[i] = new MaterialSplit(reader);
                    }
                }
            }
Ejemplo n.º 2
0
            public void ReadFromFile(MemoryStream reader, bool isBigEndian, int type)
            {
                if (type == 12)
                {
                    indexStride   = reader.ReadInt32(isBigEndian); //2
                    numVerts      = reader.ReadInt32(isBigEndian);
                    numFaces      = reader.ReadInt32(isBigEndian);
                    unk20         = reader.ReadInt32(isBigEndian); //0
                    unk21         = reader.ReadInt32(isBigEndian); //12
                    numSplitGroup = reader.ReadInt32(isBigEndian); //1

                    var result = indexStride + unk20 + unk21 + nSizeOfMatBurstEntries + nSizeOfMatSplitEntries;
                    if (result != 0xE && result != 0x10)
                    {
                        throw new Exception("does not equal 14 or 16");
                    }
                }

                if (type == 1)
                {
                    numSplitGroup = 1;
                }

                if (numSplitGroup == 1)
                {
                    availD = reader.ReadBoolean();
                    unk24  = reader.ReadInt32(isBigEndian);
                    nSizeOfMatBurstEntries = reader.ReadInt32(isBigEndian);
                    nSizeOfMatSplitEntries = reader.ReadInt32(isBigEndian);
                    numMatBurst            = reader.ReadInt32(isBigEndian);
                    numMatSplit            = reader.ReadInt32(isBigEndian);
                    hash           = reader.ReadUInt64(isBigEndian);
                    materialBursts = new MaterialBurst[numMatBurst];
                    materialSplits = new MaterialSplit[numMatSplit];


                    for (int i = 0; i != materialBursts.Length; i++)
                    {
                        materialBursts[i] = new MaterialBurst(reader, isBigEndian);
                    }
                    for (int i = 0; i != materialSplits.Length; i++)
                    {
                        materialSplits[i] = new MaterialSplit(reader, isBigEndian);
                    }
                }
            }