yet another API cleanup

This commit is contained in:
onezplpl 2024-07-17 19:54:19 -04:00
parent 2008f70983
commit b6b3483a39
No known key found for this signature in database
GPG key ID: 7EC026A136F9EEC3
9 changed files with 134 additions and 114 deletions

18
main.c
View file

@ -98,7 +98,7 @@ void *render_chunks(void *args) {
*args2.is_render = 0;
*cube_count =
gen_cubes(*args2.cube, *args2.text, *args2.cubeO, *args2.textO,
cubes_vert(*args2.cube, *args2.text, *args2.cubeO, *args2.textO,
args2.pos[0] / CHUNK_LENGTH, args2.pos[1] / CHUNK_LENGTH,
args2.pos[2] / CHUNK_LENGTH, 0, args2.i2);
@ -134,7 +134,7 @@ int main(void) {
int bleh = (CHUNK_DIAMETER_H) * (CHUNK_DIAMETER_V);
int *i2 = calloc(bleh, sizeof(int));
int cube_count = gen_cubes(cube, text, cubeO, textO, 10240 / CHUNK_LENGTH,
int cube_count = cubes_vert(cube, text, cubeO, textO, 10240 / CHUNK_LENGTH,
64 / CHUNK_LENGTH, 10240 / CHUNK_LENGTH, 1, i2);
GLuint vertex_buffer[2];
@ -189,10 +189,10 @@ int main(void) {
vec3 oldPos = {0, 0, 0};
struct chunk ch7;
ch7.exists = 0;
int state = cube_exists(pos[0], pos[1], pos[2], ch7, 0);
int state = gen_cube(pos[0], pos[1], pos[2], ch7, 0);
while (1) {
if (state != cube_exists(pos[0], pos[1], pos[2], ch7, 0))
if (state != gen_cube(pos[0], pos[1], pos[2], ch7, 0))
break;
pos[1] += (state ? 1 : -1);
}
@ -208,7 +208,7 @@ int main(void) {
int last_render = 0;
struct chunk chunk = fetch_chunk(pos[0] / CHUNK_LENGTH, pos[1] / CHUNK_LENGTH,
struct chunk chunk = gen_chunk(pos[0] / CHUNK_LENGTH, pos[1] / CHUNK_LENGTH,
pos[2] / CHUNK_LENGTH, 0, 0);
vec3 dir_temp = {0, 0, 0};
@ -232,7 +232,7 @@ int main(void) {
vec3 direction;
vec3_dup(direction,controlHandler(cx, cy, pos, dir_temp,
vec3_dup(direction,control_handler(cx, cy, pos, dir_temp,
window, chunk).pos);
vec3 dir_pos;
@ -292,7 +292,7 @@ int main(void) {
cubeO); // cube);
if (thread_id != 0) {
pthread_join(thread_id, NULL);
chunk = fetch_chunk(pos[0] / CHUNK_LENGTH, pos[1] / CHUNK_LENGTH,
chunk = gen_chunk(pos[0] / CHUNK_LENGTH, pos[1] / CHUNK_LENGTH,
pos[2] / CHUNK_LENGTH, 0, 0);
}
thread_id = 0;
@ -320,8 +320,8 @@ int main(void) {
free(cubeO);
free(textO);
free(i2);
free_chunks();
free_chunks_old();
gen_free();
cubes_free();
glfwDestroyWindow(window);