using System; namespace GlitchyEngine.Math.Attributes; /// /// Specifies that fields for the components of a matrix should be generated as well as basic methods like constructors, type casts and equality checks. /// [AttributeUsage(AttributeTargets.Struct)] public sealed class MatrixAttribute : Attribute { /// /// The Type of the matrices components. /// public Type Type { get; } /// /// The number of rows the matrix has. /// public int Rows { get; } /// /// The number of columns the matrix has. /// public int Columns { get; } /// /// The base name of the matrix. (Name of matrix without the row and column count) /// public string BaseName { get; } /// /// Creates a new instance of the class. /// /// /// /// /// public MatrixAttribute(Type type, int rows, int columns, string baseName) { Type = type; Rows = rows; Columns = columns; BaseName = baseName; } } /// /// Specifies that the matrix type should have comparison operators (>, <, >= and <=) generated for it. /// [AttributeUsage(AttributeTargets.Struct)] public sealed class ComparableMatrixAttribute : Attribute { } /// /// Specifies that the matrix type should have component wise math operators (+, -) generated for it. /// [AttributeUsage(AttributeTargets.Struct)] public class MatrixMathAttribute : Attribute { } /// /// Specifies that the matrix type should have component wise logic operators (&, ^ and |) generated for it. /// [AttributeUsage(AttributeTargets.Struct)] public class MatrixLogicAttribute : Attribute { } /// /// Generates a multiplication overload for matrix type with the specified vector type. /// [AttributeUsage(AttributeTargets.Struct, AllowMultiple = true)] public class MatrixVectorMultiplicationAttribute : Attribute { /// /// The type of the vector that will be multiplied with the matrix. /// public Type VectorType { get; set; } /// /// Creates a new instance of the class. /// /// public MatrixVectorMultiplicationAttribute(Type vectorType) { VectorType = vectorType; } } /// /// Generates a cast cast from the matrix type to the specified target type. /// [AttributeUsage(AttributeTargets.Struct, AllowMultiple = true)] public class MatrixCastAttribute : Attribute { /// /// The type of the target matrix 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 MatrixCastAttribute(Type targetType, bool isExplicit) { TargetType = targetType; IsExplicit = isExplicit; } }