createModel

fun createModel(buffer: Buffer, resourceResolver: (resourceFileName: String) -> Buffer? = { null }): Model

Creates a Model from the contents of a GLB or GLTF Buffer.

Don't forget to call FilamentAsset.releaseSourceData to free the glTF hierarchy as it is no longer needed (but Not before any call to AssetLoader.createInstance)

Parameters

resourceResolver

Only used for GLTF file. Return a GLTF resource buffer from a relative file location. The given callback is triggered for each requested resource.

See also

AssetLoader.createAsset

fun createModel(assetFileLocation: String, resourceResolver: (resourceFileName: String) -> Buffer? = { resourceFile -> context.assets.readBuffer(getFolderPath(assetFileLocation, resourceFile)) }): Model
fun createModel(file: File, resourceResolver: (resourceFileName: String) -> Buffer? = { resourceFile -> File(file.parent, resourceFile).readBuffer() }): Model

Creates a Model from the contents of a GLB or GLTF asset file.

See also


fun createModel(@RawRes rawResId: Int, resourceResolver: (resourceFileName: String) -> Buffer? = { null }): Model

Creates a Model from the contents of a GLB or GLTF raw file.

See also