Compatibility loader
Decode the legacy container, keep the GPU decision explicit.
The loader preserves compressed levels and their format metadata. The consuming runtime decides whether those blocks can be uploaded directly or need a migration/transcode path.
Input
Crunch `.crn` compressed texture files.
Decode
Read compressed mip levels through the worker path.
Describe
Expose dimensions, level shapes, and texture formats.
Migrate
Use KTX2/Basis for new portable asset pipelines.
Detailed guide
CrunchLoader reference
The detailed reference covers CRN input, worker loading, mip-level output, format metadata, and compatibility considerations.
Loader for compressed textures in the Crunch file format
| CrunchLoader | |
|---|---|
| File Format | CRN |
| File Extension | .crn |
| File Type | Binary |
| Data Format | TextureLevel[] |
| Supported APIs | load, parse |
Usage
import {CrunchLoader} from '@loaders.gl/images/crunch';
import {load} from '@loaders.gl/core';
const mipLevels = await load(url, CrunchLoader);
for (const level of mipLevels) {
console.log(level.shape, level.format, level.textureFormat);
}
Data Format
Returns TextureLevel[], one entry per mip level.
Each level includes:
shape: 'texture-level'compressedformattextureFormatwidthheightdatalevelSizewhen available
Options
| Option | Type | Default | Description |
|---|---|---|---|
| N/A |
Module Overrides
Use options.modules to override the Crunch runtime used by CrunchLoader.
modules.crunch: supply a preloaded Crunch decoder factory.'crunch.js': override the URL used for the Crunch decoder script.