public DdsFile(Stream s) { if (DataStream.ReadString(s, 4) != magic) { return; } if (DataStream.ReadUInt32(s) != headerSize) { return; } flag = DataStream.ReadUInt32(s); height = DataStream.ReadUInt32(s); width = DataStream.ReadUInt32(s); pitchOrLinearSize = DataStream.ReadUInt32(s); depth = DataStream.ReadUInt32(s); mipMapCount = DataStream.ReadUInt32(s); s.Seek(11 * 4, SeekOrigin.Current); pixelFormat = new DdsPixelFormat(); if (DataStream.ReadUInt32(s) != DdsPixelFormat.size) { return; } pixelFormat.flags = DataStream.ReadUInt32(s); pixelFormat.compressionName = DataStream.ReadChars(s, 4); pixelFormat.RGBBitCount = DataStream.ReadUInt32(s); pixelFormat.RBitMask = DataStream.ReadUInt32(s); pixelFormat.GBitMask = DataStream.ReadUInt32(s); pixelFormat.BBitMask = DataStream.ReadUInt32(s); pixelFormat.ABitMask = DataStream.ReadUInt32(s); caps = DataStream.ReadUInt32(s); caps2 = DataStream.ReadUInt32(s); caps3 = DataStream.ReadUInt32(s); caps4 = DataStream.ReadUInt32(s); DataStream.ReadUInt32(s); data = DataStream.ReadBytes(s, (int)pitchOrLinearSize); SetMipMaps(); }
public DdsFile(DdsPixelFormat format, uint w, uint h) { height = h; width = w; pixelFormat = format; }