#nullable enable using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Utilities.Daybreak; /// /// Wraps the parameters of a initialization, /// permitting values which may be replaced with /// defaults when being converted to a snapshot. /// internal struct SpriteBatchParameters { /// /// The sort mode. /// public SpriteSortMode? SortMode { get; set; } /// /// The blend state. /// public BlendState? BlendState { get; set; } /// /// The sampler state. /// public SamplerState? SamplerState { get; set; } /// /// The depth stencil state. /// public DepthStencilState? DepthStencilState { get; set; } /// /// The rasterizer state. /// public RasterizerState? RasterizerState { get; set; } /// /// The custom effect, if applicable. /// public Effect? CustomEffect { get; set; } /// /// The transformation matrix. /// public Matrix? TransformMatrix { get; set; } /// /// Initializes a new set of parameters. /// public SpriteBatchParameters( SpriteSortMode? sortMode = null, BlendState? blendState = null, SamplerState? samplerState = null, DepthStencilState? depthStencilState = null, RasterizerState? rasterizerState = null, Effect? customEffect = null, Matrix? transformMatrix = null ) { SortMode = sortMode; BlendState = blendState; SamplerState = samplerState; DepthStencilState = depthStencilState; RasterizerState = rasterizerState; CustomEffect = customEffect; TransformMatrix = transformMatrix; } /// /// Creates a new , with /// values being replaced with the values /// provided by . /// /// /// Default values to populate s with. /// /// The new snapshot. public readonly SpriteBatchSnapshot ToSnapshot(SpriteBatchSnapshot defaultValues) { return new SpriteBatchSnapshot( SortMode ?? defaultValues.SortMode, BlendState ?? defaultValues.BlendState, SamplerState ?? defaultValues.SamplerState, DepthStencilState ?? defaultValues.DepthStencilState, RasterizerState ?? defaultValues.RasterizerState, CustomEffect ?? defaultValues.CustomEffect, TransformMatrix ?? defaultValues.TransformMatrix ); } }