using System.Numerics; namespace Content.Client.Parallax.Data; /// /// The configuration for a parallax layer. /// [DataDefinition] public sealed class ParallaxLayerConfig { /// /// The texture source for this layer. /// [DataField("texture", required: true)] public IParallaxTextureSource Texture { get; set; } = default!; /// /// A scaling factor for the texture. /// In the interest of simplifying maths, this is rounded down to integer for ParallaxControl, so be careful. /// [DataField("scale")] public Vector2 Scale { get; set; } = Vector2.One; /// /// If true, this layer is tiled as the camera scrolls around. /// If false, this layer only shows up around it's home position. /// [DataField("tiled")] public bool Tiled { get; set; } = true; /// /// A position relative to the centre of a ParallaxControl that this parallax should be drawn at, in pixels. /// Used for menus. /// Note that this is ignored if the parallax layer is tiled - in that event a random pixel offset is used and slowness is applied. /// [DataField("controlHomePosition")] public Vector2 ControlHomePosition { get; set; } /// /// The "relative to ParallaxAnchor" starting world position for this layer. /// Essentially, an unclamped lerp occurs between here and the eye position, with Slowness as the factor. /// Used for in-game. /// [DataField("worldHomePosition")] public Vector2 WorldHomePosition { get; set; } /// /// An adjustment performed to the world position of this layer after parallax shifting. /// Used for in-game. /// Useful for moving around Slowness = 1.0 objects (which can't otherwise be moved from screen centre). /// [DataField("worldAdjustPosition")] public Vector2 WorldAdjustPosition { get; set; } /// /// Multiplier of parallax shift. /// A slowness of 0.0f anchors this layer to the world. /// A slowness of 1.0f anchors this layer to the camera. /// [DataField("slowness")] public float Slowness { get; set; } = 0.5f; /// /// Should the parallax scroll at a specific rate per second. /// [DataField("scrolling")] public Vector2 Scrolling = Vector2.Zero; [DataField("shader")] public string? Shader = "unshaded"; }