ResourceLoader

actual class ResourceLoader(engine: Engine, normalizeSkinningWeights: Boolean) : AutoCloseable

ResourceLoader loads external resources referenced by glTF assets.

ResourceLoader handles:

  • Loading textures from URIs

  • Uploading vertex/index buffer data

  • Computing tangent quaternions (via Mikktspace when needed)

  • Async resource loading for progressive rendering

Typical usage:

val resourceLoader = ResourceLoader(engine)
resourceLoader.loadResources(asset) // Synchronously load all resources
resourceLoader.destroy()

Async usage:

resourceLoader.asyncBeginLoad(asset)
while (resourceLoader.asyncGetLoadProgress() < 1.0f) {
resourceLoader.asyncUpdateLoad() // Load in chunks
}

See also

expect class ResourceLoader(engine: Engine, normalizeSkinningWeights: Boolean = false) : AutoCloseable

ResourceLoader loads external resources referenced by glTF assets.

ResourceLoader handles:

  • Loading textures from URIs

  • Uploading vertex/index buffer data

  • Computing tangent quaternions (via Mikktspace when needed)

  • Async resource loading for progressive rendering

Typical usage:

val resourceLoader = ResourceLoader(engine)
resourceLoader.loadResources(asset) // Synchronously load all resources
resourceLoader.destroy()

Async usage:

resourceLoader.asyncBeginLoad(asset)
while (resourceLoader.asyncGetLoadProgress() < 1.0f) {
resourceLoader.asyncUpdateLoad() // Load in chunks
}

See also

actual class ResourceLoader(engine: Engine, normalizeSkinningWeights: Boolean) : AutoCloseable

ResourceLoader loads external resources referenced by glTF assets.

ResourceLoader handles:

  • Loading textures from URIs

  • Uploading vertex/index buffer data

  • Computing tangent quaternions (via Mikktspace when needed)

  • Async resource loading for progressive rendering

Typical usage:

val resourceLoader = ResourceLoader(engine)
resourceLoader.loadResources(asset) // Synchronously load all resources
resourceLoader.destroy()

Async usage:

resourceLoader.asyncBeginLoad(asset)
while (resourceLoader.asyncGetLoadProgress() < 1.0f) {
resourceLoader.asyncUpdateLoad() // Load in chunks
}

See also

actual class ResourceLoader(engine: Engine, normalizeSkinningWeights: Boolean) : AutoCloseable

ResourceLoader loads external resources referenced by glTF assets.

ResourceLoader handles:

  • Loading textures from URIs

  • Uploading vertex/index buffer data

  • Computing tangent quaternions (via Mikktspace when needed)

  • Async resource loading for progressive rendering

Typical usage:

val resourceLoader = ResourceLoader(engine)
resourceLoader.loadResources(asset) // Synchronously load all resources
resourceLoader.destroy()

Async usage:

resourceLoader.asyncBeginLoad(asset)
while (resourceLoader.asyncGetLoadProgress() < 1.0f) {
resourceLoader.asyncUpdateLoad() // Load in chunks
}

See also

actual class ResourceLoader(engine: Engine, normalizeSkinningWeights: Boolean) : AutoCloseable

ResourceLoader loads external resources referenced by glTF assets.

ResourceLoader handles:

  • Loading textures from URIs

  • Uploading vertex/index buffer data

  • Computing tangent quaternions (via Mikktspace when needed)

  • Async resource loading for progressive rendering

Typical usage:

val resourceLoader = ResourceLoader(engine)
resourceLoader.loadResources(asset) // Synchronously load all resources
resourceLoader.destroy()

Async usage:

resourceLoader.asyncBeginLoad(asset)
while (resourceLoader.asyncGetLoadProgress() < 1.0f) {
resourceLoader.asyncUpdateLoad() // Load in chunks
}

See also

Constructors

Link copied to clipboard
actual constructor(engine: Engine, normalizeSkinningWeights: Boolean)

Create a ResourceLoader.

expect constructor(engine: Engine, normalizeSkinningWeights: Boolean = false)

Create a ResourceLoader.

actual constructor(engine: Engine, normalizeSkinningWeights: Boolean)
actual constructor(engine: Engine, normalizeSkinningWeights: Boolean)

Create a ResourceLoader.

actual constructor(engine: Engine, normalizeSkinningWeights: Boolean)

Properties

Link copied to clipboard
val ResourceLoader.nativeObject: MemorySegment?
val ResourceLoader.nativeObject: CPointer<FilaResourceLoader>?

Functions

Link copied to clipboard
actual fun addResourceData(url: String, data: ByteArray)

Feeds the binary content of an external resource into the loader's URI cache.

expect fun addResourceData(url: String, data: ByteArray)

Feeds the binary content of an external resource into the loader's URI cache.

actual fun addResourceData(url: String, data: ByteArray)

Feeds the binary content of an external resource into the loader's URI cache.

actual fun addResourceData(url: String, data: ByteArray)

Feeds the binary content of an external resource into the loader's URI cache.

actual fun addResourceData(url: String, data: ByteArray)

Feeds the binary content of an external resource into the loader's URI cache.

Link copied to clipboard

Starts an asynchronous resource load (texture decoding may use worker threads). Requires periodic calls to asyncUpdateLoad until asyncGetLoadProgress reaches 1.0.

Starts an asynchronous resource load (texture decoding may use worker threads). Requires periodic calls to asyncUpdateLoad until asyncGetLoadProgress reaches 1.0.

Starts an asynchronous resource load (texture decoding may use worker threads). Requires periodic calls to asyncUpdateLoad until asyncGetLoadProgress reaches 1.0.

Starts an asynchronous resource load (texture decoding may use worker threads). Requires periodic calls to asyncUpdateLoad until asyncGetLoadProgress reaches 1.0.

Starts an asynchronous resource load (texture decoding may use worker threads). Requires periodic calls to asyncUpdateLoad until asyncGetLoadProgress reaches 1.0.

Link copied to clipboard
actual fun asyncCancelLoad()

Cancels pending decoder jobs, frees all CPU-side texel data, and flushes the Engine. Only needed if asyncBeginLoad was used and cancellation is required before completion.

expect fun asyncCancelLoad()

Cancels pending decoder jobs, frees all CPU-side texel data, and flushes the Engine. Only needed if asyncBeginLoad was used and cancellation is required before completion.

actual fun asyncCancelLoad()

Cancels pending decoder jobs, frees all CPU-side texel data, and flushes the Engine. Only needed if asyncBeginLoad was used and cancellation is required before completion.

actual fun asyncCancelLoad()

Cancels pending decoder jobs, frees all CPU-side texel data, and flushes the Engine. Only needed if asyncBeginLoad was used and cancellation is required before completion.

@PlatformGap(platforms = [FilamentPlatform.WEB], behavior = "silent no-op — filament.js binds no asyncCancelLoad; let the load finish instead.")
actual fun asyncCancelLoad()

Cancels pending decoder jobs, frees all CPU-side texel data, and flushes the Engine. Only needed if asyncBeginLoad was used and cancellation is required before completion.

Link copied to clipboard

Gets the status of an asynchronous load as a percentage in [0, 1].

Gets the status of an asynchronous load as a percentage in [0, 1].

Gets the status of an asynchronous load as a percentage in [0, 1].

Gets the status of an asynchronous load as a percentage in [0, 1].

Gets the status of an asynchronous load as a percentage in [0, 1].

Link copied to clipboard
actual fun asyncUpdateLoad()

Performs any pending main-thread work of an asynchronous load. Call periodically until asyncGetLoadProgress returns 1.0; harmless after that.

expect fun asyncUpdateLoad()

Performs any pending main-thread work of an asynchronous load. Call periodically until asyncGetLoadProgress returns 1.0; harmless after that.

actual fun asyncUpdateLoad()

Performs any pending main-thread work of an asynchronous load. Call periodically until asyncGetLoadProgress returns 1.0; harmless after that.

actual fun asyncUpdateLoad()

Performs any pending main-thread work of an asynchronous load. Call periodically until asyncGetLoadProgress returns 1.0; harmless after that.

actual fun asyncUpdateLoad()

Performs any pending main-thread work of an asynchronous load. Call periodically until asyncGetLoadProgress returns 1.0; harmless after that.

Link copied to clipboard
actual open override fun close()

Same as destroy; lets this be used with use { } and try-with-resources.

expect open override fun close()

Same as destroy; lets this be used with use { } and try-with-resources.

actual open override fun close()

Same as destroy; lets this be used with use { } and try-with-resources.

actual open override fun close()

Same as destroy; lets this be used with use { } and try-with-resources.

actual open override fun close()

Same as destroy; lets this be used with use { } and try-with-resources.

Link copied to clipboard
actual fun destroy()

Destroys this loader and frees its internal caches. Must happen on the same thread that calls Renderer.render(), because the loader listens to buffer callbacks to know when CPU-side data blobs can be freed.

expect fun destroy()

Destroys this loader and frees its internal caches. Must happen on the same thread that calls Renderer.render(), because the loader listens to buffer callbacks to know when CPU-side data blobs can be freed.

actual fun destroy()

Destroys this loader and frees its internal caches. Must happen on the same thread that calls Renderer.render(), because the loader listens to buffer callbacks to know when CPU-side data blobs can be freed.

actual fun destroy()

Destroys this loader and frees its internal caches. Must happen on the same thread that calls Renderer.render(), because the loader listens to buffer callbacks to know when CPU-side data blobs can be freed.

actual fun destroy()

Destroys this loader and frees its internal caches. Must happen on the same thread that calls Renderer.render(), because the loader listens to buffer callbacks to know when CPU-side data blobs can be freed.

Link copied to clipboard
actual fun evictResourceData()

Frees memory by evicting the URI cache populated via addResourceData. Call only after a model is fully loaded or loading has been cancelled.

expect fun evictResourceData()

Frees memory by evicting the URI cache populated via addResourceData. Call only after a model is fully loaded or loading has been cancelled.

actual fun evictResourceData()

Frees memory by evicting the URI cache populated via addResourceData. Call only after a model is fully loaded or loading has been cancelled.

actual fun evictResourceData()

Frees memory by evicting the URI cache populated via addResourceData. Call only after a model is fully loaded or loading has been cancelled.

@PlatformGap(platforms = [FilamentPlatform.WEB], behavior = "silent no-op — filament.js binds no evictResourceData; the loader frees its copies when destroyed.")
actual fun evictResourceData()

Frees memory by evicting the URI cache populated via addResourceData. Call only after a model is fully loaded or loading has been cancelled.

Link copied to clipboard
actual fun hasResourceData(url: String): Boolean

Checks whether the given resource URI has already been added via addResourceData.

expect fun hasResourceData(url: String): Boolean

Checks whether the given resource URI has already been added via addResourceData.

actual fun hasResourceData(url: String): Boolean

Checks whether the given resource URI has already been added via addResourceData.

actual fun hasResourceData(url: String): Boolean

Checks whether the given resource URI has already been added via addResourceData.

actual fun hasResourceData(url: String): Boolean

Checks whether the given resource URI has already been added via addResourceData.

Link copied to clipboard
actual fun loadResources(asset: FilamentAsset): Boolean

Synchronously loads resources for asset from the URI cache and finalizes the asset: transforms vertex data if necessary, decodes images, and supplies tangent data.

expect fun loadResources(asset: FilamentAsset): Boolean

Synchronously loads resources for asset from the URI cache and finalizes the asset: transforms vertex data if necessary, decodes images, and supplies tangent data.

actual fun loadResources(asset: FilamentAsset): Boolean

Synchronously loads resources for asset from the URI cache and finalizes the asset: transforms vertex data if necessary, decodes images, and supplies tangent data.

actual fun loadResources(asset: FilamentAsset): Boolean

Synchronously loads resources for asset from the URI cache and finalizes the asset: transforms vertex data if necessary, decodes images, and supplies tangent data.

actual fun loadResources(asset: FilamentAsset): Boolean

Synchronously loads resources for asset from the URI cache and finalizes the asset: transforms vertex data if necessary, decodes images, and supplies tangent data.