ArSceneView

открытый класс ArSceneView

SurfaceView, который интегрируется с ARCore и визуализирует сцену.

Унаследованные константы

Унаследованные поля

Публичные конструкторы

ArSceneView ( контекст контекста)
Создает объект ArSceneView и привязывает его к контексту Android.
ArSceneView ( контекст контекста, атрибуты AttributeSet )
Создает объект ArSceneView и привязывает его к контексту Android.

Публичные методы

Рамка
получитьАрфрейм ()
Возвращает самый последний кадр ARCore, если он доступен.
инт
getCameraStreamRenderPriority ()
Получите приоритет рендеринга, который управляет порядком рендеринга потока камеры.
PlaneRenderer
getPlaneRenderer ()
Возвращает PlaneRenderer, используемый для управления визуализацией плоскости.
Сессия
получить сеанс ()
Возвращает сеанс ARCore, используемый этим представлением.
логический
isEnvironmentalHdrLightingAvailable ()
Возвращает true, если камера ARCore настроена с Config.LightEstimationMode.ENVIRONMENTAL_HDR.
логический
isLightDirectionUpdateEnabled ()
Проверяет, обновляется ли солнечный свет в каждом кадре на основе оценки освещения окружающей среды HDR.
логический
пустота
пауза ()
Приостанавливает поток рендеринга и сеанс ARCore.
CompletableFuture< Пустота >
pauseAsync ( исполнитель -исполнитель)
Неблокирующий вызов для приостановки потока рендеринга и сеанса ARCore.
пустота
возобновить ()
Возобновляет поток рендеринга и сеанс ARCore.
CompletableFuture< Пустота >
резюмеAsync ( исполнитель -исполнитель)
Неблокирующий вызов для возобновления потока рендеринга и сеанса ARCore в фоновом режиме.

Это должно быть вызвано из onResume().

пустота
setCameraStreamRenderPriority (целочисленный приоритет)
Установите приоритет рендеринга, чтобы управлять порядком рендеринга потока камеры.
пустота
setLightDirectionUpdateEnabled (логическое значение isLightDirectionUpdateEnabled)
Устанавливает, должно ли направление солнечного света, созданное освещением окружающей среды HDR, обновляться в каждом кадре.
пустота
setLightEstimationEnabled (включение логического значения)
Включите оценку освещенности на основе изображения с камеры.
пустота
setupSession ( сеанс сеанса)
Настройте представление с помощью сеанса дополненной реальности.

Унаследованные методы

Публичные конструкторы

общедоступный ArSceneView ( контекстный контекст)

Создает объект ArSceneView и привязывает его к контексту Android.

Чтобы рендеринг работал правильно, setupSession(Session) .

Параметры
контекст контекст Android для использования
Смотрите также

public ArSceneView ( контекст контекста, AttributeSet attrs)

Создает объект ArSceneView и привязывает его к контексту Android.

Чтобы рендеринг работал правильно, setupSession(Session) .

Параметры
контекст контекст Android для использования
атрибуты Android AttributeSet для связи с
Смотрите также

Публичные методы

публичный фрейм getArFrame ()

Возвращает самый последний кадр ARCore, если он доступен. Кадр обновляется в начале каждого кадра рисования. 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 int getCameraStreamRenderPriority ()

Get the render priority that control the order of rendering the camera stream. The priority is between a range of 0 (rendered first) and 7 (rendered last).

The default value is 7, which forces the camera stream to render last. This is best for performance because it prevents overdraw. However, when using a material as an occluder (for example, in the augmented faces sample), this should be changed. Otherwise, the occluder will occlude the camera stream and black will be rendered.

public PlaneRenderer getPlaneRenderer ()

Returns PlaneRenderer, used to control plane visualization.

public Session getSession ()

Returns the ARCore Session used by this view.

public boolean isEnvironmentalHdrLightingAvailable ()

Returns true if the ARCore camera is configured with Config.LightEstimationMode.ENVIRONMENTAL_HDR. When Environmental HDR lighting mode is enabled, the resulting light estimates will be applied to the Sceneform Scene.

Возвращает
  • true if HDR lighting is enabled in Sceneform because ARCore HDR lighting estimation is enabled.

public boolean isLightDirectionUpdateEnabled ()

Checks whether the sunlight is being updated every frame based on the Environmental HDR lighting estimate.

Возвращает
  • true if the sunlight direction is updated every frame, false otherwise.

public boolean isLightEstimationEnabled ()

Возвращает
  • returns true if light estimation is enabled.

public void pause ()

Pauses the rendering thread and ARCore session.

This must be called from onPause().

public CompletableFuture< Void > pauseAsync ( Executor executor)

Non blocking call to pause the rendering thread and ARCore session.

This should be called from onPause().

If pauseAsync is called while another pause or resume is in progress, the pause will be enqueued and happen after the current operation completes.

Параметры
executor
Возвращает
  • A CompletableFuture completed on the main thread on the pause has completed. The future Will will be completed exceptionally if the resume can not be done.

public void resume ()

Resumes the rendering thread and ARCore session.

This must be called from onResume().

Броски
CameraNotAvailableException if the camera can not be opened

public CompletableFuture< Void > resumeAsync ( Executor executor)

Non blocking call to resume the rendering thread and ARCore session in the background

This must be called from onResume().

If called while another pause or resume is in progress, the resume will be enqueued and happen after the current operation completes.

Параметры
executor
Возвращает
  • A CompletableFuture completed on the main thread once the resume has completed. The future will be completed exceptionally if the resume can not be done.

public void setCameraStreamRenderPriority (int priority)

Set the render priority to control the order of rendering the camera stream. The priority is between a range of 0 (rendered first) and 7 (rendered last).

The default value is 7, which forces the camera stream to render last. This is best for performance because it prevents overdraw. However, when using a material as an occluder (for example, in the augmented faces sample), this should be changed. Otherwise, the occluder will occlude the camera stream and black will be rendered.

Параметры
priority

public void setLightDirectionUpdateEnabled (boolean isLightDirectionUpdateEnabled)

Sets whether the sunlight direction generated from Environmental HDR lighting should be updated every frame. If false the light direction will be updated a single time and then no longer change.

This may be used to turn off shadow direction updates when they are distracting or unwanted.

The default state is true, with sunlight direction updated every frame.

Параметры
isLightDirectionUpdateEnabled

public void setLightEstimationEnabled (boolean enable)

Enable Light Estimation based on the camera feed. The color and intensity of the sun's indirect light will be modulated by values provided by ARCore's light estimation. Lit objects in the scene will be affected.

Параметры
enable set to true to enable Light Estimation or false to use the default estimate, which is a pixel intensity of 1.0 and color correction value of white (1.0, 1.0, 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.

Параметры
сеанс the ARCore session to use for this view
Смотрите также