Class: TranscoderWorker

PIXI.BasisLoader.TranscoderWorker

Worker class for transcoding *.basis files in background threads.

To enable asynchronous transcoding, you need to provide the URL to the basis_universal transcoding library.

Members

PIXI.BasisLoader.TranscoderWorker.bindingURL string static

URL for the script containing the basis_universal library.

PIXI.BasisLoader.TranscoderWorker.workerURL static

Generated URL for the transcoder worker script.

onMessage protected

Handles responses from the web-worker

Methods

PIXI.BasisLoader.TranscoderWorker.loadTranscoder (jsURL, wasmURL) Promise static

Loads the transcoder source code

Name Type Description
jsURL string

URL to the javascript basis transcoder

wasmURL string

URL to the wasm basis transcoder

Returns:
Type Description
Promise A promise that resolves when both the js and wasm transcoders have been loaded.

PIXI.BasisLoader.TranscoderWorker.setTranscoder (jsSource, wasmSource) void static

Set the transcoder source code directly

Name Type Description
jsSource string

source for the javascript basis transcoder

wasmSource ArrayBuffer

source for the wasm basis transcoder

initAsync () Promise

Returns:
Type Description
Promise a promise that is resolved when the web-worker is initialized

transcodeAsync (basisData, rgbaFormat, rgbFormat) Promise

Creates a promise that will resolve when the transcoding of a *.basis file is complete.

Name Type Description
basisData Uint8Array

*.basis file contents

rgbaFormat BASIS_FORMATS

transcoding format for RGBA files

rgbFormat BASIS_FORMATS

transcoding format for RGB files

Returns:
Type Description
Promise a promise that is resolved with the transcoding response of the web-worker