示例#1
0
            public GC_VertexStripCollection(BinaryReader reader, GCMF gcmf)
            {
                desc = new GC_MaterialDescriptor(reader);
                long baseAddress = reader.BaseStream.Position;

                reader.SkipBytes(1); // Skip 1 byte

                mt_strips = new List <GC_VertexStrip>();
                if (desc.MT_Size > 0)
                {
                    while (true)
                    {
                        byte type = reader.GetByte();
                        if (type == 0x98 | type == 0x99)
                        {
                            mt_strips.Add(new GC_VertexStrip(reader, desc.VertexFlags, type));
                        }
                        else
                        {
                            break;
                        }
                    }
                }

                // mt tl reset
                reader.BaseStream.Seek(baseAddress + desc.MT_Size, SeekOrigin.Begin);
                reader.SkipBytes(1); // Skip 1 byte

                mt_tl_strips = new List <GC_VertexStrip>();
                if (desc.TL_MT_Size > 0)
                {
                    while (true)
                    {
                        byte type = reader.GetByte();
                        if (type == 0x98 | type == 0x99)
                        {
                            mt_tl_strips.Add(new GC_VertexStrip(reader, desc.VertexFlags, type));
                        }
                        else
                        {
                            break;
                        }
                    }
                }

                // reset after read
                reader.BaseStream.Seek(baseAddress + desc.MT_Size + desc.TL_MT_Size, SeekOrigin.Begin);
            }
示例#2
0
            public Model(BinaryReader reader, uint address, uint nameOffset, int index)
            {
                this.index      = index;
                this.address    = address;
                this.nameOffset = nameOffset;

                // Recover name
                reader.BaseStream.Seek(nameOffset, SeekOrigin.Begin);
                name = GetName(reader);

                //Debug.LogFormat("{0}::{1}", Index, Name);

                // GCMF
                gcmf = new GCMF(reader, address);

                // Observe why null GCMFs occur
                if (gcmf.TextureCount > 0)
                {
                    // MATERIAL DESCRIPTION
                    textureDescriptor = new TextureDescriptor[gcmf.TextureCount];
                    for (int i = 0; i < textureDescriptor.Length; i++)
                    {
                        textureDescriptor[i] = new TextureDescriptor(reader);
                    }

                    // VERTEX STRIPS
                    // TEMP: NOT INCLUDING MT_TL
                    vertexStrips = new GC_VertexStripCollection[gcmf.Count_MT];
                    if (gcmf.Count_MT > 0)
                    {
                        for (int i = 0; i < gcmf.Count_MT; i++)
                        {
                            vertexStrips[i] = new GC_VertexStripCollection(reader, gcmf);
                        }
                    }
                }
            }