using UnityEngine.Rendering; namespace UnityEngine.Rendering.HighDefinition { /// /// Volume component class to inherit when you implement a custom post process /// public abstract class CustomPostProcessVolumeComponent : VolumeComponent { bool m_IsInitialized = false; /// /// Injection point of the custom post process in HDRP. /// public virtual CustomPostProcessInjectionPoint injectionPoint => CustomPostProcessInjectionPoint.AfterPostProcess; /// /// True if you want your custom post process to be visible in the scene view.false False otherwise. /// public virtual bool visibleInSceneView => true; /// /// Setup function, called once before render is called. /// public virtual void Setup() {} /// /// Called every frame for each camera when the post process needs to be rendered. /// /// Command Buffer used to issue your commands /// Current Camera /// Source Render Target, it contains the camera color buffer in it's current state /// Destination Render Target public abstract void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle destination); /// /// Cleanup function, called when the render pipeline is disposed. /// public virtual void Cleanup() {} /// /// Unity calls this method when the object goes out of scope. /// protected override void OnDisable() { base.OnDisable(); CleanupInternal(); } internal void CleanupInternal() { if (m_IsInitialized) Cleanup(); m_IsInitialized = false; } internal void SetupIfNeeded() { if (!m_IsInitialized) { Setup(); m_IsInitialized = true; } } } }