qbsp: RemapContentsForExport: fix for q2 structural faces completely covered by detail fence not rendering

at least in yquake2, (vanilla?). Remaps the detail fence to "window"
This commit is contained in:
Eric Wasylishen 2022-01-22 16:28:08 -07:00
parent c31edc6599
commit d340bd06a5
1 changed files with 10 additions and 0 deletions

View File

@ -34,6 +34,16 @@ using nlohmann::json;
static contentflags_t RemapContentsForExport(const contentflags_t &content)
{
if (content.extended & CFLAGS_DETAIL_FENCE) {
/*
* A bit of a hack for Q2, to ensure that structural faces which are completely covered by CFLAGS_DETAIL_FENCE
* still render.
*
* If we export the detail fence leaf as CONTENTS_SOLID, Q2 engines will refuse to render the covered sturctural
* face because of a short-circuit in GL_DrawLeaf.
*/
if (options.target_game->id == GAME_QUAKE_II) {
return { Q2_CONTENTS_WINDOW, 0 };
}
/*
* This is for func_detail_wall.. we want to write a solid leaf that has faces,
* because it may be possible to see inside (fence textures).