using OpenTK.Graphics.OpenGL;

namespace Engine.Graphics.Buffer.Vertex;

[AttributeUsage(AttributeTargets.Field)]
public class VertexAttribute : Attribute
{
  public VertexAttribType Type { get; }
  public int ComponentCount { get; }
  public bool Normalized { get; }
  public int RepeatCount { get; }

  public VertexAttribute(VertexAttribType parType, int parComponentCount = 1, int parRepeatCount = 1,
    bool parNormalized = false
  )
  {
    if (parComponentCount <= 0)
    {
      throw new ArgumentException("Count must be greater than 0");
    }

    if (parRepeatCount <= 0)
    {
      throw new ArgumentException("Repeat must be greater than 0");
    }

    Type = parType;
    ComponentCount = parComponentCount;
    Normalized = parNormalized;
    RepeatCount = parRepeatCount;
  }
}