diff --git a/include/common/bspfile.hh b/include/common/bspfile.hh index 37c2bcd5..64975f44 100644 --- a/include/common/bspfile.hh +++ b/include/common/bspfile.hh @@ -351,6 +351,7 @@ typedef struct { #define TEX_PHONG_ANGLE_CONCAVE_SHIFT 45 #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 */ // Q2 Texture flags. #define Q2_SURF_LIGHT 0x1 // value will hold the light strength diff --git a/include/light/light.hh b/include/light/light.hh index 8e937092..e8906a90 100644 --- a/include/light/light.hh +++ b/include/light/light.hh @@ -204,7 +204,6 @@ public: public: lockable_vec_t minlight, shadow, shadowself, shadowworldonly, switchableshadow, switchshadstyle, dirt, phong, phong_angle, alpha; - lockable_string_t minlight_exclude; lockable_vec3_t minlight_color; lockable_bool_t lightignore; @@ -238,7 +237,6 @@ public: phong { "phong", 0 }, phong_angle { "phong_angle", 0 }, alpha { "alpha", 1.0f }, - minlight_exclude { "minlight_exclude", "" }, minlight_color { strings{"minlight_color", "mincolor"}, 255, 255, 255, vec3_transformer_t::NORMALIZE_COLOR_TO_255 }, lightignore { "lightignore", false } { @@ -248,7 +246,7 @@ public: settingsdict_t settings() { return {{ &minlight, &shadow, &shadowself, &shadowworldonly, &switchableshadow, &switchshadstyle, &dirt, &phong, &phong_angle, &alpha, - &minlight_exclude, &minlight_color, &lightignore + &minlight_color, &lightignore }}; } }; diff --git a/include/qbsp/qbsp.hh b/include/qbsp/qbsp.hh index 7109b18b..e8650b2a 100644 --- a/include/qbsp/qbsp.hh +++ b/include/qbsp/qbsp.hh @@ -139,6 +139,7 @@ #define TEX_PHONG_ANGLE_CONCAVE_SHIFT 45 #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 */ /* * The quality of the bsp output is highly sensitive to these epsilon values. diff --git a/light/ltface.cc b/light/ltface.cc index 34828a8e..4d917d25 100644 --- a/light/ltface.cc +++ b/light/ltface.cc @@ -1635,11 +1635,11 @@ LightFace_Min(const mbsp_t *bsp, const bsp2_dface_t *face, const globalconfig_t &cfg = *lightsurf->cfg; const modelinfo_t *modelinfo = lightsurf->modelinfo; - const char *texname = Face_TextureName(bsp, face); - if (texname[0] != '\0' && modelinfo->minlight_exclude.stringValue() == std::string{ texname }) { - return; /* this texture is excluded from minlight */ + const uint64_t extended_flags = extended_texinfo_flags[face->texinfo]; + if ((extended_flags & TEX_NOMINLIGHT) != 0) { + return; /* this face is excluded from minlight */ } - + /* Find a style 0 lightmap */ lightmap_t *lightmap = Lightmap_ForStyle(lightmaps, 0, lightsurf); diff --git a/qbsp/map.cc b/qbsp/map.cc index 03c5b557..735896d5 100644 --- a/qbsp/map.cc +++ b/qbsp/map.cc @@ -296,6 +296,14 @@ FindTexinfoEnt(mtexinfo_t *texinfo, const mapentity_t *entity) flags |= TEX_NODIRT; if (atoi(ValueForKey(entity, "_bounce")) == -1) flags |= TEX_NOBOUNCE; + if (atoi(ValueForKey(entity, "_minlight")) == -1) + flags |= TEX_NOMINLIGHT; + + const char *excludeTex = ValueForKey(entity, "_minlight_exclude"); + if (strlen(excludeTex) > 0 && !Q_strcasecmp(texname, excludeTex)) { + flags |= TEX_NOMINLIGHT; + } + if (shadow == -1) flags |= TEX_NOSHADOW; if (!Q_strcasecmp("func_detail_illusionary", ValueForKey(entity, "classname"))) {