androidx.xr.scenecore.guava


Top-level functions summary

ListenableFuture<ExrImage>

Public factory for an ExrImage, asynchronously loading a preprocessed skybox from a Path relative to the application's assets/ folder.

ListenableFuture<ExrImage>

Public factory for an ExrImage, asynchronously loading a preprocessed skybox from a Uri.

ListenableFuture<GltfModel>

Public factory for a GltfModel, where the glTF is asynchronously loaded from a Path relative to the application's assets/ folder.

ListenableFuture<GltfModel>

Public factory for a GltfModel, where the glTF is asynchronously loaded from a Uri.

Extension functions summary

ListenableFuture<HitTestResult>
ScenePose.hitTestAsync(
    session: Session,
    origin: Vector3,
    direction: Vector3
)

Creates a HitTestResult from the specified origin in the specified direction into the scene.

ListenableFuture<HitTestResult>
ScenePose.hitTestAsync(
    session: Session,
    origin: Vector3,
    direction: Vector3,
    hitTestFilter: Int
)

Creates a HitTestResult from the specified origin in the specified direction into the scene.

Top-level functions

createExrImageFromZipAsync

@MainThread
fun createExrImageFromZipAsync(session: Session, path: Path): ListenableFuture<ExrImage>

Public factory for an ExrImage, asynchronously loading a preprocessed skybox from a Path relative to the application's assets/ folder.

The input .zip file should contain the preprocessed image-based lighting (IBL) data, typically generated from an .exr or .hdr environment map using a tool like Filament's cmgen. See: https://github.com/google/filament/tree/main/tools/cmgen

Parameters
session: Session

The Session to use for loading the asset.

path: Path

The Path of the preprocessed .zip skybox file to be loaded, relative to the application's assets/ folder.

Returns
ListenableFuture<ExrImage>

a ListenableFuture which will provide the ExrImage upon completion. Listeners will be called on the main thread if Runnable::run is supplied when adding a listener to the ListenableFuture. @throws IllegalArgumentException if Path.isAbsolute is true, as this method requires a relative path, or if the path does not specify a .zip file.

createExrImageFromZipAsync

@MainThread
fun createExrImageFromZipAsync(session: Session, uri: Uri): ListenableFuture<ExrImage>

Public factory for an ExrImage, asynchronously loading a preprocessed skybox from a Uri.

The input .zip file should contain the preprocessed image-based lighting (IBL) data, typically generated from an .exr or .hdr environment map using a tool like Filament's cmgen. See: https://github.com/google/filament/tree/main/tools/cmgen

Parameters
session: Session

The Session to use for loading the asset.

uri: Uri

The Uri of the preprocessed .zip skybox file to be loaded.

Returns
ListenableFuture<ExrImage>

a ListenableFuture which will provide the ExrImage upon completion. Listeners will be called on the main thread if Runnable::run is supplied when adding a listener to the ListenableFuture. @throws IllegalArgumentException if the Uri does not specify a .zip file.

createGltfModelAsync

@MainThread
fun createGltfModelAsync(session: Session, path: Path): ListenableFuture<GltfModel>

Public factory for a GltfModel, where the glTF is asynchronously loaded from a Path relative to the application's assets/ folder.

Currently, only binary glTF (.glb) files are supported.

Parameters
session: Session

The Session to use for loading the model.

path: Path

The Path of the binary glTF (.glb) model to be loaded, relative to the application's assets/ folder.

Returns
ListenableFuture<GltfModel>

a ListenableFuture. Listeners will be called on the main thread if Runnable::run is supplied when adding a listener to the ListenableFuture.

Throws
kotlin.IllegalArgumentException

if path.isAbsolute is true, as this method requires a relative path.

createGltfModelAsync

@MainThread
fun createGltfModelAsync(session: Session, uri: Uri): ListenableFuture<GltfModel>

Public factory for a GltfModel, where the glTF is asynchronously loaded from a Uri.

Currently, only binary glTF (.glb) files are supported.

Parameters
session: Session

The Session to use for loading the model.

uri: Uri

The Uri for a binary glTF (.glb) model to be loaded.

Returns
ListenableFuture<GltfModel>

a ListenableFuture. Listeners will be called on the main thread if Runnable::run is supplied when adding a listener to the ListenableFuture.

Extension functions

fun ScenePose.hitTestAsync(
    session: Session,
    origin: Vector3,
    direction: Vector3
): ListenableFuture<HitTestResult>

Creates a HitTestResult from the specified origin in the specified direction into the scene.

Parameters
session: Session

The session the ScenePose is in.

origin: Vector3

The translation of the origin of the hit test relative to this ScenePose.

direction: Vector3

The direction for the hit test ray from the origin.

Returns
ListenableFuture<HitTestResult>

a ListenableFuture. The HitResult describes if it hit something and where relative to this ScenePose. Listeners will be called on the main thread if Runnable::run is supplied.

fun ScenePose.hitTestAsync(
    session: Session,
    origin: Vector3,
    direction: Vector3,
    hitTestFilter: Int
): ListenableFuture<HitTestResult>

Creates a HitTestResult from the specified origin in the specified direction into the scene.

Parameters
session: Session

The session the ScenePose is in.

origin: Vector3

The translation of the origin of the hit test relative to this ScenePose.

direction: Vector3

The direction for the hit test ray from the origin

hitTestFilter: Int

Filter for which scenes to hit test. Hitting other scenes is only allowed for apps with the com.android.extensions.xr.ACCESS_XR_OVERLAY_SPACE permission.

Returns
ListenableFuture<HitTestResult>

a ListenableFuture. The HitResult describes if it hit something and where relative to this ScenePose. Listeners will be called on the main thread if Runnable::run is supplied.