Most visited

Recently visited

PortalScene

public class PortalScene
extends Node

java.lang.Object
   ↳ com.viro.core.Node
     ↳ com.viro.core.PortalScene


PortalScene is the root of the subgraph of Nodes that is displayed through a Portal. Each PortalScene can contain any number of child nodes and content, and each PortalScene can have its own background texture. If a PortalScene is set to passable, users are able to walk through the Portal into the PortalScene.

PortalScenes are typically used in AR to create an effect where the user walks from the real world into a virtual world.

See also:

Summary

Nested classes

interface PortalScene.EntryListener

Callback interface for responding to users entering or exiting a PortalScene. 

class PortalScene.PortalSceneBuilder<R extends Node, B extends PortalSceneBuilder<R, B>>

PortalSceneBuilder for creating PortalScene objects. 

Public constructors

PortalScene()

Construct a new PortalScene.

Public methods

void dispose()

Release native resources associated with this PortalScene.

PortalScene.EntryListener getEntryListener()

Get the PortalScene.EntryListener used for responding to portal entry events.

Texture getLightingEnvironment()

Get the lighting environment used by this Scene.

Portal getPortalEntrance()

Get the Portal that serves as this PortalScene's entrance, if any.

boolean isPassable()

Return true if this PortalScene can be entered.

void setBackgroundCubeTexture(Texture cubeTexture)

Set the background of this PortalScene to display a cube-map.

void setBackgroundCubeWithColor(long color)

Set the background of this PortalScene to display the given color.

void setBackgroundRotation(Vector rotation)

Rotate the background image or video by the given radians about the X, Y, and Z axes.

void setBackgroundTexture(Texture texture)

Set the background of this PortalScene to display the texture.

void setEntryListener(PortalScene.EntryListener delegate)

Set the PortalScene.EntryListener to use for responding to the user entering or exiting this PortalScene.

void setLightingEnvironment(Texture lightingEnvironment)

Set the lighting environment to use for the PortalScene.

void setPassable(boolean passable)

Set this PortalScene to be passable, meaning the user can walk into it.

void setPortalEntrance(Portal portal)

Set the Portal that will serve as an entrance into this PortalScene.

Public constructors

PortalScene

PortalScene ()

Construct a new PortalScene. To be displayed, a Portal entrance has to be set for this PortalScene via setPortalEntrance(Portal). The user will then be able to see into this PortalScene through the entrance.

Public methods

dispose

void dispose ()

Release native resources associated with this PortalScene.

getEntryListener

PortalScene.EntryListener getEntryListener ()

Get the PortalScene.EntryListener used for responding to portal entry events.

Returns
PortalScene.EntryListener The listener, or null if none is set.

getLightingEnvironment

Texture getLightingEnvironment ()

Get the lighting environment used by this Scene. The lighting environment is a Texture that acts as a global light source, illuminating surfaces with diffuse and specular ambient light.

Returns
Texture The equirectangular Texture being used as the lighting environment.

getPortalEntrance

Portal getPortalEntrance ()

Get the Portal that serves as this PortalScene's entrance, if any.

Returns
Portal The entrance Portal for this PortalScene.

isPassable

boolean isPassable ()

Return true if this PortalScene can be entered.

Returns
boolean True if the PortalScene is passable.

setBackgroundCubeTexture

void setBackgroundCubeTexture (Texture cubeTexture)

Set the background of this PortalScene to display a cube-map. The provided Texture should wrap a cube-map image. The cube-map will be rendered behind all other content.

Parameters
cubeTexture Texture: The Texture containing the cube-map.

setBackgroundCubeWithColor

void setBackgroundCubeWithColor (long color)

Set the background of this PortalScene to display the given color. The color will be rendered behind all other content.

Parameters
color long: The Color's int value.

setBackgroundRotation

void setBackgroundRotation (Vector rotation)

Rotate the background image or video by the given radians about the X, Y, and Z axes.

Parameters
rotation Vector: Vector containing rotation about the X, Y, and Z axes in radians.

setBackgroundTexture

void setBackgroundTexture (Texture texture)

Set the background of this PortalScene to display the texture. The provided Texture should contain a spherical image or spherical video. The image or video will be rendered behind all other content.

Parameters
texture Texture: The Texture containing the image, or VideoTexture containing the video.

setEntryListener

void setEntryListener (PortalScene.EntryListener delegate)

Set the PortalScene.EntryListener to use for responding to the user entering or exiting this PortalScene. Only used if this PortalScene is set to passable.

Parameters
delegate PortalScene.EntryListener: The listener to use with this PortalScene.

setLightingEnvironment

void setLightingEnvironment (Texture lightingEnvironment)

Set the lighting environment to use for the PortalScene. The lighting environment is a Texture that acts as a global light source, illuminating surfaces with diffuse and specular ambient light. Each pixel in the lighting environment is treated as a light emitter, thereby capturing the environment's global lighting and general feel. This gives objects a sense of belonging to their environment. For this reason it is common to use the scene's background texture as the lighting environment, but this is not necessary.

This method expects an equirectangular texture. Radiance HDR textures (*.hdr) work best, and can be loaded with loadRadianceHDRTexture(Uri).

Parameters
lightingEnvironment Texture: The equirectangular Texture to use as the lighting environment.

setPassable

void setPassable (boolean passable)

Set this PortalScene to be passable, meaning the user can walk into it. If true, the Portal serves as a 'door' into the world encompassed by this PortalScene. If false, the Portal serves as a 'window' into a world that can't be accessed.

Parameters
passable boolean: True to make the PortalScene passable.

setPortalEntrance

void setPortalEntrance (Portal portal)

Set the Portal that will serve as an entrance into this PortalScene. The Portal is essentially a Node containing Geometry or children Nodes that represent the entrance to this PortalScene. The Portal's Geometry should be aligned with the X axis in its local coordinate system, orthogonal to the Z axis, in order to display properly as a gateway into the PortalScene. The transparent sections of the Portal will render the PortalScene; the non-transparent sections will render normally; and the area outside the Portal will render the current Scene that contains the user.

Parameters
portal Portal: The Portal to use as the entrance.

Hooray!