forked from space-wizards/RobustToolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpriteShaderData.cs
More file actions
63 lines (54 loc) · 1.85 KB
/
Copy pathSpriteShaderData.cs
File metadata and controls
63 lines (54 loc) · 1.85 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
59
60
61
62
63
using Robust.Client.Graphics;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Robust.Client.GameObjects;
[DataDefinition]
public sealed partial class SpriteShaderData(
ProtoId<ShaderPrototype> protoId,
bool raiseShaderEvent = false,
bool getScreenTexture = false,
bool mutable = true,
Color? color = null,
ShaderInstance? instance = null)
{
public SpriteShaderData() : this(default)
{
}
/// <summary>
/// Proto ID of the shader.
/// </summary>
[DataField]
public ProtoId<ShaderPrototype> ProtoId = protoId;
/// <summary>
/// If true, this raise a entity system event before rendering this sprite, allowing systems to modify the
/// shader parameters. Usually this can just be done via a frame-update, but some shaders require
/// information about the viewport / eye.
/// </summary>
[DataField]
public bool RaiseShaderEvent = raiseShaderEvent;
/// <summary>
/// Whether to pass the screen texture to the <see cref="Instance"/>.
/// </summary>
/// <remarks>
/// Should be false unless you really need it.
/// </remarks>
[DataField]
public bool GetScreenTexture = getScreenTexture;
/// <summary>
/// Is the shader mutable
/// </summary>
[DataField]
public bool Mutable = mutable;
/// <summary>
/// Color to apply when rendering shader
/// </summary>
[DataField]
public Color? Color = color;
public ShaderInstance? Instance = instance;
public SpriteShaderData Copy()
{
var shader = Instance is not { Disposed: true } ? Instance?.Mutable is true ? Instance.Duplicate() : Instance : null;
return new SpriteShaderData(ProtoId, RaiseShaderEvent, GetScreenTexture, Mutable, Color, shader);
}
}