73 lines
1.9 KiB
C
73 lines
1.9 KiB
C
/**
|
|
* Copyright (c) 2026 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "mesh.h"
|
|
#include "display/color.h"
|
|
|
|
#define QUAD_VERTEX_COUNT 6
|
|
#define QUAD_PRIMITIVE_TYPE MESH_PRIMITIVE_TYPE_TRIANGLES
|
|
|
|
extern mesh_t QUAD_MESH_SIMPLE;
|
|
extern meshvertex_t QUAD_MESH_SIMPLE_VERTICES[QUAD_VERTEX_COUNT];
|
|
|
|
/**
|
|
* Initializes the quad mesh.
|
|
*
|
|
* @return Error for initialization of the quad mesh.
|
|
*/
|
|
errorret_t quadInit();
|
|
|
|
/**
|
|
* Buffers a quad into the provided vertex array.
|
|
*
|
|
* @param vertices The vertex array to buffer into.
|
|
* @param minX The minimum X coordinate of the quad.
|
|
* @param minY The minimum Y coordinate of the quad.
|
|
* @param maxX The maximum X coordinate of the quad.
|
|
* @param maxY The maximum Y coordinate of the quad.
|
|
* @param color The color of the quad.
|
|
* @param u0 The U texture coordinate for the first vertex.
|
|
* @param v0 The V texture coordinate for the first vertex.
|
|
* @param u1 The U texture coordinate for the second vertex.
|
|
* @param v1 The V texture coordinate for the second vertex.
|
|
*/
|
|
void quadBuffer(
|
|
meshvertex_t *vertices,
|
|
const float_t minX,
|
|
const float_t minY,
|
|
const float_t maxX,
|
|
const float_t maxY,
|
|
const float_t u0,
|
|
const float_t v0,
|
|
const float_t u1,
|
|
const float_t v1
|
|
#if MESH_ENABLE_COLOR
|
|
, const color_t color
|
|
#endif
|
|
);
|
|
|
|
/**
|
|
* Buffers a 3D quad into the provided vertex array.
|
|
*
|
|
* @param vertices The vertex array to buffer into.
|
|
* @param min The minimum XYZ coordinates of the quad.
|
|
* @param max The maximum XYZ coordinates of the quad.
|
|
* @param color The color of the quad.
|
|
* @param uvMin The minimum UV coordinates of the quad.
|
|
* @param uvMax The maximum UV coordinates of the quad.
|
|
*/
|
|
void quadBuffer3D(
|
|
meshvertex_t *vertices,
|
|
const vec3 min,
|
|
const vec3 max,
|
|
const vec2 uvMin,
|
|
const vec2 uvMax
|
|
#if MESH_ENABLE_COLOR
|
|
, const color_t color
|
|
#endif
|
|
); |