diff --git a/Makefile b/Makefile index 2c58111..33efc97 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Compiler and other things. CC = gcc -CFLAGS = -std=c99 -Wall -Wextra +CFLAGS = -std=c99 -Wall -Wextra BUILDD = build # NOTE: there is a gcc bug (?) which is making some of the code produce spurrious warnings diff --git a/terrain.c b/terrain.c index 4b25768..88d9a88 100644 --- a/terrain.c +++ b/terrain.c @@ -72,15 +72,17 @@ void gen_terrain(struct vec2i pos, haloo3d_obj *model) { eprintf("SEAUV: %f,%f\n", seacol.x, seacol.y); // 0xF26F)); // clang-format off - int bl = haloo3d_obj_addvertex(model, (struct vec4){.x = 0, .y = 0, .z = 0, .w = 1}); - 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 = CHUNKSIZE, .w = 1}); - int tr = haloo3d_obj_addvertex(model, (struct vec4){.x = CHUNKSIZE, .y = 0, .z = CHUNKSIZE, .w = 1}); + // REMEMBER: NEGATIVE Z IS FORWARD + int tl = haloo3d_obj_addvertex(model, (struct vec4){.x = 0, .y = 0, .z = 0, .w = 1}); + int tr = haloo3d_obj_addvertex(model, (struct vec4){.x = CHUNKSIZE, .y = 0, .z = 0, .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 haloo3d_facei face; fastface(face, seauv, bl, br, tl); haloo3d_obj_addface(model, face); fastface(face, seauv, br, tr, tl); + haloo3d_obj_addface(model, face); model->numfaces += 2; 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}, .lighting = NULL, //&ecs->chunklight, .model = model, - .cullbackface = 0, + .cullbackface = 1, .context = {ctx}, .contextcount = 1}; }