class Scene(val spatialInterface: SpatialInterface)
Scene
(
spatialInterface
)
|
Signature
constructor(spatialInterface: SpatialInterface) Parameters
spatialInterface:
SpatialInterface Returns |
handle
:
Long
[Get] |
Signature
val handle: Long |
spatialInterface
:
SpatialInterface
[Get] |
Signature
val spatialInterface: SpatialInterface |
addObject
(
ro
)
|
Add a SceneObject to this Scene.
Signature
fun addObject(ro: SceneObject) Parameters
ro:
SceneObject |
createCylinderLayer
(
sceneSwapChain
, radius
, centralAngle
, aspectRatio
, pivotX
, pivotY
, stereoMode
, sceneObject
)
|
Create a Layer that is shaped like a cylinder.
Signature
fun createCylinderLayer(sceneSwapChain: SceneSwapchain, radius: Float, centralAngle: Float, aspectRatio: Float, pivotX: Float, pivotY: Float, stereoMode: StereoMode, sceneObject: SceneObject): Int Parameters
sceneSwapChain:
SceneSwapchain
radius:
Float
centralAngle:
Float
aspectRatio:
Float
pivotX:
Float
pivotY:
Float
stereoMode:
StereoMode
sceneObject:
SceneObject Returns
Int
|
createEquirectLayer
(
sceneSwapChain
, radius
, centralHorizontalAngle
, upperVerticalAngle
, lowerVerticalAngle
, pivotX
, pivotY
, stereoMode
, sceneObject
)
|
Create a Layer that maps equirectangular images onto a sphere.
Signature
fun createEquirectLayer(sceneSwapChain: SceneSwapchain, radius: Float, centralHorizontalAngle: Float, upperVerticalAngle: Float, lowerVerticalAngle: Float, pivotX: Float, pivotY: Float, stereoMode: StereoMode, sceneObject: SceneObject): Int Parameters
sceneSwapChain:
SceneSwapchain
radius:
Float
centralHorizontalAngle:
Float
upperVerticalAngle:
Float
lowerVerticalAngle:
Float
pivotX:
Float
pivotY:
Float
stereoMode:
StereoMode
sceneObject:
SceneObject Returns
Int
|
createQuadLayer
(
sceneSwapChain
, dimW
, dimH
, pivotX
, pivotY
, stereoMode
, sceneObject
)
|
Create a Layer that is shaped like a quad.
Signature
fun createQuadLayer(sceneSwapChain: SceneSwapchain, dimW: Float, dimH: Float, pivotX: Float, pivotY: Float, stereoMode: StereoMode, sceneObject: SceneObject): Int Parameters
sceneSwapChain:
SceneSwapchain
dimW:
Float
dimH:
Float
pivotX:
Float
pivotY:
Float
stereoMode:
StereoMode
sceneObject:
SceneObject Returns
Int
|
destroyObject
(
ro
)
|
Remove and destroy a SceneObject from this Scene.
Signature
fun destroyObject(ro: SceneObject) Parameters
ro:
SceneObject |
discoverSpaces
(
fetchOptions
)
|
Find all the space.
Signature
fun discoverSpaces(fetchOptions: Anchor.FetchOptions): CompletableFuture<Array<Anchor>> Parameters
fetchOptions:
Anchor.FetchOptions
Returns
CompletableFuture
|
drawDebugLine
(
from
, to
, color
, displayCount
)
|
Draw a line in the Scene, often used for debugging.
Signature
fun drawDebugLine(from: Vector3, to: Vector3, color: Color, displayCount: Int) |
drawDebugLine
(
from
, to
, startColor
, endColor
, displayCount
)
|
Draw a line in the Scene, often used for debugging.
Signature
fun drawDebugLine(from: Vector3, to: Vector3, startColor: Color, endColor: Color, displayCount: Int) |
enableEnvironmentDepth
(
enabled
)
|
Experimental: Enable environment depth. May not work.
Signature
fun enableEnvironmentDepth(enabled: Boolean) Parameters
enabled:
Boolean
|
enableHolePunching
(
enabled
)
|
Tells the renderer to render poseable layers before rendering out the scene. This means the app will be responsible for hole-punching the layers.
See our Layers and UI Quality docs for more information.
Signature
fun enableHolePunching(enabled: Boolean) Parameters
enabled:
Boolean
|
enableMrPlaneTracker
(
enabled
)
|
Enable the MR plane tracker.
Signature
fun enableMrPlaneTracker(enabled: Boolean) Parameters
enabled:
Boolean
|
enablePassthrough
(
enabled
)
|
Enable pass through of the real world into the scene.
Signature
fun enablePassthrough(enabled: Boolean) Parameters
enabled:
Boolean
|
enableVirtualCamera
(
enable
)
|
Enable the virtual camera.
Signature
fun enableVirtualCamera(enable: Boolean) Parameters
enable:
Boolean
|
getAnchorBoundary2D
(
anchorHandle
)
|
Get the 2D boundary of an anchor.
Signature
fun getAnchorBoundary2D(anchorHandle: Long): Array<Vector2> Parameters
anchorHandle:
Long
Returns
Array
|
getAnchorBoundingBox2D
(
anchorHandle
)
|
Get the 2D bounding box of an anchor.
Signature
fun getAnchorBoundingBox2D(anchorHandle: Long): Bound2D? Parameters
anchorHandle:
Long
|
getAnchorBoundingBox3D
(
anchorHandle
)
|
Get the 3D bounding box for an anchor.
Signature
fun getAnchorBoundingBox3D(anchorHandle: Long): Bound3D? Parameters
anchorHandle:
Long
|
getAnchorPose
(
anchorHandle
)
|
Get the pose of an anchor.
Signature
fun getAnchorPose(anchorHandle: Long): Pose Parameters
anchorHandle:
Long
|
getAnchorPose
(
index
)
|
Get the pose of an anchor.
Signature
fun getAnchorPose(index: Int): Pose Parameters
index:
Int
Returns |
getAnchorSemanticLabels
(
anchorHandle
)
|
Get the semantic lables for an anchor.
Signature
fun getAnchorSemanticLabels(anchorHandle: Long): List<String> Parameters
anchorHandle:
Long
Returns
List
|
getAnchorSemanticLabels
(
index
)
|
Get the semantic labels for an anchor by index.
Signature
fun getAnchorSemanticLabels(index: Int): String Parameters
index:
Int
Returns
String
|
getConfirmedFrameRate
()
|
Signature
fun getConfirmedFrameRate(): Float Returns
Float
|
getControllerPoseAtTime
(
isLeftHandle
, time
)
|
Get the pose of the controller at a given time.
Signature
fun getControllerPoseAtTime(isLeftHandle: Boolean, time: Long): ControllerPose Parameters
isLeftHandle:
Boolean
time:
Long
|
getEyeOffsets
()
|
Get the current eye offsets for the stereo camera system.
Eye offsets describe the relative position of each eye from the center of the head. Positive X values offset to the right, Positive Y values offsets up, and positive Z offsets forward. Rotation of eyes is the same as head position.
Signature
fun getEyeOffsets(): Pair<Vector3, Vector3><Vector3, Vector3> Returns
Pair<Vector3, Vector3>
|
getNumberOfObjects
()
|
Get the number of SceneObjects in the scene.
Signature
fun getNumberOfObjects(): Int Returns
Int
|
getSessionStartPose
()
|
Returns the pose that was set at the beginning of the session. This is useful for setting the starting position of entities so that they are placed relative to the user.
Signature
fun getSessionStartPose(): Pose |
getSpaceContainer
(
anchorHandle
)
|
Get the space container from an anchor.
Signature
fun getSpaceContainer(anchorHandle: Long): Array<UUID> Parameters
anchorHandle:
Long
Returns
Array
|
getSpaceRoomLayout
(
anchorHandle
)
|
Get the RoomLayout from an anchor handle.
Signature
fun getSpaceRoomLayout(anchorHandle: Long): Anchor.RoomLayout Parameters
anchorHandle:
Long
Returns
Anchor.RoomLayout
|
getSpaceTriangleMesh
(
anchorHandle
)
|
Get the space triangle mesh associated with an anchor handle.
Signature
fun getSpaceTriangleMesh(anchorHandle: Long): Anchor.SpaceTriangleMesh Parameters
anchorHandle:
Long
Returns
Anchor.SpaceTriangleMesh
|
getViewerPose
()
|
Get the viewer's pose in the Scene.
Signature
fun getViewerPose(): Pose |
getViewOrigin
()
|
Returns the last position that viewer's orgin was set to.
Signature
fun getViewOrigin(): Vector3 |
getViewSceneRotation
()
|
Get the last rotation of the viewer, with X+ being 0 degrees.
Signature
fun getViewSceneRotation(): Float Returns
Float
|
hasObject
(
ro
)
|
Check if a SceneObject is part of this Scene.
Signature
fun hasObject(ro: SceneObject): Boolean Parameters
ro:
SceneObject Returns
Boolean
|
isSystemPassthroughEnabled
()
|
Is the passthrough system enabled. Returns true if the app is launched in passthrough mode and false if in immersive mode. This value is set at the app launch and will not change during the app's lifetime.
Signature
fun isSystemPassthroughEnabled(): Boolean Returns
Boolean
|
lineSegmentIntersect
(
from
, to
)
|
Test if a line segment intersects with anything in the scene.
Signature
fun lineSegmentIntersect(from: Vector3, to: Vector3): HitInfo? Parameters |
loadRenderModelMesh
(
path
)
|
Load a render model mesh given a path to a device. This uses the XR_FB_render_model OpenXR extension.
Signature
fun loadRenderModelMesh(path: String): SceneMesh? Parameters
path:
String
|
onClick
(
hitInfo
, sourceOfInput
)
| |
onClickDown
(
hitInfo
, sourceOfInput
)
| |
onHoverStart
(
sceneObjectHandle
, sourceOfInput
)
|
Handler for when a pointer start to hover over a SceneObject.
Signature
fun onHoverStart(sceneObjectHandle: Long, sourceOfInput: Entity) Parameters
sceneObjectHandle:
Long
sourceOfInput:
Entity |
onHoverStop
(
sceneObjectHandle
, sourceOfInput
)
|
Handler for when a pointer stops hovering over a SceneObject.
Signature
fun onHoverStop(sceneObjectHandle: Long, sourceOfInput: Entity) Parameters
sceneObjectHandle:
Long
sourceOfInput:
Entity |
onInput
(
hitInfo
, sourceOfInput
, changedIn
, buttonState
)
|
Handler for when we receive input that does intersect with SceneObjects.
Signature
fun onInput(hitInfo: HitInfo, sourceOfInput: Entity, changedIn: Int, buttonState: Int): Boolean Parameters Returns
Boolean
|
onNoIntersectionInput
(
sourceOfInput
, changedIn
, buttonState
)
|
Handler for when we receive input that does not intersect with any SceneObjects.
Signature
fun onNoIntersectionInput(sourceOfInput: Entity, changedIn: Int, buttonState: Int) Parameters
sourceOfInput:
Entity
changedIn:
Int
buttonState:
Int
|
playBackgroundSound
(
soundAsset
, volume
, looping
)
|
Plays a sound which attached to the user pose, there is ony one background sound. The sound equivalent to an environment box
Signature
fun playBackgroundSound(soundAsset: SceneAudioAsset, volume: Float, looping: Boolean) Parameters
soundAsset:
SceneAudioAsset
volume:
Float
looping:
Boolean
|
playSound
(
soundAsset
, position
, volume
)
|
Plays a sound within the 3d environment. The sound spatialization will update depending on head movement.
Signature
fun playSound(soundAsset: SceneAudioAsset, position: Vector3, volume: Float = 1.0f) Parameters
soundAsset:
SceneAudioAsset
position:
Vector3
volume:
Float
|
playSound
(
soundfile
, entity
, volume
)
|
Plays a sound within the 3d environment. The sound spatialization will update depending on head movement
Signature
fun playSound(soundfile: SceneAudioAsset, entity: Entity, volume: Float = 1.0f) Parameters
soundfile:
SceneAudioAsset
entity:
Entity
volume:
Float
|
playSound
(
soundAsset
, volume
)
|
Plays a sound which is attached to the user pose
Signature
fun playSound(soundAsset: SceneAudioAsset, volume: Float = 1.0f) Parameters
soundAsset:
SceneAudioAsset
volume:
Float
|
processQueries
(
dataModel
)
|
Process queries on a data model.
Signature
fun processQueries(dataModel: DataModel): Boolean Parameters
dataModel:
DataModel Returns
Boolean
|
rayArcIntersect
(
from
, forward
, gravity
, steps
, color
)
|
Draws and intersects a ray arc in the scene.
Signature
fun rayArcIntersect(from: Vector3, forward: Vector3, gravity: Vector3, steps: Int, color: Color = Color.valueOf(Color.TRANSPARENT)): HitInfo? Parameters Returns |
reloadShaders
(
baseDir
, vertexShaders
, fragmentShaders
)
|
Hot-reloads the given shaders at runtime. This functionality may be disabled.
Signature
fun reloadShaders(baseDir: String, vertexShaders: List<String>, fragmentShaders: List<String>) Parameters
baseDir:
String
vertexShaders:
List
fragmentShaders:
List
|
removeLayer
(
id
)
|
Remove a Layer form the Scene.
Signature
fun removeLayer(id: Int) Parameters
id:
Int
|
requestSceneCapture
()
|
Request scene capture.
Signature
fun requestSceneCapture(): CompletableFuture<Unit> Returns
CompletableFuture
|
resetSessionStartPose
()
|
This function resets the session start pose to the current pose. This can be used to reset the session start pose when the user moves around.
Signature
fun resetSessionStartPose() |
setDepthParams
(
minDepth
, maxDepth
)
|
Set the depth parameters on the Scene.
Signature
fun setDepthParams(minDepth: Float, maxDepth: Float) Parameters
minDepth:
Float
maxDepth:
Float
|
setGlobalTransformScale
(
scale
)
|
Sets the global scale factor applied to all transforms in the transform system. This scale is applied globally to all entities during transform calculations.
Signature
fun setGlobalTransformScale(scale: Vector3) Parameters
scale:
Vector3 |
setGlobalTransformScale
(
scaleX
, scaleY
, scaleZ
)
|
Sets the global scale factor applied to all transforms in the transform system. This scale is applied globally to all entities during transform calculations.
Signature
fun setGlobalTransformScale(scaleX: Float, scaleY: Float, scaleZ: Float) Parameters
scaleX:
Float
scaleY:
Float
scaleZ:
Float
|
setLayerAlphaBlend
(
id
, srcFactorColor
, dstFactorColor
, srcFactorAlpha
, dstFactorAlpha
)
|
Set the alpha blend factors on a Layer. The integers correspond to the different layer alpha blend factors.
Signature
fun setLayerAlphaBlend(id: Int, srcFactorColor: Int, dstFactorColor: Int, srcFactorAlpha: Int, dstFactorAlpha: Int) Parameters
id:
Int
srcFactorColor:
Int
dstFactorColor:
Int
srcFactorAlpha:
Int
dstFactorAlpha:
Int
|
setLayerClip
(
id
, minLeftU
, minLeftV
, maxLeftU
, maxLeftV
, minRightU
, minRightV
, maxRightU
, maxRightV
)
|
Set clip bounds on a Layer in UV space.
Signature
fun setLayerClip(id: Int, minLeftU: Float, minLeftV: Float, maxLeftU: Float, maxLeftV: Float, minRightU: Float = minLeftU, minRightV: Float = minLeftV, maxRightU: Float = maxLeftU, maxRightV: Float = maxLeftV) Parameters
id:
Int
minLeftU:
Float
minLeftV:
Float
maxLeftU:
Float
maxLeftV:
Float
minRightU:
Float
minRightV:
Float
maxRightU:
Float
maxRightV:
Float
|
setLayerColorScaleBias
(
id
, scaleR
, scaleG
, scaleB
, scaleA
, biasR
, biasG
, biasB
, biasA
)
|
Set the scale and bias on the color of a Layer.
Signature
fun setLayerColorScaleBias(id: Int, scaleR: Float, scaleG: Float, scaleB: Float, scaleA: Float, biasR: Float, biasG: Float, biasB: Float, biasA: Float) Parameters
id:
Int
scaleR:
Float
scaleG:
Float
scaleB:
Float
scaleA:
Float
biasR:
Float
biasG:
Float
biasB:
Float
biasA:
Float
|
setLayerFilters
(
id
, filters
)
|
Applies the specified layer filters
Signature
fun setLayerFilters(id: Int, filters: Int) Parameters
id:
Int
filters:
Int
|
setLayerScale
(
id
, x
, y
, z
)
|
Set the scale of a Layer in the Scene.
Signature
fun setLayerScale(id: Int, x: Float, y: Float, z: Float) Parameters
id:
Int
x:
Float
y:
Float
z:
Float
|
setLayerSecure
(
id
, secureLayer
)
|
When set to true ensures the layer can not be copied or captured by other apps.
Signature
fun setLayerSecure(id: Int, secureLayer: Boolean) Parameters
id:
Int
secureLayer:
Boolean
|
setLayerZIndex
(
id
, zIndex
)
|
Set a Layer's Z index in depth ordering (default 0). If layers have the same z index, we will try to sort by distance to viewer.
Signature
fun setLayerZIndex(id: Int, zIndex: Int) Parameters
id:
Int
zIndex:
Int
|
setLightingEnvironment
(
ambientColor
, sunColor
, sunDirection
, environmentIntensity
)
|
Set the lighting environment for this Scene.
Signature
fun setLightingEnvironment(ambientColor: Vector3, sunColor: Vector3, sunDirection: Vector3, environmentIntensity: Float = 1.0f) |
setPassthroughLUT
(
lut
)
|
Sets a custom lookup table for color grading passthrough rendering. Passing null will remove any existing LUT, resetting passthrough to default colors.
Signature
fun setPassthroughLUT(lut: Lut?) Parameters
lut:
Lut? |
setPreferredDisplayRate
(
rate
)
|
Set the preferred display rate.
Signature
fun setPreferredDisplayRate(rate: Float): Boolean Parameters
rate:
Float
Returns
Boolean
|
setReferenceSpace
(
space
)
|
Sets the current OpenXR reference space. This may be wanted if you are working on a Mixed Reality vs purely Virtual Reality app.
For more details, see the OpenXR documentation.
Signature
fun setReferenceSpace(space: ReferenceSpace) Parameters
space:
ReferenceSpace |
setSecureLayers
(
secureLayers
)
|
When set to true ensures the layers can not be copied or captured by other apps.
Signature
fun setSecureLayers(secureLayers: Boolean) Parameters
secureLayers:
Boolean
|
setSkipRender
(
skipRender
)
|
UNSTABLE API. When set to true skips the rendering of the scene
Signature
fun setSkipRender(skipRender: Boolean) Parameters
skipRender:
Boolean
|
setSpaceComponentStatus
(
anchorHandle
, type
, enable
, timeoutNs
)
|
Set the component status of a space.
Signature
fun setSpaceComponentStatus(anchorHandle: Long, type: Anchor.SpaceComponentType, enable: Boolean, timeoutNs: Long = 0): CompletableFuture<Void> Parameters
anchorHandle:
Long
type:
Anchor.SpaceComponentType
enable:
Boolean
timeoutNs:
Long
Returns
CompletableFuture
|
setViewOrigin
(
x
, y
, z
)
|
Moves the viewer to the specified location.
Signature
fun setViewOrigin(x: Float, y: Float, z: Float) Parameters
x:
Float
y:
Float
z:
Float
|
setViewOrigin
(
x
, y
, z
, degRotation
)
|
Moves the viewer to the specified location, facing the specified direction.
Signature
fun setViewOrigin(x: Float, y: Float, z: Float, degRotation: Float) Parameters
x:
Float
y:
Float
z:
Float
degRotation:
Float
|
setVirtualCameraPose
(
pose
)
|
Set the virtual camera pose.
Signature
fun setVirtualCameraPose(pose: Pose) Parameters
pose:
Pose |
stopBackgroundSound
()
|
Stop playing the background sound.
Signature
fun stopBackgroundSound() |
tickMRScene
()
|
Process one tick of the Scene.
Signature
fun tickMRScene() |
updateCylinderLayer
(
id
, radius
, centralAngle
, aspectRatio
, pivotX
, pivotY
, stereoMode
)
|
Update a cylinder layer with new parameters.
Signature
fun updateCylinderLayer(id: Int, radius: Float, centralAngle: Float, aspectRatio: Float, pivotX: Float, pivotY: Float, stereoMode: Int) Parameters
id:
Int
radius:
Float
centralAngle:
Float
aspectRatio:
Float
pivotX:
Float
pivotY:
Float
stereoMode:
Int
|
updateEquirectLayer
(
id
, radius
, centralHorizontalAngle
, upperVerticalAngle
, lowerVerticalAngle
, pivotX
, pivotY
, stereoMode
)
|
Update an equirectangular layer with new parameters.
Signature
fun updateEquirectLayer(id: Int, radius: Float, centralHorizontalAngle: Float, upperVerticalAngle: Float, lowerVerticalAngle: Float, pivotX: Float, pivotY: Float, stereoMode: Int) Parameters
id:
Int
radius:
Float
centralHorizontalAngle:
Float
upperVerticalAngle:
Float
lowerVerticalAngle:
Float
pivotX:
Float
pivotY:
Float
stereoMode:
Int
|
updateIBLEnvironment
(
envFilename
)
|
Update IBL environment with an image filename.
Signature
fun updateIBLEnvironment(envFilename: String) Parameters
envFilename:
String
|
updateQuadLayer
(
id
, dimW
, dimH
, pivotX
, pivotY
, stereoMode
)
|
Update a quad layer with new parameters.
Signature
fun updateQuadLayer(id: Int, dimW: Float, dimH: Float, pivotX: Float, pivotY: Float, stereoMode: Int) Parameters
id:
Int
dimW:
Float
dimH:
Float
pivotX:
Float
pivotY:
Float
stereoMode:
Int
|
updateViewOrigin
(
deltaMove
, deltaRotation
)
|
Offset the viewer by a certain amount.
Signature
fun updateViewOrigin(deltaMove: Float, deltaRotation: Float) Parameters
deltaMove:
Float
deltaRotation:
Float
|