docs.unity3d.com
    Show / Hide Table of Contents

    Class SceneSampler

    This class provide a common interface and functionality for all type of samplers.

    Inheritance
    Object
    SceneSampler
    CustomRendererSampler
    DefaultSampler
    PathtraceSampler
    Namespace: Mechatronics.SensorSDK
    Syntax
    public abstract class SceneSampler

    Constructors

    SceneSampler(IPhotosensorArrayDescription, SceneSamplerDesc)

    At construction, the sampler registers event handlers to update exposure time and gain.

    Declaration
    public SceneSampler(IPhotosensorArrayDescription sensorDesc, SceneSamplerDesc samplerDesc)
    Parameters
    Type Name Description
    IPhotosensorArrayDescription sensorDesc

    Photosensor array description used to register event handlers

    SceneSamplerDesc samplerDesc

    Extra parameters for the sampler.

    Fields

    _camera

    Unity camera used to emulate the photosensor array.

    Declaration
    protected Camera _camera
    Field Value
    Type Description
    Camera

    _customPassesDesc

    Keep a list of custom pass added to the camera volume. Used to hook a unity camera just before the post processing step. We take the buffer and do the post processing step ourself in the graph.

    Declaration
    protected List<CustomPassDescriptor> _customPassesDesc
    Field Value
    Type Description
    List<CustomPassDescriptor>

    _isSamplingRequested

    Indicate that the photosensor array received a sampling request from the controller.

    Declaration
    protected bool _isSamplingRequested
    Field Value
    Type Description
    Boolean

    _outputTexture

    The sampled output texture.

    Declaration
    protected RenderTexture _outputTexture
    Field Value
    Type Description
    RenderTexture

    _samplerDesc

    Describe sampler specific information.

    Declaration
    protected readonly SceneSamplerDesc _samplerDesc
    Field Value
    Type Description
    SceneSamplerDesc

    _samplingRequestCallback

    Store the function to call back when the sampling request is completed.

    Declaration
    protected Action<CustomPassContext, RenderTexture> _samplingRequestCallback
    Field Value
    Type Description
    Action<CustomPassContext, RenderTexture>

    _sensorDesc

    Describe an array of photosensors on a plane.

    Declaration
    protected IPhotosensorArrayDescription _sensorDesc
    Field Value
    Type Description
    IPhotosensorArrayDescription

    Methods

    AsyncSampleScene(Action<CustomPassContext, RenderTexture>)

    Used to capture the projected image on the sensor.

    Declaration
    public void AsyncSampleScene(Action<CustomPassContext, RenderTexture> callback)
    Parameters
    Type Name Description
    Action<CustomPassContext, RenderTexture> callback

    A function to call when the capture is ready.

    CreateCustomPass(CustomPassInjectionPoint, CustomPassCallback.ExecuteCustomPassAction<CustomPassContext>)

    Create hook on the camera to retrieve the output.

    Declaration
    protected void CreateCustomPass(CustomPassInjectionPoint injectionPoint, CustomPassCallback.ExecuteCustomPassAction<CustomPassContext> callback)
    Parameters
    Type Name Description
    CustomPassInjectionPoint injectionPoint

    Define the moment where we want the output

    CustomPassCallback.ExecuteCustomPassAction<CustomPassContext> callback

    Function to call to provide the camera output.

    InternalRelease()

    Use by child class to release extra resources.

    Declaration
    protected virtual void InternalRelease()

    OnCameraSamplingCompleted(CustomPassContext)

    Call the request callback with the camera results.

    Declaration
    protected void OnCameraSamplingCompleted(CustomPassContext ctx)
    Parameters
    Type Name Description
    CustomPassContext ctx

    Camera results

    OnExposureTimeChanged(Single, Single)

    Sets the amount of time the photosensor is capturing light, in seconds.

    Declaration
    protected virtual void OnExposureTimeChanged(float oldExposureTime, float newExposureTime)
    Parameters
    Type Name Description
    Single oldExposureTime

    Value of exposure time before the change

    Single newExposureTime

    Time in seconds

    OnGainChanged(Single, Single)

    Set amplification factor applied to the captured light.

    Declaration
    protected virtual void OnGainChanged(float oldGain, float newGain)
    Parameters
    Type Name Description
    Single oldGain

    Value of gain before the change

    Single newGain

    Multiplicative factor greater than 0

    Release()

    Use to release any resources created for the sampling or delete any game object construction in the scene.

    Declaration
    public void Release()

    SubscribeEventHandlers()

    Subscribe handlers that react when the photosensor array description changes.

    Declaration
    protected virtual void SubscribeEventHandlers()

    UnsubscribeEventHandlers()

    Unsubscribe handlers that react when the photosensor array description changes.

    Declaration
    protected virtual void UnsubscribeEventHandlers()
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023