tree sway and shadow improvements
[WindSway-HDRP.git] / Library / PackageCache / com.unity.postprocessing@2.1.2 / PostProcessing / Runtime / PostProcessBundle.cs
blob93ad73732298a2b7b5867baaf1d130779d164bb7
1 using System;
2 using UnityEngine.Assertions;
4 namespace UnityEngine.Rendering.PostProcessing
6 public sealed class PostProcessBundle
8 public PostProcessAttribute attribute { get; private set; }
9 public PostProcessEffectSettings settings { get; private set; }
11 internal PostProcessEffectRenderer renderer
13 get
15 if (m_Renderer == null)
17 Assert.IsNotNull(attribute.renderer);
18 var rendererType = attribute.renderer;
19 m_Renderer = (PostProcessEffectRenderer)Activator.CreateInstance(rendererType);
20 m_Renderer.SetSettings(settings);
21 m_Renderer.Init();
24 return m_Renderer;
28 PostProcessEffectRenderer m_Renderer;
30 internal PostProcessBundle(PostProcessEffectSettings settings)
32 // If settings is null, it means that at some point a null element has been added to
33 // the volume effect list or there was a deserialization error and a reference to
34 // the settings scriptableobject was lost
35 Assert.IsNotNull(settings);
36 this.settings = settings;
37 attribute = settings.GetType().GetAttribute<PostProcessAttribute>();
40 internal void Release()
42 if (m_Renderer != null)
43 m_Renderer.Release();
45 RuntimeUtilities.Destroy(settings);
48 internal void ResetHistory()
50 if (m_Renderer != null)
51 m_Renderer.ResetHistory();
54 internal T CastSettings<T>()
55 where T : PostProcessEffectSettings
57 return (T)settings;
60 internal T CastRenderer<T>()
61 where T : PostProcessEffectRenderer
63 return (T)renderer;