예제 #1
0
        public static DdsDX10Extension Deserialize(BinaryReader reader)
        {
            var header = new DdsDX10Extension();

            header.dxgiFormat        = (DXGIFormat)reader.ReadUInt32();
            header.resourceDimension = reader.ReadUInt32();
            header.miscFlag          = reader.ReadUInt32();
            header.arraySize         = reader.ReadUInt32();
            header.reserved          = reader.ReadUInt32();

            return(header);
        }
예제 #2
0
        public static DdsFile Deserialize(BinaryReader reader)
        {
            var file = new DdsFile();

            file.dwMagic = reader.ReadString(4);
            if (file.dwMagic != magicNumber)
            {
                throw new IOException($"Expected header file identifier ({magicNumber}) does not match the deserialized identifier ({file.dwMagic})");
            }

            file.header = DdsHeader.Deserialize(reader);
            if (file.header.ddspf.fourCC == dx10Identifier)
            {
                file.dx10Extension = DdsDX10Extension.Deserialize(reader);
            }

            file.data = reader.ReadRemainingBytes();

            return(file);
        }