// Copyright (c) 2023 Dominic Masters
// 
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT

#pragma once
#include "display/mesh/Mesh.hpp"

#define QUAD_VERTICE_COUNT 4
#define QUAD_INDICE_COUNT 6

namespace Dawn {
  class QuadMesh {
    public:
      /**
       * Buffers quad mesh vertices and indices into the given mesh.
       * 
       * @param mesh The mesh to buffer into.
       * @param positions The positions of the vertices.
       * @param coordinates The coordinates of the vertices.
       * @param verticeStart The starting index of the vertices.
       * @param indiceStart The starting index of the indices.
       * @param depth The depth of the vertices (Z coordinate).
       */
      static void buffer(
        const std::shared_ptr<Mesh> mesh,
        const glm::vec4 positions,
        const glm::vec4 coordinates,
        const int32_t verticeStart,
        const int32_t indiceStart,
        const float_t depth = 0.0f
      );

      /**
       * Buffers quad mesh vertices and indices into the given mesh. This will
       * store the index of the vertice in the Z component, allowing you to find
       * which vertex ID you are rendering in your shader.
       * 
       * @param mesh The mesh to buffer into.
       * @param positions The positions of the vertices.
       * @param coordinates The coordinates of the vertices.
       * @param verticeStart The starting index of the vertices.
       * @param indiceStart The starting index of the indices.
       * @param indexOffset The offset to add to the index of each vertex.
       */
      static void bufferWithIndex(
        const std::shared_ptr<Mesh> mesh,
        const glm::vec4 positions,
        const glm::vec4 coordinates,
        const int32_t verticeStart,
        const int32_t indiceStart,
        const int32_t indexOffset = 0
      );
  };
}