Class CameraHistoryItem
A convenience base class for camera history items/types. It is recommended to derive from this class to make new history item type.
The owning camera BufferedRTHandleSystem reference is used for central storage. The central storage allows the camera to track all of the history types in a single place. And gives the deriving type a direct access to texture allocation services. Type id is used to deconflict RTHandle ids from different types.
The user is responsible for designing the derived type to work well with the producing and consuming render passes. For example: Add the necessary cpu-side tracking data and update logic. Add methods for accessing the history data and design a suitable API for the type. Handle allocation and deallocation of the history texture RTHandles etc.
Inherited Members
Namespace: UnityEngine .Rendering
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
public abstract class CameraHistoryItem : ContextItem
Properties
storage
The owning camera RTHandle storage for the history textures.
Declaration
protected BufferedRTHandleSystem storage { get; }
Property Value
Type | Description |
---|---|
Buffered |
Methods
AllocHistoryFrameRT(int, int, ref RenderTextureDescriptor, string)
Allocate a history frame RTHandle[] using a descriptor.
Declaration
protected RTHandle AllocHistoryFrameRT(int id, int count, ref RenderTextureDescriptor desc, string name = "")
Parameters
Type | Name | Description |
---|---|---|
int | id | Id for the history RTHandle storage. |
int | count | Number of RTHandles allocated for the id. |
Render |
desc | Texture descriptor used for each RTHandle in the allocation. |
string | name | User visible debug name of the texture. |
Returns
Type | Description |
---|---|
RTHandle | Current frame RTHandle in the allocation. |
GetCurrentFrameRT(int)
Returns the id RTHandle of the current frame.
Declaration
protected RTHandle GetCurrentFrameRT(int id)
Parameters
Type | Name | Description |
---|---|---|
int | id | Id for the history RTHandle storage. |
Returns
Type | Description |
---|---|
RTHandle | The RTHandle of the current frame. |
GetPreviousFrameRT(int)
Returns the id RTHandle from the previous frame.
Declaration
protected RTHandle GetPreviousFrameRT(int id)
Parameters
Type | Name | Description |
---|---|---|
int | id | Id for the history RTHandle storage. |
Returns
Type | Description |
---|---|
RTHandle | The RTHandle from previous frame. |
MakeId(uint)
Creates unique ids for the RTHandle storage. Index == 0, returns the TypeId of this CameraHistoryItem. Index == N, generates new ids in case the user wants to store multiple history textures in the same CameraHistoryItem.
Declaration
protected int MakeId(uint index)
Parameters
Type | Name | Description |
---|---|---|
uint | index | Index of the type RTHandle, a type local Enum or a user id. |
Returns
Type | Description |
---|---|
int | A unique id for each type, index and camera. |
OnCreate(BufferedRTHandleSystem, uint)
Called internally when a CameraHistoryItem type is created to initialize the RTHandle storage and type id.
User types can override to do additional initialization, such as creating the ids for multiple history RTHandles. Deriving type should call the base.OnCreate() to correctly initialize the CameraHistoryItem first.
Declaration
public virtual void OnCreate(BufferedRTHandleSystem owner, uint typeId)
Parameters
Type | Name | Description |
---|---|---|
Buffered |
owner | BufferedRTHandleSystem of the owning camera. |
uint | typeId | Unique id given to this class type by the owning camera. |
ReleaseHistoryFrameRT(int)
Release the RTHandles allocated for the id.
Declaration
protected void ReleaseHistoryFrameRT(int id)
Parameters
Type | Name | Description |
---|---|---|
int | id | Id for the history RTHandle storage. |