CameraImageRenderer Class

Description

在场景中控制camera图像渲染的 MonoBehaviour


MonoBehaviour Messages

protected virtual void Awake()

protected virtual void OnEnable()

protected virtual void OnDisable()

protected virtual void OnDestroy()


Events

OnFrameRenderUpdate

C#

public event Action< Material , Vector2 > OnFrameRenderUpdate

camera图像渲染更新的事件。这个事件会传出当前用于camera图像渲染的材质和贴图大小。当这个事件发生时,camera图像本身不一定有改变,它只表示一次渲染的发生。


Methods

RequestTargetTexture

C#

public void RequestTargetTexture(Action< Camera , RenderTexture > targetTextureEventHandler)

获取camera图像的 RenderTexture

通过这个接口获取的texture是从 OutputFrame 获取的完整大小的图像,未经屏幕裁剪。 targetTextureEventHandler action会传出 RenderTexture 以及用于绘制texture的 Camera 。这个action不会每帧调用,也不会在camera图像数据发生变化的时候调用,它只会发生在texture本身创建或改变的时候。调用这个方法会创建额外的资源且会在必要时触发渲染,因此在不使用的时候需要调用 CameraImageRenderer.DropTargetTexture 释放资源。

DropTargetTexture

C#

public void DropTargetTexture(Action< Camera , RenderTexture > targetTextureEventHandler)

释放绘制camera图像的 RenderTexture 。内部资源将在所有持有者都释放后释放。