ArSceneView

public class ArSceneView

A SurfaceView that integrates with ARCore and renders a scene.

Inherited Constants

Inherited Fields

Public Constructors

ArSceneView(Context context)
Constructs a ArSceneView object and binds it to an Android Context.
ArSceneView(Context context, AttributeSet attrs)
Constructs a ArSceneView object and binds it to an Android Context.

Public Methods

void
destroy()
Required to exit Sceneform.
Frame
getArFrame()
Returns the most recent ARCore Frame if it is available.
PlaneRenderer
getPlaneRenderer()
Returns PlaneRenderer, used to control plane visualization.
Session
getSession()
Returns the ARCore Session used by this view.
boolean
void
pause()
Pauses the rendering thread and ARCore session.
void
resume()
Resumes the rendering thread and ARCore session.
void
setLightEstimationEnabled(boolean enable)
Enable Light Estimation based on the camera feed.
void
setupSession(Session session)
Setup the view with an AR Session.

Inherited Methods

Public Constructors

public ArSceneView (Context context)

Constructs a ArSceneView object and binds it to an Android Context.

In order to have rendering work correctly, setupSession(Session) must be called.

Parameters
context the Android Context to use

public ArSceneView (Context context, AttributeSet attrs)

Constructs a ArSceneView object and binds it to an Android Context.

In order to have rendering work correctly, setupSession(Session) must be called.

Parameters
context the Android Context to use
attrs the Android AttributeSet to associate with

Public Methods

public void destroy ()

Required to exit Sceneform.

Typically called from onDestroy().

public Frame getArFrame ()

Returns the most recent ARCore Frame if it is available. The frame is updated at the beginning of each drawing frame. Callers of this method should not retain a reference to the return value, since it will be invalid to use the ARCore frame starting with the next frame.

public PlaneRenderer getPlaneRenderer ()

Returns PlaneRenderer, used to control plane visualization.

public Session getSession ()

Returns the ARCore Session used by this view.

public boolean isLightEstimationEnabled ()

Returns
  • returns true if light estimation is enabled.

public void pause ()

Pauses the rendering thread and ARCore session.

This must be called from onPause().

public void resume ()

Resumes the rendering thread and ARCore session.

This must be called from onResume().

Throws
CameraNotAvailableException if the camera can not be opened

public void setLightEstimationEnabled (boolean enable)

Enable Light Estimation based on the camera feed.

Parameters
enable set to true to enable Light Estimation or false to use the default estimate, which is 1.0

public void setupSession (Session session)

Setup the view with an AR Session. This method must be called once to supply the ARCore session. The session is needed for any rendering to occur.

The session is expected to be configured with the update mode of LATEST_CAMERA_IMAGE. Without this configuration, the updating of the ARCore session could block the UI Thread causing poor UI experience.

Parameters
session the ARCore session to use for this view

Send feedback about...