12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using UnityEngine.Scripting.APIUpdating;
- namespace UnityEngine.Rendering.Universal
- {
- /// <summary>
- /// You can add a <c>ScriptableRendererFeature</c> to the <c>ScriptableRenderer</c>. Use this scriptable renderer feature to inject render passes into the renderer.
- /// </summary>
- /// <seealso cref="ScriptableRenderer"/>
- /// <seealso cref="ScriptableRenderPass"/>
- [ExcludeFromPreset]
- [MovedFrom("UnityEngine.Rendering.LWRP")] public abstract class ScriptableRendererFeature : ScriptableObject
- {
- [SerializeField, HideInInspector] private bool m_Active = true;
- /// <summary>
- /// Returns the state of the ScriptableRenderFeature (true: the feature is active, false: the feature is inactive). Use the method ScriptableRenderFeature.SetActive to change the value of this variable.
- /// </summary>
- public bool isActive => m_Active;
- /// <summary>
- /// Initializes this feature's resources. This is called every time serialization happens.
- /// </summary>
- public abstract void Create();
- /// <summary>
- /// Injects one or multiple <c>ScriptableRenderPass</c> in the renderer.
- /// </summary>
- /// <param name="renderPasses">List of render passes to add to.</param>
- /// <param name="renderingData">Rendering state. Use this to setup render passes.</param>
- public abstract void AddRenderPasses(ScriptableRenderer renderer,
- ref RenderingData renderingData);
- void OnEnable()
- {
- Create();
- }
- void OnValidate()
- {
- Create();
- }
- /// <summary>
- /// Sets the state of ScriptableRenderFeature (true: the feature is active, false: the feature is inactive).
- /// If the feature is active, it is added to the renderer it is attached to, otherwise the feature is skipped while rendering.
- /// </summary>
- /// <param name="active">The true value activates the ScriptableRenderFeature and the false value deactivates it.</param>
- public void SetActive(bool active)
- {
- m_Active = active;
- }
- }
- }
|