-
Notifications
You must be signed in to change notification settings - Fork 0
/
PostProcessingManager.cs
36 lines (28 loc) · 1.19 KB
/
PostProcessingManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.Collections.Generic;
namespace SRXDPostProcessing;
/// <summary>
/// Utility class for adding and removing post processing effects
/// </summary>
public static class PostProcessingManager {
internal static List<PostProcessingInstance> PostProcessingInstances { get; } = new();
/// <summary>
/// Adds a new post processing effect
/// </summary>
/// <param name="instance">The instance to add</param>
public static void AddPostProcessingInstance(PostProcessingInstance instance) {
if (PostProcessingInstances.Contains(instance))
return;
for (int i = 0; i < PostProcessingInstances.Count; i++) {
if (instance.Priority > PostProcessingInstances[i].Priority)
continue;
PostProcessingInstances.Insert(i, instance);
return;
}
PostProcessingInstances.Add(instance);
}
/// <summary>
/// Removes a post processing effect
/// </summary>
/// <param name="instance">The instance to remove</param>
public static void RemovePostProcessingInstance(PostProcessingInstance instance) => PostProcessingInstances.Remove(instance);
}