using System.Diagnostics; using ComputeSharp.Exceptions; namespace ComputeSharp { /// /// A that maps the HLSL type. /// [DebuggerDisplay("({X}, {Y}, {Z})")] public partial struct Int3 { /// /// Gets an value with all components set to 0. /// public static Int3 Zero => 0; /// /// Gets an value with all components set to 1. /// public static Int3 One => 1; /// /// Gets an value with the component set to 1, and the others to 0. /// public static Int3 UnitX => new(1, 0, 0); /// /// Gets an value with the component set to 1, and the others to 0. /// public static Int3 UnitY => new(0, 1, 0); /// /// Gets an value with the component set to 1, and the others to 0. /// public static Int3 UnitZ => new(0, 0, 1); /// /// Creates a new instance with the specified parameters. /// /// The value to assign to the first vector component. /// The value to assign to the second vector component. /// The value to assign to the third vector component. public Int3(int x, int y, int z) { this.x = x; this.y = y; this.z = z; } /// /// Creates a new value with the same value for all its components. /// /// The value to use for the components of the new instance. public static implicit operator Int3(int x) => new(x, x, x); /// /// Casts a value to a one. /// /// The input value to cast. public static explicit operator UInt3(Int3 xyz) => throw new InvalidExecutionContextException($"{nameof(Int3)}.({nameof(UInt3)})"); /// /// Casts a value to a one. /// /// The input value to cast. public static implicit operator Float3(Int3 xyz) => throw new InvalidExecutionContextException($"{nameof(Int3)}.({nameof(Float3)})"); /// /// Casts a value to a one. /// /// The input value to cast. public static implicit operator Double3(Int3 xyz) => throw new InvalidExecutionContextException($"{nameof(Int3)}.({nameof(Double3)})"); } }