make face culling optional
This commit is contained in:
parent
6ef3cf1a3a
commit
166ae43981
@ -96,7 +96,11 @@ static void finally_use_space_pipeline(void) {
|
|||||||
if (GLAD_GL_ARB_depth_clamp)
|
if (GLAD_GL_ARB_depth_clamp)
|
||||||
glDisable(GL_DEPTH_CLAMP);
|
glDisable(GL_DEPTH_CLAMP);
|
||||||
|
|
||||||
glEnable(GL_CULL_FACE);
|
if (ctx.cull_faces)
|
||||||
|
glEnable(GL_CULL_FACE);
|
||||||
|
else
|
||||||
|
glDisable(GL_CULL_FACE);
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
@ -81,6 +81,7 @@ typedef struct EngineContext {
|
|||||||
/* signals mouse focus, used to disable mouse capture */
|
/* signals mouse focus, used to disable mouse capture */
|
||||||
bool window_mouse_resident;
|
bool window_mouse_resident;
|
||||||
bool audio_initialized;
|
bool audio_initialized;
|
||||||
|
bool cull_faces;
|
||||||
} EngineContext;
|
} EngineContext;
|
||||||
|
|
||||||
/* TODO: does it need to be marked with TWN_API? */
|
/* TODO: does it need to be marked with TWN_API? */
|
||||||
|
@ -596,6 +596,13 @@ static bool initialize(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
SDL_free(datum_font_filtering.u.s);
|
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 */
|
/* these are dynamic arrays and will be allocated lazily by stb_ds */
|
||||||
|
Loading…
Reference in New Issue
Block a user