using System.Diagnostics;
using System.Numerics;
using System.Runtime.InteropServices;
using ComputeSharp.Exceptions;
namespace ComputeSharp
{
///
/// A that maps the HLSL type.
///
[DebuggerDisplay("({X}, {Y}, {Z}, {W})")]
[StructLayout(LayoutKind.Sequential, Size = sizeof(float) * 4)]
public partial struct Float4
{
///
/// Gets an value with all components set to 0.
///
public static Float4 Zero => 0;
///
/// Gets an value with all components set to 1.
///
public static Float4 One => 1;
///
/// Gets an value with the component set to 1, and the others to 0.
///
public static Float4 UnitX => new(1, 0, 0, 0);
///
/// Gets an value with the component set to 1, and the others to 0.
///
public static Float4 UnitY => new(0, 1, 0, 0);
///
/// Gets an value with the component set to 1, and the others to 0.
///
public static Float4 UnitZ => new(0, 0, 1, 0);
///
/// Gets an value with the component set to 1, and the others to 0.
///
public static Float4 UnitW => new(0, 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.
/// The value to assign to the fourth vector component.
public Float4(float x, float y, float z, float w)
{
X = x;
Y = y;
Z = z;
W = w;
}
///
/// Gets or sets the value of the first vector component.
///
public float X { get; set; }
///
/// Gets or sets the value of the second vector component.
///
public float Y { get; set; }
///
/// Gets or sets the value of the third vector component.
///
public float Z { get; set; }
///
/// Gets or sets the value of the fourth vector component.
///
public float W { get; set; }
///
/// Gets or sets the value of the first color component.
///
public float R
{
get => throw new InvalidExecutionContextException($"{nameof(Float4)}.{nameof(R)}");
set => throw new InvalidExecutionContextException($"{nameof(Float4)}.{nameof(R)}");
}
///
/// Gets or sets the value of the second color component.
///
public float G
{
get => throw new InvalidExecutionContextException($"{nameof(Float4)}.{nameof(G)}");
set => throw new InvalidExecutionContextException($"{nameof(Float4)}.{nameof(G)}");
}
///
/// Gets or sets the value of the third color component.
///
public float B
{
get => throw new InvalidExecutionContextException($"{nameof(Float4)}.{nameof(B)}");
set => throw new InvalidExecutionContextException($"{nameof(Float4)}.{nameof(B)}");
}
///
/// Gets or sets the value of the fourth color component.
///
public float A
{
get => throw new InvalidExecutionContextException($"{nameof(Float4)}.{nameof(A)}");
set => throw new InvalidExecutionContextException($"{nameof(Float4)}.{nameof(A)}");
}
///
/// Gets or sets a specific component in the current instance.
///
/// The index of the component to access.
public float this[int i]
{
get => throw new InvalidExecutionContextException($"{nameof(Float4)}[int]");
set => throw new InvalidExecutionContextException($"{nameof(Float4)}[int]");
}
///
/// 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 Float4(float x) => new(x, x, x, x);
///
/// Casts a value to a one.
///
/// The input value to cast.
public static unsafe implicit operator Vector4(Float4 xyzw) => *(Vector4*)&xyzw;
///
/// Casts a value to a one.
///
/// The input value to cast.
public static unsafe implicit operator Float4(Vector4 xyzw) => *(Float4*)&xyzw;
///
/// Casts a value to a one.
///
/// The input value to cast.
public static implicit operator Double4(Float4 xyzw) => throw new InvalidExecutionContextException($"{nameof(Float4)}.({nameof(Double4)})");
///
/// Casts a value to a one.
///
/// The input value to cast.
public static explicit operator Int4(Float4 xyzw) => throw new InvalidExecutionContextException($"{nameof(Float4)}.({nameof(Int4)})");
///
/// Casts a value to a one.
///
/// The input value to cast.
public static explicit operator UInt4(Float4 xyzw) => throw new InvalidExecutionContextException($"{nameof(Float4)}.({nameof(UInt4)})");
}
}