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})")]
[StructLayout(LayoutKind.Sequential, Size = sizeof(float) * 3)]
public partial struct Float3
{
///
/// Gets an value with all components set to 0.
///
public static Float3 Zero => 0;
///
/// Gets an value with all components set to 1.
///
public static Float3 One => 1;
///
/// Gets an value with the component set to 1, and the others to 0.
///
public static Float3 UnitX => new(1, 0, 0);
///
/// Gets an value with the component set to 1, and the others to 0.
///
public static Float3 UnitY => new(0, 1, 0);
///
/// Gets an value with the component set to 1, and the others to 0.
///
public static Float3 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 Float3(float x, float y, float z)
{
X = x;
Y = y;
Z = z;
}
///
/// 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 first color component.
///
public float R
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(R)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(R)}");
}
///
/// Gets or sets the value of the second color component.
///
public float G
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(G)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(G)}");
}
///
/// Gets or sets the value of the third color component.
///
public float B
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(B)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(B)}");
}
///
/// 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(Float3)}[int]");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}[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 Float3(float x) => new(x, x, x);
///
/// Casts a value to a one.
///
/// The input value to cast.
public static unsafe implicit operator Vector3(Float3 xyz) => *(Vector3*)&xyz;
///
/// Casts a value to a one.
///
/// The input value to cast.
public static unsafe implicit operator Float3(Vector3 xyz) => *(Float3*)&xyz;
///
/// Casts a value to a one.
///
/// The input value to cast.
public static implicit operator Double3(Float3 xyz) => throw new InvalidExecutionContextException($"{nameof(Float3)}.({nameof(Double3)})");
///
/// Casts a value to a one.
///
/// The input value to cast.
public static explicit operator Int3(Float3 xyz) => throw new InvalidExecutionContextException($"{nameof(Float3)}.({nameof(Int3)})");
///
/// Casts a value to a one.
///
/// The input value to cast.
public static explicit operator UInt3(Float3 xyz) => throw new InvalidExecutionContextException($"{nameof(Float3)}.({nameof(UInt3)})");
///
/// Negates a value.
///
/// The value to negate.
public static Float3 operator -(Float3 xyz) => throw new InvalidExecutionContextException($"{nameof(Float3)}.-");
///
/// Sums two values.
///
/// The first value to sum.
/// The second value to sum.
public static Float3 operator +(Float3 left, Float3 right) => throw new InvalidExecutionContextException($"{nameof(Float3)}.+");
///
/// Divides two values.
///
/// The first value to divide.
/// The second value to divide.
public static Float3 operator /(Float3 left, Float3 right) => throw new InvalidExecutionContextException($"{nameof(Float3)}./");
///
/// Multiplies two values.
///
/// The first value to multiply.
/// The second value to multiply.
public static Float3 operator *(Float3 left, Float3 right) => throw new InvalidExecutionContextException($"{nameof(Float3)}.*");
///
/// Subtracts two values.
///
/// The first value to subtract.
/// The second value to subtract.
public static Float3 operator -(Float3 left, Float3 right) => throw new InvalidExecutionContextException($"{nameof(Float3)}.-");
}
}