Class LensComponent
Provides a common interface for all lenses that can be bound to a photosensor array. This is used to delegate and allow the definition of new lens models for the photosensor array.
Inherited Members
Namespace: Mechatronics.SensorSDK
Syntax
public abstract class LensComponent : MonoBehaviour
Fields
_requestProjectedImageOnSensorCallback
Callback function to invoke when the sampling is done and to notify the photosensor array.
Declaration
protected Action<ProjectedImageOnSensorRequest> _requestProjectedImageOnSensorCallback
Field Value
Type | Description |
---|---|
Action<ProjectedImageOnSensorRequest> |
_sceneSampler
Common reference to the scene sampler used to collect information from the simulation.
Declaration
protected SceneSampler _sceneSampler
Field Value
Type | Description |
---|---|
SceneSampler |
Methods
Activate(IPhotosensorArrayDescription)
Initializes the lens component.
Declaration
public abstract void Activate(IPhotosensorArrayDescription sensorDesc)
Parameters
Type | Name | Description |
---|---|---|
IPhotosensorArrayDescription | sensorDesc | Information define on the photosensor array node. |
AsyncRequestProjectedImageOnSensor(Action<ProjectedImageOnSensorRequest>)
Triggers a scene sampling and specifies a callback function when completed.
Declaration
public void AsyncRequestProjectedImageOnSensor(Action<ProjectedImageOnSensorRequest> callback)
Parameters
Type | Name | Description |
---|---|---|
Action<ProjectedImageOnSensorRequest> | callback |
Deactivate()
Releases the scene sampler and other GPU resources.
Declaration
public void Deactivate()
InternalDeactivate()
Releases resources in the child implementation when the lens component is deactivated.
Declaration
protected virtual void InternalDeactivate()
InternalPostSampling(CustomPassContext, in RenderTexture)
Runs after the sampling step, before returning the frame to the sensor. Can be used to do anything with the texture after the sampling is complete. For example: post processing.
Declaration
protected virtual RenderTexture InternalPostSampling(CustomPassContext ctx, in RenderTexture renderTexture)
Parameters
Type | Name | Description |
---|---|---|
CustomPassContext | ctx | CustomPassContext used to capture the sample. |
RenderTexture | renderTexture | RenderTexture containing the sample. |
Returns
Type | Description |
---|---|
RenderTexture | A render texture with the post processing applied. If the return is null then the frame is assumed to be discarded. |
OnSceneSamplingCompleted(CustomPassContext, RenderTexture)
Called when the sceneSampler has completed the sampling.
Declaration
protected void OnSceneSamplingCompleted(CustomPassContext ctx, RenderTexture texture)
Parameters
Type | Name | Description |
---|---|---|
CustomPassContext | ctx | The graphic context used for the sampling. The command buffer within the parameter can be used to append graphic commands after a scene sample. |
RenderTexture | texture | Resource in which the sampling will be stored. |