public TextureWrapper(Header header, Stream imageData) { Header = header; ImageData = imageData; Name = Hashing.CreateHashString(header.Hash); Width = header.Width; Height = header.Height; ArrayCount = (uint)(header.ArrayCount > 0 ? header.ArrayCount : 1); MipCount = 1; Platform = new SwitchSwizzle(FormatList[header.Format]); Runtime.TextureCache.Add(this); }
public BntxTexture(BntxFile bntx, Texture tex) { Texture = tex; BntxFile = bntx; Name = tex.Name; Width = tex.Width; Height = tex.Height; MipCount = tex.MipCount; ArrayCount = tex.ArrayLength; DisplayProperties = tex; Platform = new SwitchSwizzle(FormatList[tex.Format]) { BlockHeightLog2 = (uint)tex.BlockHeightLog2, Target = BntxFile.PlatformTarget != "NX " ? 0 : 1, }; RedChannel = SetChannel(tex.ChannelRed); GreenChannel = SetChannel(tex.ChannelGreen); BlueChannel = SetChannel(tex.ChannelBlue); AlphaChannel = SetChannel(tex.ChannelAlpha); if (Texture.Format.ToString().Contains("SRGB")) { IsSRGB = true; } if (tex.SurfaceDim == SurfaceDim.Dim2DArray) { SurfaceType = STSurfaceType.Texture2D_Array; } if (tex.SurfaceDim == SurfaceDim.DimCube) { SurfaceType = STSurfaceType.TextureCube; } if (tex.SurfaceDim == SurfaceDim.DimCubeArray) { SurfaceType = STSurfaceType.TextureCube_Array; } DisplayPropertiesChanged = (o, e) => { OnPropertyChanged(); }; }