qbsp, light: support _minlight_exclude on func_group, detail, etc.

This commit is contained in:
Eric Wasylishen 2019-04-05 21:14:39 -06:00
parent 6660c5fc09
commit b343b9504a
5 changed files with 15 additions and 7 deletions

View File

@ -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

View File

@ -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
}};
}
};

View File

@ -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.

View File

@ -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);

View File

@ -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"))) {