Import
KTX2Loader is an addon, and must be imported explicitly, see Installation#Addons.
import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js';
Constructor
new KTX2Loader( manager : LoadingManager )
Constructs a new KTX2 loader.
| manager |
The loading manager. |
Methods
.detectSupport( renderer : WebGPURenderer | WebGLRenderer ) : KTX2Loader
Detects hardware support for available compressed texture formats, to determine the output format for the transcoder. Must be called before loading a texture.
| renderer |
The renderer. |
- Returns: A reference to this loader.
.detectSupportAsync( renderer : WebGPURenderer ) : Promise (async)
Async version of KTX2Loader#detectSupport.
| renderer |
The renderer. |
- Deprecated: Yes
- Returns: A Promise that resolves when the support has been detected.
.dispose()
Frees internal resources. This method should be called when the loader is no longer required.
.load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback )
Starts loading from the given URL and passes the loaded KTX2 texture
to the onLoad() callback.
| url |
The path/URL of the file to be loaded. This can also be a data URI. |
| onLoad |
Executed when the loading process has been finished. |
| onProgress |
Executed while the loading is in progress. |
| onError |
Executed when errors occur. |
- Overrides: Loader#load
.parse( buffer : ArrayBuffer, onLoad : function, onError : onErrorCallback ) : Promise
Parses the given KTX2 data.
| buffer |
The raw KTX2 data as an array buffer. |
| onLoad |
Executed when the loading/parsing process has been finished. |
| onError |
Executed when errors occur. |
- Overrides: Loader#parse
- Returns: A Promise that resolves when the parsing has been finished.
.setTranscoderPath( path : string ) : KTX2Loader
Sets the transcoder path.
The WASM transcoder and JS wrapper are available from the examples/jsm/libs/basis directory.
| path |
The transcoder path to set. |
- Returns: A reference to this loader.
.setWorkerLimit( workerLimit : number ) : KTX2Loader
Sets the maximum number of Web Workers to be allocated by this instance.
| workerLimit |
The worker limit. |
- Returns: A reference to this loader.