Block Compression (BC1-BC5, BC7) texture decoders
npm install @bis-toolkit/bcnBlock Compression (BC1-BC5, BC7) texture decoders for TypeScript.
- BC1 (DXT1): RGB/RGBA compression with 1-bit alpha
- BC2 (DXT3): RGBA compression with explicit alpha
- BC3 (DXT5): RGBA compression with interpolated alpha
- BC4: Single channel compression
- BC5: Two channel compression (normal maps)
- BC6H: HDR compression _(not yet implemented - complex 14-mode HDR format)_
- BC7: High quality RGBA compression
``bash`
npm install @bis-toolkit/bcn
`typescript
import { decodeBC1, decodeBC3, decodeBC7 } from '@bis-toolkit/bcn';
// Decode BC7 compressed data
const rgba = decodeBC7(compressedData, width, height);
// Decode BC1 (DXT1)
const rgba = decodeBC1(compressedData, width, height);
// Decode BC3 (DXT5)
const rgba = decodeBC3(compressedData, width, height);
`
All decoders return a Uint8Array containing RGBA data (4 bytes per pixel).
Note: BC6H (HDR) decoder is not yet implemented due to its complexity (14 modes with signed/unsigned variants).
This library is a direct TypeScript port of BCnEncoder.NET, originally created by Nominom and licensed under the MIT License.
```
Copyright © 2025 Nominom
Licensed under the MIT License
GPLv3 © Alpine Labs - see LICENSE.
This work is derived from BCnEncoder.NET (MIT License) and is redistributed under GPLv3.