Class: BasisLoader

PIXI.BasisLoader

Loader plugin for handling BASIS supercompressed texture files.

To use this loader, you must bind the basis_universal WebAssembly transcoder. There are two ways of doing this:

  1. Adding a <script> tag to your HTML page to the transcoder bundle in this package, and serving the WASM binary from the same location.
// Copy ./node_modules/@pixi/basis/assets/basis_.wasm into your assets directory
// as well, so it is served from the same folder as the JavaScript!
&lt;script src="./node_modules/@pixi/basis/assets/basis_transcoder.js" /&gt;

NOTE: basis_transcoder.js expects the WebAssembly binary to be named basis_transcoder.wasm. NOTE-2: This method supports transcoding on the main-thread. Only use this if you have 1 or 2 *.basis files.

  1. Loading the transcoder source from a URL.
// Use this if you to use the default CDN url for @pixi/basis
BasisLoader.loadTranscoder();

// Use this if you want to serve the transcoder on your own
BasisLoader.loadTranscoder('./basis_transcoder.js', './basis_transcoder.wasm');

NOTE: This can only be used with web-workers.

Implements

  • PIXI.ILoaderPlugin

Classes

TranscoderWorker

Methods

PIXI.BasisLoader.use (resource, next) void static

Transcodes the *.basis data when the data is loaded. If the transcoder is not bound yet, it will hook transcoding to BasisResource#onTranscoderInitialized.

Name Type Description
resource ILoaderResource
next (...args: any[]) => void