-
Notifications
You must be signed in to change notification settings - Fork 873
Expand file tree
/
Copy pathPropertySheet.cs
More file actions
58 lines (52 loc) · 1.87 KB
/
Copy pathPropertySheet.cs
File metadata and controls
58 lines (52 loc) · 1.87 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
namespace UnityEngine.Rendering.PostProcessing
{
/// <summary>
/// The post-processing stack is entirely built around the use of <see cref="CommandBuffer"/>
/// and as such requires the use of <see cref="MaterialPropertyBlock"/> to properly deal with
/// the deferred nature of <see cref="CommandBuffer"/>.
/// This wrapper abstracts the creation and destruction of <see cref="MaterialPropertyBlock"/>
/// and <see cref="Material"/> to make the process easier.
/// </summary>
/// <seealso cref="PropertySheetFactory"/>
public sealed class PropertySheet
{
/// <summary>
/// The actual <see cref="MaterialPropertyBlock"/> to fill.
/// </summary>
public MaterialPropertyBlock properties { get; private set; }
internal Material material { get; private set; }
internal PropertySheet(Material material)
{
this.material = material;
properties = new MaterialPropertyBlock();
}
/// <summary>
/// Clears all keywords set on the source material.
/// </summary>
public void ClearKeywords()
{
material.shaderKeywords = null;
}
/// <summary>
/// Enableds a given keyword on the source material.
/// </summary>
/// <param name="keyword">The keyword to enable</param>
public void EnableKeyword(string keyword)
{
material.EnableKeyword(keyword);
}
/// <summary>
/// Disables a given keyword on the source material.
/// </summary>
/// <param name="keyword">The keyword to disable</param>
public void DisableKeyword(string keyword)
{
material.DisableKeyword(keyword);
}
internal void Release()
{
RuntimeUtilities.Destroy(material);
material = null;
}
}
}