using System; using System.Collections.Generic; using System.Numerics; using Robust.Shared.Maths; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; namespace Robust.Shared.GameObjects; [Serializable, NetSerializable, DataDefinition] public sealed partial class PrototypeLayerData { /// /// The shader prototype to use for this layer. /// /// /// Null implies no shader is specified. An empty string will clear the current shader. /// [DataField("shader")] public string? Shader; [DataField("texture")] public string? TexturePath; [DataField("sprite")] public string? RsiPath; [DataField("state")] public string? State; [DataField("scale")] public Vector2? Scale; [DataField("rotation")] public Angle? Rotation; [DataField("offset")] public Vector2? Offset; [DataField("visible")] public bool? Visible; [DataField("color")] public Color? Color; [DataField("map")] public HashSet? MapKeys; [DataField("renderingStrategy")] public LayerRenderingStrategy? RenderingStrategy; /// /// If set, indicates that this sprite layer should instead be used to copy into shader parameters on another layer. /// /// /// /// If set, this sprite layer is not rendered. Instead, the "result" of rendering it (exact sprite layer and such) /// are copied into the shader parameters of another object, /// specified by the . /// /// /// The specified layer must have a shader set. When it does, the shader's /// /// /// Note that sprite layers are processed in-order, so to avoid 1-frame delays, /// the layer doing the copying should occur BEFORE the layer being copied into. /// /// [DataField] public PrototypeCopyToShaderParameters? CopyToShaderParameters; [DataField] public bool Cycle; [DataField] public bool Loop = true; } /// /// Stores parameters for . /// [Serializable, NetSerializable, DataDefinition] public sealed partial class PrototypeCopyToShaderParameters { /// /// The map key of the layer that will have its shader modified. /// [DataField(required: true)] public string LayerKey; /// /// The name of the shader parameter that will receive the actual selected texture. /// [DataField] public string? ParameterTexture; /// /// The name of the shader parameter that will receive UVs to select the sprite in . /// [DataField] public string? ParameterUV; } [Serializable, NetSerializable] public enum LayerRenderingStrategy { Default, SnapToCardinals, NoRotation, UseSpriteStrategy // TODO SPRITE // Refactor this make the sprites strategy the actual default. // That way layers have to opt in to having a custom strategy, instead of opt out. // Also rename default to make it clear that its not actually the default, instead I guess its "WithRotation"? }