44 lines
1.1 KiB
C
44 lines
1.1 KiB
C
/**
|
|
* Copyright (c) 2026 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "display/mesh/mesh.h"
|
|
#include "display/color.h"
|
|
|
|
#define CUBE_FACE_COUNT 6
|
|
#define CUBE_VERTICES_PER_FACE 6
|
|
#define CUBE_VERTEX_COUNT (CUBE_FACE_COUNT * CUBE_VERTICES_PER_FACE)
|
|
#define CUBE_PRIMITIVE_TYPE MESH_PRIMITIVE_TYPE_TRIANGLES
|
|
|
|
extern mesh_t CUBE_MESH_SIMPLE;
|
|
extern meshvertex_t CUBE_MESH_SIMPLE_VERTICES[CUBE_VERTEX_COUNT];
|
|
|
|
/**
|
|
* Initializes the simple unit cube mesh (0,0,0) to (1,1,1).
|
|
*
|
|
* @return Error for initialization of the cube mesh.
|
|
*/
|
|
errorret_t cubeInit();
|
|
|
|
/**
|
|
* Buffers a 3D axis-aligned cube into the provided vertex array.
|
|
* Writes CUBE_VERTEX_COUNT vertices (6 faces x 6 vertices, CCW winding).
|
|
*
|
|
* @param vertices The vertex array to buffer into.
|
|
* @param min The minimum XYZ corner of the cube.
|
|
* @param max The maximum XYZ corner of the cube.
|
|
* @param color The color applied to all vertices.
|
|
*/
|
|
void cubeBuffer(
|
|
meshvertex_t *vertices,
|
|
const vec3 min,
|
|
const vec3 max
|
|
#if MESH_ENABLE_COLOR
|
|
, const color_t color
|
|
#endif
|
|
);
|