53 lines
1.6 KiB
C

// Copyright (c) 2021 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "../../libs.h"
#include "primitive.h"
#define QUAD_VERTICE_COUNT 4
#define QUAD_INDICE_COUNT 6
#define QUAD_INDICE_PER_QUAD 2
/**
* Buffers the vertices of a quad onto a primitive.
*
* @param primitive The primitive to buffer to.
* @param z The Z axis coordinate of the quad.
* @param x0 The X lower coordinate.
* @param y0 The Y lower coordinate.
* @param u0 The X lower texture coordinate.
* @param v0 The Y lower texture coordinate.
* @param x1 The X higher coordinate.
* @param y1 The Y higher coordinate.
* @param u1 The X higher texture coordinate.
* @param v1 The Y higher texture coordinate.
* @param verticeStart Start vertice to buffer to.
* @param indiceStart Start indice to buffer to.
*/
void quadBuffer(primitive_t *primitive, float z,
float x0, float y0, float u0, float v0,
float x1, float y1, float u1, float v1,
int32_t verticeStart, int32_t indiceStart
);
/**
* Creates a new quad primitive.
*
* @param primitive Primitive to turn into a quad.
* @param z The Z axis coordinate of the quad.
* @param x0 The X lower coordinate.
* @param y0 The Y lower coordinate.
* @param u0 The X lower texture coordinate.
* @param v0 The Y lower texture coordinate.
* @param x1 The X higher coordinate.
* @param y1 The Y higher coordinate.
* @param u1 The X higher texture coordinate.
* @param v1 The Y higher texture coordinate.
*/
void quadInit(primitive_t *primitive, float z,
float x0, float y0, float u0, float v0,
float x1, float y1, float u1, float v1
);