Exemple #1
0
        public void Load(System.IO.BinaryReader reader)
        {
            OEIShared.Utils.FourCC cc = new OEIShared.Utils.FourCC(reader.ReadChars(4));

            if (cc != this._fourCC)
            {
                throw new ApplicationException(this._fourCC.ToString() + " not found in stream");
            }

            this._size = reader.ReadInt32();
            long finalPosition = reader.BaseStream.Position + this._size;

            this._mapPart = OEIShared.Utils.CommonUtils.ConvertZeroTerminatedBytesToString(reader.ReadBytes(128)).TrimEnd('\0');

            this._ddsGroup = new DDSGroup(reader);

            for (int i = 0; i < 18; i++)
            {
                this._texVectors[i] = reader.ReadSingle();
            }

            this._vertexCount   = reader.ReadInt32();
            this._triangleCount = reader.ReadInt32();

            this._vertices = new Vertex[this._vertexCount];
            for (int i = 0; i < this._vertexCount; i++)
            {
                this._vertices[i] = new Vertex(reader);
            }

            this._triangles = new Triangle[this._triangleCount];
            for (int i = 0; i < this._triangleCount; i++)
            {
                this._triangles[i] = new Triangle(reader);
            }

            this._ddsGroup.Load(reader);
            this._ddsGroup.FirstVertex = this._vertices[0];

            this._unkownDataSize = (int)(finalPosition - reader.BaseStream.Position);
            if (this._unkownDataSize > 0)
            {
                this._unknownData = reader.ReadBytes(this._unkownDataSize);
            }
        }
Exemple #2
0
        public void Load( System.IO.BinaryReader reader )
        {
            OEIShared.Utils.FourCC cc = new OEIShared.Utils.FourCC( reader.ReadChars( 4 ) );

            if ( cc != this._fourCC )
                throw new ApplicationException( this._fourCC.ToString() + " not found in stream" );

            this._size = reader.ReadInt32();
            long finalPosition = reader.BaseStream.Position + this._size;
            this._mapPart = OEIShared.Utils.CommonUtils.ConvertZeroTerminatedBytesToString( reader.ReadBytes( 128 ) ).TrimEnd( '\0' );

            this._ddsGroup = new DDSGroup(reader);

            for( int i = 0; i < 18; i++ )
                this._texVectors[i] = reader.ReadSingle();

            this._vertexCount = reader.ReadInt32();
            this._triangleCount = reader.ReadInt32();

            this._vertices = new Vertex[this._vertexCount];
            for ( int i = 0; i < this._vertexCount; i++ )
                this._vertices[i] = new Vertex( reader );

            this._triangles = new Triangle[this._triangleCount];
            for ( int i = 0; i < this._triangleCount; i++ )
                this._triangles[i] = new Triangle( reader );

            this._ddsGroup.Load( reader );
            this._ddsGroup.FirstVertex = this._vertices[0];

            this._unkownDataSize = (int)( finalPosition - reader.BaseStream.Position );
            if ( this._unkownDataSize > 0 )
                this._unknownData = reader.ReadBytes( this._unkownDataSize );
        }