From a4c1ce6ff646852e2c387d77a3c0ceb29929bbd3 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Mon, 9 Dec 2019 00:09:20 -0700 Subject: [PATCH] qbsp, light: support _lightignore on func_detail/group --- include/common/bspfile.hh | 2 ++ include/qbsp/qbsp.hh | 1 + light/ltface.cc | 13 +++++++++---- qbsp/map.cc | 2 ++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/common/bspfile.hh b/include/common/bspfile.hh index 812655db..9213235d 100644 --- a/include/common/bspfile.hh +++ b/include/common/bspfile.hh @@ -353,6 +353,8 @@ typedef struct { #define TEX_PHONG_ANGLE_CONCAVE_MASK (255ULL << TEX_PHONG_ANGLE_CONCAVE_SHIFT) /* 8 bit value. if non zero, overrides _phong_angle for concave joints. */ #define TEX_NOBOUNCE (1ULL << 53) /* light doesn't bounce off this face */ #define TEX_NOMINLIGHT (1ULL << 54) /* opt out of minlight on this face */ +#define TEX_NOEXPAND (1ULL << 55) /* don't expand this face for larger clip hulls */ +#define TEX_LIGHTIGNORE (1ULL << 56) // Q2 Texture flags. #define Q2_SURF_LIGHT 0x1 // value will hold the light strength diff --git a/include/qbsp/qbsp.hh b/include/qbsp/qbsp.hh index 59df832b..001e99fc 100644 --- a/include/qbsp/qbsp.hh +++ b/include/qbsp/qbsp.hh @@ -143,6 +143,7 @@ #define TEX_NOBOUNCE (1ULL << 53) /* light doesn't bounce off this face */ #define TEX_NOMINLIGHT (1ULL << 54) /* opt out of minlight on this face */ #define TEX_NOEXPAND (1ULL << 55) /* don't expand this face for larger clip hulls */ +#define TEX_LIGHTIGNORE (1ULL << 56) /* * The quality of the bsp output is highly sensitive to these epsilon values. diff --git a/light/ltface.cc b/light/ltface.cc index 35ab285a..6abc0f29 100644 --- a/light/ltface.cc +++ b/light/ltface.cc @@ -1689,7 +1689,8 @@ LightFace_Min(const mbsp_t *bsp, const bsp2_dface_t *face, } // FIXME: Refactor this? - if (lightsurf->modelinfo->lightignore.boolValue()) + if (lightsurf->modelinfo->lightignore.boolValue() + || (extended_flags & TEX_LIGHTIGNORE) != 0) return; /* Cast rays for local minlight entities */ @@ -3244,9 +3245,12 @@ LightFace(const mbsp_t *bsp, bsp2_dface_t *face, facesup_t *facesup, const globa if (debugmode == debugmode_none) { total_samplepoints += lightsurf->numpoints; - + + const uint64_t extended_flags = extended_texinfo_flags[face->texinfo]; + /* positive lights */ - if (!modelinfo->lightignore.boolValue()) { + if (!(modelinfo->lightignore.boolValue() + || (extended_flags & TEX_LIGHTIGNORE) != 0)) { for (const auto &entity : GetLights()) { if (entity.getFormula() == LF_LOCALMIN) @@ -3282,7 +3286,8 @@ LightFace(const mbsp_t *bsp, bsp2_dface_t *face, facesup_t *facesup, const globa } /* negative lights */ - if (!modelinfo->lightignore.boolValue()) { + if (!(modelinfo->lightignore.boolValue() + || (extended_flags & TEX_LIGHTIGNORE) != 0)) { for (const auto &entity : GetLights()) { if (entity.getFormula() == LF_LOCALMIN) diff --git a/qbsp/map.cc b/qbsp/map.cc index 7d95793a..dad8ab08 100644 --- a/qbsp/map.cc +++ b/qbsp/map.cc @@ -312,6 +312,8 @@ FindTexinfoEnt(mtexinfo_t *texinfo, const mapentity_t *entity) flags |= TEX_NOBOUNCE; if (atoi(ValueForKey(entity, "_minlight")) == -1) flags |= TEX_NOMINLIGHT; + if (atoi(ValueForKey(entity, "_lightignore")) == 1) + flags |= TEX_LIGHTIGNORE; // "_minlight_exclude", "_minlight_exclude2", "_minlight_exclude3"... for (int i = 0; i <= 9; i++) {