Appearance
@tmrw-realityos/charm • Docs
@tmrw-realityos/charm / KTX2TextureLoader
Class: KTX2TextureLoader
Loader class for the KTX2 file format. https://registry.khronos.org/KTX/specs/2.0/ktxspec.v2.html
Constructors
new KTX2TextureLoader()
new KTX2TextureLoader(
supportedCompression
?):KTX2TextureLoader
Parameters
• supportedCompression?: CompressionFeatureName
Transcode compression target format.
Returns
Defined in
packages/charm/src/helpers/KTX2Loader.ts:35
Properties
transcoderResponse
static
transcoderResponse:Map
<string
,Promise
<Response
>>
Defined in
packages/charm/src/helpers/KTX2Loader.ts:31
Methods
decode()
decode(
container
):Promise
<KTX2Container
>
Decode a ktx2 container that contains compressed data.
Parameters
• container: KTX2Container
Texture data in KTX2 format
Returns
Promise
<KTX2Container
>
Container for texture after decode
Defined in
packages/charm/src/helpers/KTX2Loader.ts:123
load()
load(
url
):Promise
<KTX2Container
>
Parse the input data and create a decoded ktx2 container
Parameters
• url: string
KTX2 filename
Returns
Promise
<KTX2Container
>
Container for texture
Defined in
packages/charm/src/helpers/KTX2Loader.ts:88
parse()
parse(
buffer
):Promise
<KTX2Container
>
Similar to load but parses data from an arraybuffer.
Parameters
• buffer: ArrayBuffer
Texture data in KTX2 format
Returns
Promise
<KTX2Container
>
Container for texture
Defined in
packages/charm/src/helpers/KTX2Loader.ts:114
parseContainer()
parseContainer(
buffer
):KTX2Container
Parse the input data and return a ktx2 container without decoding content
Parameters
• buffer: ArrayBuffer
KTX2 arraybuffer
Returns
KTX2Container
Container for texture
Defined in
packages/charm/src/helpers/KTX2Loader.ts:105
setTranscoderWasm()
setTranscoderWasm(
wasmbuf
):Promise
<WebAssemblyInstantiatedSource
>
Set the wasm transcoder from arraybuffer. In a browser environment, the transcoder will be set automatically during decode. In node, however, the transcoder must be set from file content prior to decoding.
Parameters
• wasmbuf: ArrayBuffer
wasm file content
Returns
Promise
<WebAssemblyInstantiatedSource
>
Webassembly instance of the transcoder