CHUNKS BEFORE SEGFAULT

This commit is contained in:
Carlos Sanchez 2024-09-14 03:42:59 -04:00
parent 9511c07f3e
commit 082a084971
2 changed files with 8 additions and 6 deletions

View File

@ -1,6 +1,6 @@
# Compiler and other things. # Compiler and other things.
CC = gcc CC = gcc
CFLAGS = -std=c99 -Wall -Wextra CFLAGS = -std=c99 -Wall -Wextra
BUILDD = build BUILDD = build
# NOTE: there is a gcc bug (?) which is making some of the code produce spurrious warnings # NOTE: there is a gcc bug (?) which is making some of the code produce spurrious warnings

View File

@ -72,15 +72,17 @@ void gen_terrain(struct vec2i pos, haloo3d_obj *model) {
eprintf("SEAUV: %f,%f\n", seacol.x, seacol.y); eprintf("SEAUV: %f,%f\n", seacol.x, seacol.y);
// 0xF26F)); // 0xF26F));
// clang-format off // clang-format off
int bl = haloo3d_obj_addvertex(model, (struct vec4){.x = 0, .y = 0, .z = 0, .w = 1}); // REMEMBER: NEGATIVE Z IS FORWARD
int br = haloo3d_obj_addvertex(model, (struct vec4){.x = CHUNKSIZE, .y = 0, .z = 0, .w = 1}); int tl = haloo3d_obj_addvertex(model, (struct vec4){.x = 0, .y = 0, .z = 0, .w = 1});
int tl = haloo3d_obj_addvertex(model, (struct vec4){.x = 0, .y = 0, .z = CHUNKSIZE, .w = 1}); int tr = haloo3d_obj_addvertex(model, (struct vec4){.x = CHUNKSIZE, .y = 0, .z = 0, .w = 1});
int tr = haloo3d_obj_addvertex(model, (struct vec4){.x = CHUNKSIZE, .y = 0, .z = CHUNKSIZE, .w = 1}); int bl = haloo3d_obj_addvertex(model, (struct vec4){.x = 0, .y = 0, .z = CHUNKSIZE, .w = 1});
int br = haloo3d_obj_addvertex(model, (struct vec4){.x = CHUNKSIZE, .y = 0, .z = CHUNKSIZE, .w = 1});
// clang-format on // clang-format on
haloo3d_facei face; haloo3d_facei face;
fastface(face, seauv, bl, br, tl); fastface(face, seauv, bl, br, tl);
haloo3d_obj_addface(model, face); haloo3d_obj_addface(model, face);
fastface(face, seauv, br, tr, tl); fastface(face, seauv, br, tr, tl);
haloo3d_obj_addface(model, face);
model->numfaces += 2; model->numfaces += 2;
haloo3d_obj_shrinktofit(model); haloo3d_obj_shrinktofit(model);
} }
@ -110,7 +112,7 @@ void gen_chunk(render_context *ctx, tecs *ecs, struct vec2i pos) {
.scale = {.x = CHUNKSCALE, .y = CHUNKSCALE, .z = CHUNKSCALE}, .scale = {.x = CHUNKSCALE, .y = CHUNKSCALE, .z = CHUNKSCALE},
.lighting = NULL, //&ecs->chunklight, .lighting = NULL, //&ecs->chunklight,
.model = model, .model = model,
.cullbackface = 0, .cullbackface = 1,
.context = {ctx}, .context = {ctx},
.contextcount = 1}; .contextcount = 1};
} }