38 lines
1.1 KiB
C
38 lines
1.1 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 CUBE_VERTICE_COUNT 8
|
|
#define CUBE_INDICE_COUNT 36
|
|
|
|
/**
|
|
* Buffer the vertices and indices of a cube onto a primitive.
|
|
* @param primitive Primitive to buffer to.
|
|
* @param x X position of the cube.
|
|
* @param y Y position of the cube.
|
|
* @param z Z position of the cube.
|
|
* @param w Width of cube.
|
|
* @param h Height of cube.
|
|
* @param d Depth of cube.
|
|
* @param verticeStart The position of the vertex buffer to buffer into.
|
|
* @param indiceStart The position of the index buffer to buffer into.
|
|
*/
|
|
void cubeBuffer(primitive_t *primitive,
|
|
float x, float y, float z,
|
|
float w, float h, float d,
|
|
int32_t verticeStart, int32_t indiceStart
|
|
);
|
|
|
|
/**
|
|
* Creates a cube primitive of given size.
|
|
* @param primitive Primitive to create into a cube.
|
|
* @param w Width of cube.
|
|
* @param h Height of cube.
|
|
* @param d Depth of cube.
|
|
*/
|
|
void cubeInit(primitive_t *primitive, float w, float h, float d); |