PIXI.BasisLoader

class BasisLoader implements {PIXI.ILoaderPlugin}

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.

Constructor


new PIXI.BasisLoader() → {}

Loader plugin for handling BASIS supercompressed texture files.

Summary


Methods from BasisLoader

void
static use(resource: PIXI.LoaderResource, next: (...args: any[]) => void)

Public Methods


use BasisLoader.ts:66
static use(resource: PIXI.LoaderResource, next: (...args: any[]) => void) → {void}

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

Parameters:
Name Type Description
resource PIXI.LoaderResource

loader resource that is checked to see if it is a basis file

next (...args: any[]) => void

callback Function to call when done

Returns:
Type Description
void
See: PIXI.Loader.loaderMiddleware

Powered by webdoc!