make face culling optional

This commit is contained in:
veclavtalica 2025-01-27 04:15:46 +03:00
parent 6ef3cf1a3a
commit 166ae43981
3 changed files with 13 additions and 1 deletions

View File

@ -96,7 +96,11 @@ static void finally_use_space_pipeline(void) {
if (GLAD_GL_ARB_depth_clamp)
glDisable(GL_DEPTH_CLAMP);
if (ctx.cull_faces)
glEnable(GL_CULL_FACE);
else
glDisable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE0);
glEnable(GL_DEPTH_TEST);

View File

@ -81,6 +81,7 @@ typedef struct EngineContext {
/* signals mouse focus, used to disable mouse capture */
bool window_mouse_resident;
bool audio_initialized;
bool cull_faces;
} EngineContext;
/* TODO: does it need to be marked with TWN_API? */

View File

@ -596,6 +596,13 @@ static bool initialize(void) {
}
}
SDL_free(datum_font_filtering.u.s);
toml_datum_t datum_cull_faces = toml_bool_in(engine, "cull_faces");
if (!datum_cull_faces.ok) {
ctx.cull_faces = true;
} else {
ctx.cull_faces = datum_cull_faces.u.b;
}
}
/* these are dynamic arrays and will be allocated lazily by stb_ds */