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:
- 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!
<script src="./node_modules/@pixi/basis/assets/basis_transcoder.js" />
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.
- 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 |
|
Public Methods
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.
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 |
Type | Description |
---|---|
void |