Options
All
  • Public
  • Public/Protected
  • All
V1.7
  • V1.6
  • V1.7
Menu

Class ImmersiveApp

Base class for Lumin Runtime immersive apps.

Hierarchy

Index

Constructors

Methods

Constructors

constructor

  • Creates an immersive application instance.

    Parameters

    • Optional a_fTimeDelta: number

      default = 0.0
      - the preferred update rate as a time interval in seconds. As a special case, 0.0f represents event-based mode, where update callbacks will not happen at regular intervals -- only in response to events.

    Returns ImmersiveApp

Methods

addNamed6DOFPoseAction

  • addNamed6DOFPoseAction(a_actionName: string): number
  • Maps Control's 6DoF to a NamedInputEventData.

    Parameters

    • a_actionName: string

      The name of the NamedInputEventData.

    Returns number

    The Id that can be used to identify this event when received in the eventListener

addNamedButtonAction

  • addNamedButtonAction(a_actionName: string, a_keyCode: KeyCodes, a_longPress?: boolean): number
  • Maps a Control button to a NamedInputEventData.

    Parameters

    • a_actionName: string

      The name of the NamedInputEventData.

    • a_keyCode: KeyCodes

      The button's key code

    • Optional a_longPress: boolean

      default = false
      Whether the event should be emitted on long press (true) or short press (false)

    Returns number

    The Id that can be used to identify this event when received in the eventListener

addNamedEyeTrackingAction

  • addNamedEyeTrackingAction(a_actionName: string): number
  • Maps eye tracking events to a NamedInputEventData.

    Parameters

    • a_actionName: string

      The name of the NamedInputEventData.

    Returns number

    The Id that can be used to identify this event when received in the eventListener

addNamedHandGestureAction

  • addNamedHandGestureAction(a_actionName: string, a_handGesture: GestureType, a_hold?: boolean, a_once?: boolean, a_handIndex?: number): number
  • Maps the hand gesture to a NamedInputEventData.

    Parameters

    • a_actionName: string

      The name of the NamedInputEventData.

    • a_handGesture: GestureType

      Hand gesture type.

    • Optional a_hold: boolean

      default = false
      Whether the event should be sent immediately (true), or send only if the gesture is held for 1.5 seconds (false).

    • Optional a_once: boolean

      default = true
      Whether the event should be repeated (true), or send only once (false).

    • Optional a_handIndex: number

      default = 0xFFFFFFFF
      Hand index that the event should be associated with (Left = 0, Right = 1, Both = 0xFFFFFFFF).

    Returns number

    The Id that can be used to identify this event when received in the eventListener.

addNamedTouchAction

  • Maps a Control gesture to a NamedInputEventData.

    Parameters

    • a_actionName: string

      The name of the NamedInputEventData.

    • a_touchGesture: GestureType

      Touch gesture type.

    • Optional a_touchDirection: GestureDirection

      default = input.GestureDirection.UNKNOWN
      Gesture's direction (GestureDirection::UNKNOWN for all).

    Returns number

    The Id that can be used to identify this event when received in the eventListener

checkPrivilege

deInit

  • deInit(): number

deletePrism

  • deletePrism(prism: Prism | null): void

deregisterForConnectionsInviteEvents

  • deregisterForConnectionsInviteEvents(): boolean

dismissAllNotifications

  • dismissAllNotifications(): void

dismissNotification

eventListener

getComponentName

  • getComponentName(): string

getCurrentLocaleHelper

getFloorHeight

  • getFloorHeight(): number | null
  • Returns the height (y-value) of the floor, if known, in world coordinates.

    priv

    WorldReconstruction

    Returns number | null

    Returned floor height.

getHeadposeConfidence

  • getHeadposeConfidence(): number

getHeadposeError

  • getHeadposeError(): Error

getHeadposeMode

  • getHeadposeMode(): Mode

getHeadposeWorldForwardVector

  • getHeadposeWorldForwardVector(): [number, number, number]

getHeadposeWorldPosition

  • getHeadposeWorldPosition(): [number, number, number]

getHeadposeWorldUpVector

  • getHeadposeWorldUpVector(): [number, number, number]

getInput

  • Get the input state tracking system (used to maintain the list of active input devices and track their input)

    Returns InputHelper | null

    a pointer to the input state tracking system

getLocaleCode

  • getLocaleCode(): string | null

getNearestPCF

  • getNearestPCF(worldLocation: [number, number, number] | Float32Array): PCFId
  • Returns the nearest Persistent Coordinate Frame to a given world location. NOTE: This function can be slow, use sparingly.

    priv

    PcfRead

    Parameters

    • worldLocation: [number, number, number] | Float32Array

      Position to get the PCF from.

    Returns PCFId

    The PCF. If it is INVALID_PCF, it is likely the world mesh hasn't been built up enough to create the PCF data, or the app doesn't have the PcfRead privilege set.

getPCFCount

  • getPCFCount(): number

getPCFData

  • Gets data associated with a given PCF.

    priv

    PcfRead

    Parameters

    • pcf: PCFId

      The PCF to fetch data for.

    Returns PCFData

    PCF data. Check the state value of the returned data to verify that it is good.

getPCFs

  • getPCFs(): Array<PCFId>
  • Returns a list of the Persistent Coordinate Frames the system knows about. It is suggested that this function should only be called when getPCFCount() > 0 and has changed since the previous call.

    priv

    PcfRead

    Returns Array<PCFId>

    PCF list.

getPackageName

  • getPackageName(): string

getPackagePath

  • getPackagePath(): string

getPreloadedResources

getPrism

  • getPrism(prismId: bigint): Prism | null

getPrismPosition

  • getPrismPosition(a_prism: Prism | null): [number, number, number]

getPrismRotation

  • getPrismRotation(a_prism: Prism | null): [number, number, number, number]

getPrismTransform

  • getPrismTransform(a_prism: Prism | null): [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]
  • Returns the transform of a volume in world space

    Parameters

    • a_prism: Prism | null

      the prism

    Returns [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]

    The transform of the Prism in world space

getTempPath

  • getTempPath(): string
  • Returns the application's path for temporary files

    note

    the path will have a trailing / appended to it e.g. /data/local/tmp/

    priv

    none

    Returns string

getVisibleName

  • getVisibleName(): string

getWorldMeshBlockData

  • getWorldMeshBlockData(a_blockPos: [number, number, number] | Float32Array, a_blockData: WorldMeshBlockData): boolean
  • Returns the world mesh data for a block at a given location.

    Parameters

    • a_blockPos: [number, number, number] | Float32Array

      Block position in world-space.

    • a_blockData: WorldMeshBlockData

      Class that will be filled in with the block data.

    Returns boolean

    true if blockData has valid data

getWritablePath

  • getWritablePath(): string
  • Returns the application's writable path.

    This folder is accessible to the application when the user has logged in once, even if the device is locked and not in use. An application that needs to write data when running in the background (e.g. a music app) should use this path. The same application can continue using this path when the device is unlocked afterwards.

    note

    the path will have a trailing / appended to it e.g. /data/user/1/apps/com.magicleap.app/documents/C2/

    priv

    none

    Returns string

getWritablePathWhenUnlocked

  • getWritablePathWhenUnlocked(): string
  • Returns the application's writable path while unlocked.

    This folder is accessible to the application when the user has logged in and the device is unlocked and being used.

    note

    the path will have a trailing / appended to it e.g. /data/user/1/apps/com.magicleap.app/documents/C2/

    priv

    none

    Returns string

isHandOcclusionEnabled

  • isHandOcclusionEnabled(): boolean
  • Gets whether hand occlusion is currently enabled or not

    Returns boolean

    true if currently enabled, false otherwise

isImageTrackingReady

  • isImageTrackingReady(): boolean
  • Returns if the image tracking system is ready to be used. Do not call any image tracking functions until this function returns true.

    Currently image tracking is only available for immersive apps.

    priv

    CameraCapture

    Returns boolean

    true if we can start tracking images.

isInternetConnected

  • isInternetConnected(): boolean

isShareableApp

  • isShareableApp(): boolean

isSkipRaycast

  • isSkipRaycast(a_prism: Prism | null): boolean
  • Returns the skip raycast state of the volume.

    Parameters

    • a_prism: Prism | null

      The Prism.

    Returns boolean

    true if the prism is skipped during raycasting

isWiFiConnected

  • isWiFiConnected(): boolean

isWiFiEnabled

  • isWiFiEnabled(): boolean

lockCurrentLocaleHelperToLocale

  • lockCurrentLocaleHelperToLocale(localeCode: string): void

onAppPause

  • onAppPause(): void

onAppResume

  • onAppResume(): void

onAppStart

  • onAppStart(initArg: InitArg): void

onAppUnloadResources

  • onAppUnloadResources(): void

onDeviceActive

  • onDeviceActive(): void

onDeviceReality

  • onDeviceReality(): void

onDeviceStandby

  • onDeviceStandby(): void

onSharingStart

  • onSharingStart(sessionId: bigint, sceneGraphIDs: Array<bigint>): void

onSharingStop

  • onSharingStop(sessionId: bigint): void

orientPrism

  • orientPrism(a_prism: Prism | null, a_orientation: [number, number, number, number] | Float32Array): void
  • Sets the Orientation of the Prism

    Parameters

    • a_prism: Prism | null

      the prism

    • a_orientation: [number, number, number, number] | Float32Array

      the new prism orientation quaternion

    Returns void

orientPrismRelativeToCamera

  • orientPrismRelativeToCamera(a_prism: Prism | null, a_orientation: [number, number, number, number] | Float32Array): void

positionPrism

  • positionPrism(a_prism: Prism | null, a_position: [number, number, number] | Float32Array): void

positionPrismRelativeToCamera

  • positionPrismRelativeToCamera(a_prism: Prism | null, a_position: [number, number, number] | Float32Array): void

postNotification

  • postNotification(notification: Notification | null): boolean
  • Post the given notification

    priv

    NormalNotificationsUsage

    Parameters

    • notification: Notification | null

      the notification to post

    Returns boolean

    true if the notification was posted successfully, false otherwise

quit

  • quit(): void
  • The application will terminate on the next update loop when this is called.

    priv

    none

    Returns void

raycastNodes

  • raycastNodes(a_prism: Prism | null, a_rayStart: [number, number, number] | Float32Array, a_rayEnd: [number, number, number] | Float32Array): RayCastResultLight | null
  • Do a raycast in a prism and return the results.

    Parameters

    • a_prism: Prism | null

      Prism to do the ray in.

    • a_rayStart: [number, number, number] | Float32Array

      Ray starting position, in volume coordinates.

    • a_rayEnd: [number, number, number] | Float32Array

      Ray end position, in volume coordinates.

    Returns RayCastResultLight | null

    Hit data.

registerForConnectionsInviteEvents

  • registerForConnectionsInviteEvents(): boolean

registerOnLocaleChangedCallback

  • registerOnLocaleChangedCallback(callbackFunction: ((arg0: string) => void) | null): CallbackID
  • Register a callback for when the system locale is changed

    Parameters

    • callbackFunction: ((arg0: string) => void) | null

      the function to be called (the new locale code is given as a parameter)

    Returns CallbackID

    the internal ID of the callback, can be used to unregister the callback

requestNewPrism

  • requestNewPrism(a_size: [number, number, number] | Float32Array, a_ePrismType?: PrismType): Prism | null
  • Get a new Prism for use by the Application

    priv

    none

    Parameters

    • a_size: [number, number, number] | Float32Array

      width, height, and breadth of the prism.

    • Optional a_ePrismType: PrismType

      default = PrismType.kWorld
      - Type of Prism (eg: Tied to Headpose or Fixed in the world)

    Returns Prism | null

    Prism - The prism

requestPrivilege

requestPrivilegeBlocking

requestWorldMeshBlockUpdates

  • requestWorldMeshBlockUpdates(a_prism: Prism | null): boolean
  • Request to get updates when world mesh block data has changed. WorldMeshBlockEventData messages will be sent to the app's eventListener function when there is a change to the mesh blocks.

    Parameters

    • a_prism: Prism | null

      Prism used to send the event messages.

    Returns boolean

    true if the request was made successfully

requestWorldPlaneCast

  • requestWorldPlaneCast(center: [number, number, number] | Float32Array, maxDistance: number, maxPlaneCount: number, flags: PlanecastFlags, userValue: bigint): boolean
  • Sends a request to the server to search for planes in the environment that match given criteria. A WorldPlaneCastEventData instance will be sent to the app's eventListener function when the data is ready.

    priv

    WorldReconstruction

    Parameters

    • center: [number, number, number] | Float32Array

      Position in world-space that is the center of the search space.

    • maxDistance: number

      Max distance from the center to search for planes.

    • maxPlaneCount: number

      Maximum number of planes to return.

    • flags: PlanecastFlags

      Flags to determine what kind of planes to look for.

    • userValue: bigint

      Value that will be sent back in the WorldPlaneCastEventData instance.

    Returns boolean

    true if the request was sent, false on error

requestWorldRayCast

  • requestWorldRayCast(rayStart: [number, number, number] | Float32Array, rayDir: [number, number, number] | Float32Array, userValue: bigint, confidenceThreshold?: number): boolean
  • requestWorldRayCast(rayStart: [number, number, number] | Float32Array, rayDir: [number, number, number] | Float32Array, width: number, height: number, horizFovDeg: number, userValue: bigint, confidenceThreshold?: number): boolean
  • Performs a single ray cast against the world around you. Results are returned as a WorldRayCastEventData to the app's eventListener function.

    priv

    WorldReconstruction

    Parameters

    • rayStart: [number, number, number] | Float32Array

      The start point of the ray, in world space.

    • rayDir: [number, number, number] | Float32Array

      Direction to shoot the ray

    • userValue: bigint

      Custom data that you wish to record with this request

    • Optional confidenceThreshold: number

      default = 0.199
      Confidence level (between 0 and 1) that must be reached for the raycast to be considered valid

    Returns boolean

    true if the request was sent, false on error

  • Performs an area ray cast against the world around you. Results are returned as a WorldRayCastEventData to the app's eventListener function.

    priv

    WorldReconstruction

    Parameters

    • rayStart: [number, number, number] | Float32Array

      The start point of the ray, in world space.

    • rayDir: [number, number, number] | Float32Array

      Direction to shoot the ray

    • width: number

      Number of horizontal rays

    • height: number

      Number of vertical rays

    • horizFovDeg: number

      Horizontal field-of-view, in degrees

    • userValue: bigint

      Custom data that you wish to record with this request

    • Optional confidenceThreshold: number

      default = 0.199
      Confidence level (between 0 and 1) that must be reached for the raycast to be considered valid

    Returns boolean

    true if the request was sent, false on error

resizePrism

  • resizePrism(a_prism: Prism | null, a_size: [number, number, number] | Float32Array): void
  • Resizes the Prism

    Parameters

    • a_prism: Prism | null

      the prism to resize

    • a_size: [number, number, number] | Float32Array

      the new size of the prism

    Returns void

selectPrism

  • selectPrism(a_prism: Prism | null, a_bSelected: boolean): void
  • Selects or deselects the specified prism.

    Input and other events are delivered only to the selected prism.

    priv

    none

    Parameters

    • a_prism: Prism | null

      the prism

    • a_bSelected: boolean

      true to select; false to deselect

    Returns void

setAudioOutputDeviceChangeCallback

  • setAudioOutputDeviceChangeCallback(callback: ((arg0: AudioOutputDevice) => void) | null): void
  • Sets the callback function to be called when audio output device is changed. Note: The callback will run on main thread. No need to use runOnMainThread() inside the callback.

    Parameters

    • callback: ((arg0: AudioOutputDevice) => void) | null

      std::function to be called as callback. See AudioOutputDeviceChangedCallback.

    Returns void

setEventSleepTime

  • setEventSleepTime(a_fSleepTime: number): void
  • Set the Event Sleep Time

    This is the amount of time the client should sleep before firing the updateloop callback, if no other events have occured.

    priv

    none

    Parameters

    • a_fSleepTime: number

      Time to sleep in seconds, or 0.0f to sleep indefinitely, until an event occurs.

    Returns void

setHandOcclusionEnabled

  • setHandOcclusionEnabled(a_enable: boolean): void
  • Enables or disables hand occlusion

    Parameters

    • a_enable: boolean

      Set to true to enable hand occlusion, false to disable

    Returns void

setOcclusionEnabled

  • setOcclusionEnabled(a_enabled: boolean): void
  • Toggles occlusion.

    priv

    Occlusion

    Parameters

    • a_enabled: boolean

      true to enable occlusion, false to disable

    Returns void

setSkipRaycast

  • setSkipRaycast(a_prism: Prism | null, a_skipRaycast: boolean): void
  • Sets the skip raycast state of the prism. If the prism is skipped, all its Nodes will be as well.

    Parameters

    • a_prism: Prism | null

      The Prism.

    • a_skipRaycast: boolean

      Raycast skip flag.

    Returns void

startExclusiveModeGL

  • Start a full screen exclusive mode for a landscape app which does its own rendering full screen

    Parameters

    • options: ClientOptions

      exclusive client options

    • ctxGl: void | null

      OpenGL render context

    Returns ExclusiveRender | null

    exclusive mode renderer

stopExclusiveMode

  • stopExclusiveMode(): boolean

stopTrackImage

  • stopTrackImage(imageName: string): boolean
  • Stops tracking an image. If no images are being tracked, will disable tracking.

    Currently image tracking is only available for immersive apps.

    priv

    CameraCapture

    Parameters

    • imageName: string

      Name of the image. Should be the same as the name passed to one of the the trackImage functions.

    Returns boolean

    true if tracking the image was stopped

stopWorldMeshBlockUpdates

  • stopWorldMeshBlockUpdates(a_prism: Prism | null): boolean
  • Request to stop getting updates when world mesh block data has changed.

    Parameters

    • a_prism: Prism | null

      Prism used to make the requestWorldMeshBlockUpdates call.

    Returns boolean

    true if the request was made successfully

trackMovingImage

  • trackMovingImage(imageName: string, dimensions: [number, number] | Float32Array, file: string, prism: Prism | null): boolean
  • Starts a request to track a moving image, based on an image file. Moving images are harder to track than non-moving ones; use this function only if sure the image is moving. This will enable tracking if it is not already enabled.

    Currently image tracking is only available for immersive apps.

    priv

    CameraCapture

    Parameters

    • imageName: string

      Unique name for the image.

    • dimensions: [number, number] | Float32Array

      Approximate size of the image, in meters. This is used to help identify the image.

    • file: string

      File name of the image to track. Name is relative to the app's location.

    • prism: Prism | null

      Where to send the image position info

    Returns boolean

    true if tracking was started, false if there was an error.

trackStaticImage

  • trackStaticImage(imageName: string, dimensions: [number, number] | Float32Array, file: string, prism: Prism | null): boolean
  • Starts a request to track an non-moving image, based on an image file. Static images are easier to track than moving ones, so use this method if possible. This will enable tracking if it is not already enabled.

    Currently image tracking is only available for immersive apps.

    priv

    CameraCapture

    Parameters

    • imageName: string

      Unique name for the image.

    • dimensions: [number, number] | Float32Array

      Approximate size of the image, in meters. This is used to help identify the image.

    • file: string

      File name of the image to track. Name is relative to the app's location.

    • prism: Prism | null

      Where to send the image position info

    Returns boolean

    true if tracking was started, false if there was an error.

triggerControlBodyHaptics

  • triggerControlBodyHaptics(pattern: VibePattern, duration?: number, intensity?: VibeIntensity, controlID?: number, deviceID?: number): void
  • Request vibration haptics on the body of the control device

    priv

    none

    Parameters

    • pattern: VibePattern

      the vibration pattern to use

    • Optional duration: number

      default = 100
      the duration to play the pattern over (ms)

    • Optional intensity: VibeIntensity

      default = haptics.VibeIntensity.MEDIUM
      the intensity of the vibration

    • Optional controlID: number

      default = INVALID_CONTROL_ID
      the ID of the control to use (0 will be the primary control)

    • Optional deviceID: number

      default = INVALID_DEVICE_ID
      the internal ID of the device to use (note, this takes precedence over the control ID)

    Returns void

triggerControlCustomHaptic

  • triggerControlCustomHaptic(haptic: HapticInfo, controlID?: number, deviceID?: number): void
  • Trigger a custom control haptic

    priv

    none

    Parameters

    • haptic: HapticInfo

      and individual custom haptic

    • Optional controlID: number

      default = INVALID_CONTROL_ID
      the ID of the control to use (0 will be the primary control)

    • Optional deviceID: number

      default = INVALID_DEVICE_ID
      the internal ID of the device to use (note, this takes precedence over the control ID)

    Returns void

triggerControlCustomHaptics

  • triggerControlCustomHaptics(haptics: Array<HapticInfo>, controlID?: number, deviceID?: number): void
  • Trigger a list of custom control haptics

    priv

    none

    Parameters

    • haptics: Array<HapticInfo>

      the combined list of haptics

    • Optional controlID: number

      default = INVALID_CONTROL_ID
      the ID of the control to use (0 will be the primary control)

    • Optional deviceID: number

      default = INVALID_DEVICE_ID
      the internal ID of the device to use (note, this takes precedence over the control ID)

    Returns void

triggerControlHaptic

  • triggerControlHaptic(haptic: VibePattern, controlID?: number, deviceID?: number): void
  • triggerControlHaptic(haptic: LedPattern, controlID?: number, deviceID?: number): void
  • Trigger a control vibration haptic

    priv

    none

    Parameters

    • haptic: VibePattern

      the VibePattern to trigger

    • Optional controlID: number

      default = INVALID_CONTROL_ID
      the ID of the control to use (0 will be the primary control)

    • Optional deviceID: number

      default = INVALID_DEVICE_ID
      the internal ID of the device to use (note, this takes precedence over the control ID)

    Returns void

  • Trigger a control LED haptic

    priv

    none

    Parameters

    • haptic: LedPattern

      the LedPattern to trigger

    • Optional controlID: number

      default = INVALID_CONTROL_ID
      the ID of the control to use (0 will be the primary control)

    • Optional deviceID: number

      default = INVALID_DEVICE_ID
      the internal ID of the device to use (note, this takes precedence over the control ID)

    Returns void

triggerControlLEDHaptics

  • triggerControlLEDHaptics(pattern: LedPattern, duration?: number, intensity?: VibeIntensity, controlID?: number, deviceID?: number): void
  • Request light haptics on the LEDs of the control device

    priv

    none

    Parameters

    • pattern: LedPattern

      the LED light pattern to use

    • Optional duration: number

      default = 100
      the duration to play the pattern over (ms)

    • Optional intensity: VibeIntensity

      default = haptics.VibeIntensity.MEDIUM
      the intensity of the haptic

    • Optional controlID: number

      default = INVALID_CONTROL_ID
      the ID of the control to use (0 will be the primary control)

    • Optional deviceID: number

      default = INVALID_DEVICE_ID
      the internal ID of the device to use (note, this takes precedence over the control ID)

    Returns void

unlockCurrentLocaleHelper

  • unlockCurrentLocaleHelper(): void

unregisterOnLocaleChangedCallback

  • unregisterOnLocaleChangedCallback(callbackID: CallbackID): boolean

updateLoop

  • updateLoop(a_fDelta: number): boolean

waitForTermination

  • waitForTermination(): void
  • This call will block the caller thread until the app has finished running. It must NOT be called from the client update thread or it will assert.

    priv

    none

    Returns void

Generated using TypeDoc