MaterialProvider

MaterialProvider supplies materials to glTF assets during loading: the ubershader provider picks from a pre-compiled set of materials, see createUbershaderProvider.

See also

Constructors

Link copied to clipboard
constructor(nativeHandle: NativePointer)

Properties

Link copied to clipboard

The provider's cache of compiled materials (weak references).

Link copied to clipboard
Link copied to clipboard

The native object, for interop with code calling the Fila* C API directly. Read-only: this wrapper owns it.

Functions

Link copied to clipboard
open override fun close()

Same as destroy; lets this be used with use { }.

Link copied to clipboard
fun createMaterialInstance(config: MaterialKey, uvmap: UvMap, label: String? = "material", extras: String? = null): MaterialInstance?

Creates or fetches a compiled Filament material, then creates an instance from it.

Link copied to clipboard
fun destroy()

Frees the provider itself; cached materials survive unless destroyMaterials was called.

Link copied to clipboard

Destroys all cached materials. NOT called by destroy, which lets clients take ownership of the cache if desired.

Link copied to clipboard
fun getMaterial(config: MaterialKey, uvmap: UvMap, label: String? = "material"): Material?

Creates or fetches the compiled Filament material corresponding to config, without instancing it.

Link copied to clipboard

Returns true if the given vertex attribute must be present. Some providers (e.g. ubershader) require dummy attribute values when the glTF model does not provide them.