public ximg(ShaderResourceTexture T) { Prop = new bCAccessorPropertyObject(new eCImageResource2()); header = new ximgHeader(); Prop.Properties.addProperty("Width", "int", T.Width); Prop.Properties.addProperty("Height", "int", T.Height); Prop.Properties.addProperty("SkipMips", "long", 0); Prop.Properties.addProperty("PixelFormat", "bTPropertyContainer<enum eCGfxShared::eEColorFormat>", eCImageResource2_eCGfxShared_eEColorFormat.eEColorFormat_DXT1); System.IO.MemoryStream M = new System.IO.MemoryStream(T.Width * T.Height); M.Position = 0; SlimDX.Result r = SlimDX.Direct3D11.Texture2D.ToStream(T.Device.Context, T.Texture, SlimDX.Direct3D11.ImageFileFormat.Dds, M); long l = M.Position; M.Position = 0; tgaData = M.ReadBytes((int)l); M.Dispose(); }
public ximg(ShaderResourceTexture T, EFile rawFile) { Prop = new bCAccessorPropertyObject(new eCImageResource2()); header = new ximgHeader(); Prop.Properties.addProperty("Width", "int", T.Width); Prop.Properties.addProperty("Height", "int", T.Height); Prop.Properties.addProperty("SkipMips", "long", 0); Prop.Properties.addProperty("PixelFormat", "bTPropertyContainer<enum eCGfxShared::eEColorFormat>", eCImageResource2_eCGfxShared_eEColorFormat.eEColorFormat_DXT1); var s = rawFile.Open(System.IO.FileAccess.Read); tgaData = s.GetAllBytes(); rawFile.Close(); }
public override void deSerialize(IFile a_File) { header = new ximgHeader(a_File); a_File.Position = header.PropOffset; Prop = new bCAccessorPropertyObject(a_File); a_File.Position = header.DataOffset; tgaData = a_File.Read<byte>((int)header.DataLength); }