public interface SpatialGltfModelSource
Defines the source for a 3D model to be rendered by the SpatialGltfModel composable.
Instances of SpatialGltfModelSource are created using fromPath or fromUri.
Functions
createModel
public suspend fun createModel(session: Session): GltfModel
Creates a GltfModel from the source.
Parameters
| session | The XR session to create the model in. |
Return
The created GltfModel.
Members
Companion
public companion object
Functions
fromPath
public fun fromPath(path: Path): SpatialGltfModelSource
Creates a SpatialGltfModelSource that loads a glTF model from a Path relative to the application's assets/ folder.
Currently, only binary glTF (.glb) files are supported.
Parameters
| path | The path of the binary glTF (.glb) model to be loaded, relative to the application's assets/ folder. |
Return
A SpatialGltfModelSource that can be used with the SpatialGltfModel composable.
Throws: IllegalArgumentException
if path is an absolute path.
fromUri
public fun fromUri(uri: Uri): SpatialGltfModelSource
Creates a SpatialGltfModelSource that loads a glTF model from a content Uri.
This is suitable for loading models from various sources, such as network locations or local storage, that can be represented by a Uri.
Currently, only binary glTF (.glb) files are supported.
Parameters
| uri | The Uri for the binary glTF (.glb) model to be loaded. |
Return
A SpatialGltfModelSource that can be used with the SpatialGltfModel composable.
fromResource
public fun fromResource(context: Context, @RawRes resId: Int): SpatialGltfModelSource
Creates a SpatialGltfModelSource that loads a glTF model from a resource ID.
Currently, only binary glTF (.glb) files are supported.
Parameters
| context | The context to use for loading the resource. |
| resId | The resource ID of the binary glTF (.glb) model to be loaded. |
Return
A SpatialGltfModelSource that can be used with the SpatialGltfModel composable.