using System.Runtime.InteropServices;
using ComputeSharp.Graphics.Exceptions;
namespace ComputeSharp.Shaders.Primitives.Float
{
///
/// A that maps the float2 HLSL type
///
[StructLayout(LayoutKind.Sequential, Size = sizeof(float) * 2)]
public struct Float2
{
///
/// 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
public Float2(float x, float y)
{
X = x;
Y = y;
}
///
/// 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 first color component
///
public float R
{
get => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(R)}");
set => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(R)}");
}
///
/// Gets or sets the value of the second color component
///
public float G
{
get => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(G)}");
set => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(G)}");
}
///
/// 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(Float2)}[int]");
set => throw new InvalidExecutionContextException($"{nameof(Float2)}[int]");
}
///
/// Gets an value with the value for all components
///
public Float2 XX => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(XX)}");
///
/// Gets or sets an value with the and values
///
public Float2 XY
{
get => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(XY)}");
set => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(XY)}");
}
///
/// Gets an value with the and values
///
public Float2 YX
{
get => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(YX)}");
set => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(YX)}");
}
///
/// Gets an value with the value for all components
///
public Float2 YY => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(YY)}");
///
/// Gets an value with the value for all components
///
public Float2 RR => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(RR)}");
///
/// Gets or sets an value with the and values
///
public Float2 RG
{
get => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(RG)}");
set => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(RG)}");
}
///
/// Gets an value with the and values
///
public Float2 GR
{
get => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(GR)}");
set => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(GR)}");
}
///
/// Gets an value with the value for all components
///
public Float2 GG => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(GG)}");
///
/// 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 Float2(float x) => new Float2(x, x);
}
}