light: add "_lightignore" model key

This commit is contained in:
Eric Wasylishen 2016-09-20 16:07:37 -06:00
parent e3bd63eef2
commit 57834c438b
3 changed files with 103 additions and 23 deletions

View File

@ -217,6 +217,7 @@ public:
lockable_vec_t minlight, shadow, shadowself, dirt, phong, phong_angle; lockable_vec_t minlight, shadow, shadowself, dirt, phong, phong_angle;
lockable_string_t minlight_exclude; lockable_string_t minlight_exclude;
lockable_vec3_t minlight_color; lockable_vec3_t minlight_color;
lockable_bool_t lightignore;
float getResolvedPhongAngle() const { float getResolvedPhongAngle() const {
const float s = phong_angle.floatValue(); const float s = phong_angle.floatValue();
@ -240,7 +241,9 @@ public:
phong { "phong", 0 }, phong { "phong", 0 },
phong_angle { "phong_angle", 0 }, phong_angle { "phong_angle", 0 },
minlight_exclude { "minlight_exclude", "" }, minlight_exclude { "minlight_exclude", "" },
minlight_color { "minlight_color", 255, 255, 255, vec3_transformer_t::NORMALIZE_COLOR_TO_255 } minlight_color { "minlight_color", 255, 255, 255, vec3_transformer_t::NORMALIZE_COLOR_TO_255 },
lightignore { "lightignore", false }
{ {
VectorSet(offset, 0, 0, 0); VectorSet(offset, 0, 0, 0);
} }
@ -248,7 +251,7 @@ public:
settingsdict_t settings() { settingsdict_t settings() {
return {{ return {{
&minlight, &shadow, &shadowself, &dirt, &phong, &phong_angle, &minlight, &shadow, &shadowself, &dirt, &phong, &phong_angle,
&minlight_exclude, &minlight_color &minlight_exclude, &minlight_color, &lightignore
}}; }};
} }
}; };

View File

@ -1512,6 +1512,10 @@ LightFace_Min(const bsp2_t *bsp, const bsp2_dface_t *face,
Lightmap_Save(lightmaps, lightsurf, lightmap, 0); Lightmap_Save(lightmaps, lightsurf, lightmap, 0);
} }
// FIXME: Refactor this?
if (lightsurf->modelinfo->lightignore.boolValue())
return;
/* Cast rays for local minlight entities */ /* Cast rays for local minlight entities */
const dmodel_t *shadowself = modelinfo->shadowself.boolValue() ? modelinfo->model : NULL; const dmodel_t *shadowself = modelinfo->shadowself.boolValue() ? modelinfo->model : NULL;
for (const auto &entity : GetLights()) { for (const auto &entity : GetLights()) {
@ -2351,19 +2355,21 @@ LightFace(bsp2_dface_t *face, facesup_t *facesup, const modelinfo_t *modelinfo,
total_samplepoints += lightsurf->numpoints; total_samplepoints += lightsurf->numpoints;
/* positive lights */ /* positive lights */
for (const auto &entity : GetLights()) if (!modelinfo->lightignore.boolValue()) {
{ for (const auto &entity : GetLights())
if (entity.getFormula() == LF_LOCALMIN) {
continue; if (entity.getFormula() == LF_LOCALMIN)
if (entity.light.floatValue() > 0) continue;
LightFace_Entity(bsp, &entity, lightsurf, lightmaps); if (entity.light.floatValue() > 0)
} LightFace_Entity(bsp, &entity, lightsurf, lightmaps);
for ( const sun_t &sun : GetSuns() ) }
if (sun.sunlight > 0) for ( const sun_t &sun : GetSuns() )
LightFace_Sky (&sun, lightsurf, lightmaps); if (sun.sunlight > 0)
LightFace_Sky (&sun, lightsurf, lightmaps);
/* add indirect lighting */ /* add indirect lighting */
LightFace_Bounce(ctx->bsp, face, lightsurf, lightmaps); LightFace_Bounce(ctx->bsp, face, lightsurf, lightmaps);
}
/* minlight - Use the greater of global or model minlight. */ /* minlight - Use the greater of global or model minlight. */
if (lightsurf->minlight > cfg.minlight.floatValue()) if (lightsurf->minlight > cfg.minlight.floatValue())
@ -2377,16 +2383,18 @@ LightFace(bsp2_dface_t *face, facesup_t *facesup, const modelinfo_t *modelinfo,
} }
/* negative lights */ /* negative lights */
for (const auto &entity : GetLights()) if (!modelinfo->lightignore.boolValue()) {
{ for (const auto &entity : GetLights())
if (entity.getFormula() == LF_LOCALMIN) {
continue; if (entity.getFormula() == LF_LOCALMIN)
if (entity.light.floatValue() < 0) continue;
LightFace_Entity(bsp, &entity, lightsurf, lightmaps); if (entity.light.floatValue() < 0)
LightFace_Entity(bsp, &entity, lightsurf, lightmaps);
}
for (const sun_t &sun : GetSuns())
if (sun.sunlight < 0)
LightFace_Sky (&sun, lightsurf, lightmaps);
} }
for (const sun_t &sun : GetSuns())
if (sun.sunlight < 0)
LightFace_Sky (&sun, lightsurf, lightmaps);
} }
/* bounce debug */ /* bounce debug */

View File

@ -5,6 +5,7 @@
"classname" "worldspawn" "classname" "worldspawn"
"wad" "free_wad.wad;fence.wad" "wad" "free_wad.wad;fence.wad"
"light" "4" "light" "4"
"_dirt" "1"
// brush 0 // brush 0
{ {
( 1184 -640 80 ) ( 1184 -640 81 ) ( 1184 -639 80 ) narrow 64 -0 -0 1 1 ( 1184 -640 80 ) ( 1184 -640 81 ) ( 1184 -639 80 ) narrow 64 -0 -0 1 1
@ -1957,3 +1958,71 @@
"delay" "2" "delay" "2"
"style" "2" "style" "2"
} }
// entity 84
{
"classname" "func_wall"
"_lightignore" "1"
"_shadowself" "1"
// brush 0
{
( 592 -384 112 ) ( 656 -384 128 ) ( 656 -384 112 ) brownmetal -0 48 -0 1 1
( 592 -480 112 ) ( 592 -368 128 ) ( 592 -480 128 ) brownmetal -0 48 -0 1 1
( 592 -480 112 ) ( 656 -368 112 ) ( 592 -368 112 ) brownmetal -0 16 -0 1 1
( 592 -480 144 ) ( 656 -368 144 ) ( 656 -480 144 ) brownmetal -0 16 -0 1 1
( 592 -368 112 ) ( 656 -368 128 ) ( 592 -368 128 ) brownmetal -0 48 -0 1 1
( 656 -480 112 ) ( 656 -368 128 ) ( 656 -368 112 ) brownmetal -0 48 -0 1 1
}
// brush 1
{
( 592 -480 112 ) ( 656 -480 128 ) ( 656 -480 112 ) brownmetal -0 48 -0 1 1
( 592 -576 112 ) ( 592 -464 128 ) ( 592 -576 128 ) brownmetal 32 48 -0 1 1
( 592 -576 112 ) ( 656 -464 112 ) ( 592 -464 112 ) brownmetal -0 -16 -0 1 1
( 592 -576 144 ) ( 656 -464 144 ) ( 656 -576 144 ) brownmetal -0 -16 -0 1 1
( 592 -464 112 ) ( 656 -464 128 ) ( 592 -464 128 ) brownmetal -0 48 -0 1 1
( 656 -576 112 ) ( 656 -464 128 ) ( 656 -464 112 ) brownmetal 32 48 -0 1 1
}
// brush 2
{
( 592 -480 80 ) ( 656 -480 96 ) ( 656 -480 80 ) brownmetal 64 80 0 1 1
( 592 -480 80 ) ( 592 -368 96 ) ( 592 -480 96 ) brownmetal 64 80 0 1 1
( 592 -480 80 ) ( 656 -368 80 ) ( 592 -368 80 ) brownmetal 64 80 0 1 1
( 592 -480 112 ) ( 656 -368 112 ) ( 656 -480 112 ) brownmetal -0 16 -0 1 1
( 592 -368 80 ) ( 656 -368 96 ) ( 592 -368 96 ) brownmetal 64 80 0 1 1
( 656 -480 80 ) ( 656 -368 96 ) ( 656 -368 80 ) brownmetal 64 80 0 1 1
}
}
// entity 85
{
"classname" "func_wall"
"_lightignore" "1"
"_minlight" "100"
"_minlight_color" "50 50 255"
"_shadowself" "1"
// brush 0
{
( 592 -560 128 ) ( 656 -560 144 ) ( 656 -560 128 ) brownmetal -0 -0 -0 1 1
( 592 -656 128 ) ( 592 -544 144 ) ( 592 -656 144 ) brownmetal 48 -0 -0 1 1
( 592 -656 128 ) ( 656 -544 128 ) ( 592 -544 128 ) brownmetal -0 -32 -0 1 1
( 592 -656 160 ) ( 656 -544 160 ) ( 656 -656 160 ) brownmetal -0 -32 -0 1 1
( 592 -544 128 ) ( 656 -544 144 ) ( 592 -544 144 ) brownmetal -0 -0 -0 1 1
( 656 -656 128 ) ( 656 -544 144 ) ( 656 -544 128 ) brownmetal 48 -0 -0 1 1
}
// brush 1
{
( 592 -656 128 ) ( 656 -656 144 ) ( 656 -656 128 ) brownmetal -0 -0 -0 1 1
( 592 -752 128 ) ( 592 -640 144 ) ( 592 -752 144 ) brownmetal 16 -0 -0 1 1
( 592 -752 128 ) ( 656 -640 128 ) ( 592 -640 128 ) brownmetal -0 -0 -0 1 1
( 592 -752 160 ) ( 656 -640 160 ) ( 656 -752 160 ) brownmetal -0 -0 -0 1 1
( 592 -640 128 ) ( 656 -640 144 ) ( 592 -640 144 ) brownmetal -0 -0 -0 1 1
( 656 -752 128 ) ( 656 -640 144 ) ( 656 -640 128 ) brownmetal 16 -0 -0 1 1
}
// brush 2
{
( 592 -656 96 ) ( 656 -656 112 ) ( 656 -656 96 ) brownmetal -0 32 -0 1 1
( 592 -656 96 ) ( 592 -544 112 ) ( 592 -656 112 ) brownmetal 48 32 -0 1 1
( 592 -656 96 ) ( 656 -544 96 ) ( 592 -544 96 ) brownmetal -0 -32 -0 1 1
( 592 -656 128 ) ( 656 -544 128 ) ( 656 -656 128 ) brownmetal -0 -32 -0 1 1
( 592 -544 96 ) ( 656 -544 112 ) ( 592 -544 112 ) brownmetal -0 32 -0 1 1
( 656 -656 96 ) ( 656 -544 112 ) ( 656 -544 96 ) brownmetal 48 32 -0 1 1
}
}