using System;
namespace GlitchyEngine.Math.Attributes;
///
/// Generates fields for the components of a vector as well as basic methods like constructors, type casts and equality checks.
///
[AttributeUsage(AttributeTargets.Struct)]
public class VectorAttribute : Attribute
{
///
/// The Type of the vectors components.
///
public Type Type { get; set; }
///
/// Number of components in the vectors (valid values are in the range of 2 to 4).
///
public int ComponentCount { get; set; }
///
/// The base name of the vector.
///
public string TypeBase { get; set; }
///
/// Creates a new instance of the class.
///
///
///
///
public VectorAttribute(Type type, int componentCount, string typeBase)
{
Type = type;
ComponentCount = componentCount;
TypeBase = typeBase;
}
}
///
/// Generates comparison operators (>, <, >= and <=) for the vectors type.
///
[AttributeUsage(AttributeTargets.Struct)]
public class ComparableVectorAttribute : Attribute { }
///
/// Generates component wise math operators (+, -, *, / and %) for the vectors type.
///
[AttributeUsage(AttributeTargets.Struct)]
public class VectorMathAttribute : Attribute { }
///
/// Generates component wise logic operators (&, ^ and |) for the vectors type.
///
[AttributeUsage(AttributeTargets.Struct)]
public class VectorLogicAttribute : Attribute { }
///
/// Generates a cast cast from the vector type to the specified target type.
///
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = true)]
public class VectorCastAttribute : Attribute
{
///
/// The type of the target vector type.
///
public Type TargetType { get; set; }
///
/// If the cast will be explicit; if it will an implicit cast.
///
public bool IsExplicit { get; set; }
///
/// Creates a new instance of the class.
///
///
///
public VectorCastAttribute(Type targetType, bool isExplicit)
{
TargetType = targetType;
IsExplicit = isExplicit;
}
}