From 2d3aa22242fb7ca71519840bc4b845b2e1e199d5 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Thu, 26 Dec 2019 17:13:21 -0700 Subject: [PATCH] light: add _nostaticlight key --- include/light/entities.hh | 6 ++++-- light/ltface.cc | 11 +++++++++++ man/light.1 | 4 ++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/light/entities.hh b/include/light/entities.hh index e7eebd27..cf2b2e2d 100644 --- a/include/light/entities.hh +++ b/include/light/entities.hh @@ -80,6 +80,7 @@ public: lockable_vec3_t origin, color, mangle, projangle; lockable_string_t project_texture; lockable_string_t suntexture; + lockable_bool_t nostaticlight; light_formula_t getFormula() const { return static_cast(formula.intValue()); } @@ -123,7 +124,8 @@ public: mangle { "mangle", 0, 0, 0 }, // not transformed to vec projangle { "project_mangle", 20, 0, 0 }, // not transformed to vec project_texture { "project_texture", "" }, - suntexture { "suntexture", "" } + suntexture { "suntexture", "" }, + nostaticlight { "nostaticlight", false } { VectorSet(spotvec, 0, 0, 0); @@ -140,7 +142,7 @@ public: &sun, //mxd &sunlight2, &sunlight3, &falloff, //mxd - &origin, &color, &mangle, &projangle, &project_texture, &suntexture + &origin, &color, &mangle, &projangle, &project_texture, &suntexture, &nostaticlight }}; } diff --git a/light/ltface.cc b/light/ltface.cc index 6abc0f29..f7966dba 100644 --- a/light/ltface.cc +++ b/light/ltface.cc @@ -1358,6 +1358,10 @@ GetDirectLighting(const mbsp_t *bsp, const globalconfig_t &cfg, raystream_t *rs, vec3_t surfpointToLightDir; float surfpointToLightDist; vec3_t color, normalcontrib; + + if (entity.nostaticlight.boolValue()) { + continue; + } // Skip styled lights if "bouncestyled" setting is off. if (entity.style.intValue() != 0 && !cfg.bouncestyled.boolValue()) { @@ -1698,6 +1702,9 @@ LightFace_Min(const mbsp_t *bsp, const bsp2_dface_t *face, if (entity.getFormula() != LF_LOCALMIN) { continue; } + if (entity.nostaticlight.boolValue()) { + continue; + } if (CullLight(&entity, lightsurf)) { continue; @@ -3255,6 +3262,8 @@ LightFace(const mbsp_t *bsp, bsp2_dface_t *face, facesup_t *facesup, const globa { if (entity.getFormula() == LF_LOCALMIN) continue; + if (entity.nostaticlight.boolValue()) + continue; if (entity.light.floatValue() > 0) LightFace_Entity(bsp, &entity, lightsurf, lightmaps); } @@ -3292,6 +3301,8 @@ LightFace(const mbsp_t *bsp, bsp2_dface_t *face, facesup_t *facesup, const globa { if (entity.getFormula() == LF_LOCALMIN) continue; + if (entity.nostaticlight.boolValue()) + continue; if (entity.light.floatValue() < 0) LightFace_Entity(bsp, &entity, lightsurf, lightmaps); } diff --git a/man/light.1 b/man/light.1 index 7f01f03e..0346924e 100644 --- a/man/light.1 +++ b/man/light.1 @@ -454,6 +454,10 @@ The following light properties correspond to these sunlight settings: .IP "\fB""_sunlight3"" ""n""\fP" Same as "_sunlight2", but for the lower hemisphere. +.IP "\fB""_nostaticlight"" ""n""\fP" +Set to 1 to make the light compiler ignore this entity (prevents it from casting any light). e.g. could be useful with rtlights. + + .SH "OTHER INFORMATION" The "\\b" escape sequence toggles red text on/off, you can use this in any strings in the map file. e.g. "message" "Here is \\bsome red text\\b..."