protected override void GetUnpalettedTools(ushort version, byte clutFormat, byte depth, int colorsCount, int width, int height, byte[] data, byte[] userData, out Encoding.ColorCodec imageCodec, out Filters.ImageFilter imgFilter) { switch (depth) { case 3: //RGBA32bit 2 planes imageCodec = ColorCodec.CODEC_32BIT_ARGB; imgFilter = new ImageFilterComposer { new GamecubePlanarFilter(), new TileFilter(32, 4, 4, width, height) }; break; case 4: //DXT1 imageCodec = new ColorCodecDXT1Gamecube(width, height); imgFilter = null; break; case 0xA: // I8 imageCodec = ColorCodec.CODEC_8BIT_I8; imgFilter = new TileFilter(8, 8, 4, width, height); break; case 0xB: // IA8 imageCodec = ColorCodec.CODEC_16BITBE_IA8; imgFilter = new TileFilter(16, 4, 4, width, height); break; default: throw new TextureFormatException("Usupported unpalletted image format " + depth); } }
protected override void GetPalettedTools(ushort version, byte clutFormat, byte depth, int colorsCount, int width, int height, byte[] data, byte[] userData, out Encoding.ColorCodec paletteCodec, out Encoding.IndexCodec indexCodec, out Filters.ImageFilter imgFilter, out Filters.PaletteFilter palFilter) { int bpp; switch (depth) { case 5: //C4 bpp = 4; break; case 6: //C8 bpp = 8; break; default: throw new TextureFormatException("Unsupported depth " + depth); } switch (clutFormat) { case 1: paletteCodec = ColorCodec.CODEC_16BITBE_RGB565; break; case 2: paletteCodec = ColorCodec.CODEC_16BITBE_RGB5A3; break; case 3: paletteCodec = ColorCodec.CODEC_16BITBE_IA8; break; case 0xB: //not sure about this (FIX) paletteCodec = ColorCodec.CODEC_16BITBE_IA8; break; default: throw new TextureFormatException("Unsupported clut format " + clutFormat); } indexCodec = IndexCodec.FromBitPerPixel(bpp, ByteOrder.BigEndian); imgFilter = new TileFilter(bpp, 8, 32 / bpp, width, height); palFilter = null; }