docs.unity3d.com
    目次を表示する/隠す

    Class XRCameraSubsystem

    Provides access to a device's camera.

    Inheritance
    Object
    SubsystemWithProvider
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider<XRCameraSubsystem, XRCameraSubsystemDescriptor, XRCameraSubsystem.Provider>
    XRCameraSubsystem
    SimulationCameraSubsystem
    Inherited Members
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider<UnityEngine.XR.ARSubsystems.XRCameraSubsystem, UnityEngine.XR.ARSubsystems.XRCameraSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRCameraSubsystem.Provider>.OnCreate()
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider<UnityEngine.XR.ARSubsystems.XRCameraSubsystem, UnityEngine.XR.ARSubsystems.XRCameraSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRCameraSubsystem.Provider>.OnStart()
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider<UnityEngine.XR.ARSubsystems.XRCameraSubsystem, UnityEngine.XR.ARSubsystems.XRCameraSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRCameraSubsystem.Provider>.OnStop()
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider<UnityEngine.XR.ARSubsystems.XRCameraSubsystem, UnityEngine.XR.ARSubsystems.XRCameraSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRCameraSubsystem.Provider>.OnDestroy()
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider<UnityEngine.XR.ARSubsystems.XRCameraSubsystem, UnityEngine.XR.ARSubsystems.XRCameraSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRCameraSubsystem.Provider>.subsystemDescriptor
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider<UnityEngine.XR.ARSubsystems.XRCameraSubsystem, UnityEngine.XR.ARSubsystems.XRCameraSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRCameraSubsystem.Provider>.provider
    SubsystemWithProvider.Start()
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider.OnStart()
    SubsystemWithProvider.Stop()
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider.OnStop()
    SubsystemWithProvider.Destroy()
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider.OnDestroy()
    SubsystemWithProvider.running
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.XR.ARSubsystems
    Syntax
    public class XRCameraSubsystem : SubsystemWithProvider<XRCameraSubsystem, XRCameraSubsystemDescriptor, XRCameraSubsystem.Provider>, ISubsystem
    Remarks

    The XRCameraSubsystem links a Unity Camera to a device camera for video overlay (pass-thru rendering). It also allows developers to query for environmental light estimation, when available.

    Constructors

    XRCameraSubsystem()

    Construct the XRCameraSubsystem.

    Declaration
    public XRCameraSubsystem()

    Properties

    autoFocusEnabled

    Get the current focus mode in use by the provider.

    Declaration
    public bool autoFocusEnabled { get; }
    Property Value
    Type Description
    Boolean

    autoFocusRequested

    Get or set the focus mode for the camera.

    Declaration
    public bool autoFocusRequested { get; set; }
    Property Value
    Type Description
    Boolean

    The focus mode for the camera.

    cameraMaterial

    Get the material used by XRCameraSubsystem to render the camera texture.

    Declaration
    public Material cameraMaterial { get; }
    Property Value
    Type Description
    Material

    The material to render the camera texture.

    currentCamera

    Gets the camera currently in use.

    Declaration
    public Feature currentCamera { get; }
    Property Value
    Type Description
    Feature

    currentCameraBackgroundRenderingMode

    Get the current XRCameraBackgroundRenderingMode.

    Declaration
    public XRCameraBackgroundRenderingMode currentCameraBackgroundRenderingMode { get; }
    Property Value
    Type Description
    XRCameraBackgroundRenderingMode

    currentConfiguration

    The current camera configuration.

    Declaration
    public virtual XRCameraConfiguration? currentConfiguration { get; set; }
    Property Value
    Type Description
    Nullable<XRCameraConfiguration>

    The current camera configuration, if it exists. Otherise, null.

    Exceptions
    Type Condition
    NotSupportedException

    Thrown when setting the current configuration if the implementation does not support camera configurations.

    ArgumentNullException

    Thrown when setting the current configuration if the given configuration is null.

    ArgumentException

    Thrown when setting the current configuration if the given configuration is not a supported camera configuration.

    InvalidOperationException

    Thrown when setting the current configuration if the implementation is unable to set the current camera configuration.

    currentLightEstimation

    Returns the current light estimation mode in use by the provider.

    Declaration
    public Feature currentLightEstimation { get; }
    Property Value
    Type Description
    Feature
    See Also
    requestedLightEstimation

    invertCulling

    Set this to true to invert the culling mode during rendering. Some front-facing camera modes might require this.

    Declaration
    public bool invertCulling { get; }
    Property Value
    Type Description
    Boolean

    permissionGranted

    Determines whether camera permission has been granted.

    Declaration
    public bool permissionGranted { get; }
    Property Value
    Type Description
    Boolean

    true if camera permission has been granted. Otherwise, false.

    requestedCamera

    Get or set the requested camera (that is, the AnyCamera bits).

    Declaration
    public Feature requestedCamera { get; set; }
    Property Value
    Type Description
    Feature

    requestedCameraBackgroundRenderingMode

    Get or set the requested XRSupportedCameraBackgroundRenderingMode.

    Declaration
    public XRSupportedCameraBackgroundRenderingMode requestedCameraBackgroundRenderingMode { get; set; }
    Property Value
    Type Description
    XRSupportedCameraBackgroundRenderingMode

    requestedLightEstimation

    Get or set the requested light estimation mode.

    Declaration
    public Feature requestedLightEstimation { get; set; }
    Property Value
    Type Description
    Feature

    The light estimation mode.

    supportedCameraBackgroundRenderingMode

    Get the supported XRSupportedCameraBackgroundRenderingModes. Indicates which XRCameraBackgroundRenderingMode are supported.

    Declaration
    public XRSupportedCameraBackgroundRenderingMode supportedCameraBackgroundRenderingMode { get; }
    Property Value
    Type Description
    XRSupportedCameraBackgroundRenderingMode

    Methods

    GetConfigurations(Allocator)

    Queries for the supported camera configurations.

    Declaration
    public NativeArray<XRCameraConfiguration> GetConfigurations(Allocator allocator)
    Parameters
    Type Name Description
    Allocator allocator

    The allocation strategy to use for the returned data.

    Returns
    Type Description
    NativeArray<XRCameraConfiguration>

    The supported camera configurations.

    GetMaterialKeywords(out List<String>, out List<String>)

    Get the enabled and disabled shader keywords for the material.

    Declaration
    public void GetMaterialKeywords(out List<string> enabledKeywords, out List<string> disabledKeywords)
    Parameters
    Type Name Description
    List<String> enabledKeywords

    The keywords to enable for the material.

    List<String> disabledKeywords

    The keywords to disable for the material.

    GetTextureDescriptors(Allocator)

    Gets the XRTextureDescriptors associated with the current frame. The caller owns the returned NativeArray and is responsible for calling Dispose on it.

    Declaration
    public NativeArray<XRTextureDescriptor> GetTextureDescriptors(Allocator allocator)
    Parameters
    Type Name Description
    Allocator allocator

    The allocator to use when creating the returned NativeArray.

    Returns
    Type Description
    NativeArray<XRTextureDescriptor>

    An array of texture descriptors.

    OnBeforeBackgroundRender(Int32)

    Method to be called on the render thread to handle any required platform-specifc functionality immediately before rendering the camera background. This method will always be called on the render thread and should only be called by the code responsible for executing background rendering on mobile AR platforms.

    Declaration
    public void OnBeforeBackgroundRender(int id)
    Parameters
    Type Name Description
    Int32 id

    Platform-specific identifier.

    Register(XRCameraSubsystemCinfo)

    Registers a camera subsystem implementation based on the given subsystem parameters.

    Declaration
    public static bool Register(XRCameraSubsystemCinfo cameraSubsystemParams)
    Parameters
    Type Name Description
    XRCameraSubsystemCinfo cameraSubsystemParams

    The parameters defining the camera subsystem functionality implemented by the subsystem provider.

    Returns
    Type Description
    Boolean

    true if the subsystem implementation is registered. Otherwise, false.

    Exceptions
    Type Condition
    ArgumentException

    Thrown when the values specified in the XRCameraSubsystemCinfo parameter are invalid. Typically, this will occur

    • if id is null or empty
    • if implementationType is null
    • if implementationType does not derive from the XRCameraSubsystem class

    TryAcquireLatestCpuImage(out XRCpuImage)

    Attempts to acquire the latest camera image. This provides direct access to the raw pixel data, as well as to utilities to convert to RGB and Grayscale formats.

    Declaration
    public bool TryAcquireLatestCpuImage(out XRCpuImage cpuImage)
    Parameters
    Type Name Description
    XRCpuImage cpuImage

    A valid XRCpuImage if this method returns true.

    Returns
    Type Description
    Boolean

    Returns true if the image was acquired. Returns false otherwise.

    Remarks

    The returned XRCpuImage must be disposed to avoid resource leaks.

    Exceptions
    Type Condition
    NotSupportedException

    Thrown if the implementation does not support camera image.

    TryGetIntrinsics(out XRCameraIntrinsics)

    Returns the camera intrinsics information.

    Declaration
    public bool TryGetIntrinsics(out XRCameraIntrinsics cameraIntrinsics)
    Parameters
    Type Name Description
    XRCameraIntrinsics cameraIntrinsics

    The camera intrinsics information returned from the method.

    Returns
    Type Description
    Boolean

    true if the method successfully gets the camera intrinsics information. Otherwise, false.

    Remarks
    Note

    The intrinsics may change each frame. You should call this each frame that you need intrinsics in order to ensure you are using the intrinsics for the current frame.

    TryGetLatestFrame(XRCameraParams, out XRCameraFrame)

    Get the latest frame from the provider.

    Declaration
    public bool TryGetLatestFrame(XRCameraParams cameraParams, out XRCameraFrame frame)
    Parameters
    Type Name Description
    XRCameraParams cameraParams

    The Unity Camera parameters.

    XRCameraFrame frame

    The camera frame to be populated if the subsystem is running and successfully provides the latest camera frame.

    Returns
    Type Description
    Boolean

    true if the camera frame is successfully returned. Otherwise, false.

    TryGetLatestImage(out XRCpuImage)

    Attempts to acquire the latest camera image. This provides direct access to the raw pixel data, as well as to utilities to convert to RGB and Grayscale formats. This method is obsolete. Use TryAcquireLatestCpuImage(out XRCpuImage) instead.

    Declaration
    [Obsolete("Use TryAcquireLatestCpuImage instead. (2020-05-19)")]
    public bool TryGetLatestImage(out XRCpuImage cpuImage)
    Parameters
    Type Name Description
    XRCpuImage cpuImage

    A valid XRCpuImage if this method returns true.

    Returns
    Type Description
    Boolean

    Returns true if the image was acquired. Returns false otherwise.

    Remarks

    The returned XRCpuImage must be disposed to avoid resource leaks.

    Exceptions
    Type Condition
    NotSupportedException

    Thrown if the implementation does not support camera image.

    トップに戻る
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)