From 10386581a63a735a3abe39c4bda23961e70c1e14 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Mon, 27 Mar 2017 16:44:04 -0600 Subject: [PATCH] light: make bounce of styled lights opt in with "_bouncestyled" worldspawn key --- changelog.txt | 4 ++++ include/light/light.hh | 5 +++-- light/ltface.cc | 14 +++++++++++++- man/light.1 | 13 +++++++++++++ 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index 8b6bd306..07f59b3f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +2017-03-27 TyrUtils-ericw 0.15.10-beta2 + +- light: styled lights no longer bounce by default, set "_bouncestyled" "1" to enable. + 2017-03-26 TyrUtils-ericw 0.15.10-beta1 - light: fix Linux binary diff --git a/include/light/light.hh b/include/light/light.hh index 97a73e05..39d7b851 100644 --- a/include/light/light.hh +++ b/include/light/light.hh @@ -263,6 +263,7 @@ public: /* bounce */ lockable_bool_t bounce; + lockable_bool_t bouncestyled; lockable_vec_t bouncescale, bouncecolorscale; /* sunlight */ @@ -305,6 +306,7 @@ public: /* bounce */ bounce {"bounce", false}, + bouncestyled {"bouncestyled", false}, bouncescale {"bouncescale", 1.0f, 0.0f, 100.0f}, bouncecolorscale {"bouncecolorscale", 0.0f, 0.0f, 1.0f}, @@ -334,8 +336,7 @@ public: &dirtMode, &dirtDepth, &dirtScale, &dirtGain, &dirtAngle, &minlightDirt, &phongallowed, - &bounce, - &bouncescale, &bouncecolorscale, + &bounce, &bouncestyled, &bouncescale, &bouncecolorscale, &sunlight, &sunlight_color, &sun2, diff --git a/light/ltface.cc b/light/ltface.cc index 6c063eb3..6273f27d 100644 --- a/light/ltface.cc +++ b/light/ltface.cc @@ -1205,7 +1205,14 @@ static void LightFace_SampleMipTex(miptex_t *tex, const float *projectionmatrix, } } -// FIXME: factor out / merge with LightFace +/* + * ================ + * GetDirectLighting + * + * Mesaures direct lighting at a point, currently only used for bounce lighting. + * FIXME: factor out / merge with LightFace + * ================ + */ std::map GetDirectLighting(const globalconfig_t &cfg, raystream_t *rs, const vec3_t origin, const vec3_t normal) { @@ -1222,6 +1229,11 @@ GetDirectLighting(const globalconfig_t &cfg, raystream_t *rs, const vec3_t origi float surfpointToLightDist; vec3_t color, normalcontrib; + // Skip styled lights if "bouncestyled" setting is off. + if (entity.style.intValue() != 0 && !cfg.bouncestyled.boolValue()) { + continue; + } + GetLightContrib(cfg, &entity, normal, origin, false, color, surfpointToLightDir, normalcontrib, &surfpointToLightDist); const float dirt = Dirt_GetScaleFactor(cfg, occlusion, &entity, surfpointToLightDist, /* FIXME: pass */ nullptr); diff --git a/man/light.1 b/man/light.1 index 45abc30f..0f170ebf 100644 --- a/man/light.1 +++ b/man/light.1 @@ -213,6 +213,19 @@ Adjust brightness of final lightmap. Default 1, >1 is brighter, <1 is darker. .IP "\fB""_lightmap_scale"" ""n""\fP" Forces all surfaces+submodels to use this specific lightmap scale. Removes "LMSHIFT" field. +.IP "\fB""_bounce"" ""n""\fP" +1 enables bounce lighting, disabled by default. + +.IP "\fB""_bouncescale"" ""n""\fP" +Scales brightness of bounce lighting, default 1. + +.IP "\fB""_bouncecolorscale"" ""n""\fP" +Weight for bounce lighting to use texture colors from the map: 0=ignore map textures (default), 1=multiply bounce light color by texture color. + +.IP "\fB""_bouncestyled"" ""n""\fP" +1 makes styled lights bounce (e.g. flickering or switchable lights), default is 0, they do not bounce. + + .SS "Model Entity Keys" .PP