HaloMap.RawData.BSPModel.BSPRawDataMetaChunk.H1BSPRawDataMetaChunk C# (CSharp) Method

H1BSPRawDataMetaChunk() public method

The h 1 bsp raw data meta chunk.
public H1BSPRawDataMetaChunk ( int offset, int chunknumber, Meta &meta, Face faces ) : void
offset int The offset.
chunknumber int The chunknumber.
meta HaloMap.Meta.Meta The meta.
faces Face The faces.
return void
            public void H1BSPRawDataMetaChunk(int offset, int chunknumber, ref Meta meta, Face[] faces)
            {
                BinaryReader BR = new BinaryReader(meta.MS);
                BR.BaseStream.Position = offset + 12;
                this.shadertagnumber = meta.Map.Functions.ForMeta.FindMetaByID(BR.ReadInt32());
                this.RawDataChunkInfo = new RawDataOffsetChunk[1];
                BR.BaseStream.Position = offset + 20;
                int surfacestart = BR.ReadInt32();
                this.FaceCount = BR.ReadInt32();
                this.SubMeshInfo = new ModelSubMeshInfo[1];
                this.SubMeshInfo[0] = new ModelSubMeshInfo();
                this.SubMeshInfo[0].IndiceCount = this.FaceCount * 3;
                this.SubMeshInfo[0].ShaderNumber = chunknumber;
                this.IndiceCount = this.SubMeshInfo[0].IndiceCount;
                this.Indices = new short[this.IndiceCount];
                for (int x = 0; x < this.FaceCount; x++)
                {
                    this.Indices[(x * 3) + 0] = (short)faces[surfacestart + x].vertex0Index;
                    this.Indices[(x * 3) + 1] = (short)faces[surfacestart + x].vertex1Index;
                    this.Indices[(x * 3) + 2] = (short)faces[surfacestart + x].vertex2Index;
                }

                BR.BaseStream.Position = offset + 180;
                this.VerticeCount = BR.ReadInt32();
                BR.BaseStream.Position = offset + 248;
                int vertstranslation = BR.ReadInt32() - meta.magic - meta.offset;
                BR.BaseStream.Position = vertstranslation;
                BSPRawDataMetaChunk tempchunk = new BSPRawDataMetaChunk();
                for (int x = 0; x < this.VerticeCount; x++)
                {
                    AddCompressedVertice(ref BR, ref tempchunk);
                }

                this.Vertices = tempchunk.Vertices;
                this.Normals = tempchunk.Normals;
                this.Binormals = tempchunk.Binormals;
                this.Tangents = tempchunk.Tangents;
                this.UVs = tempchunk.UVs;
                this.LightMapUVs = tempchunk.LightMapUVs;
            }