light: implement "_bleed" light key.

"_bleed" "1" on a light entity skips the test that a light is on the front side of a face. useful for special effects.
This commit is contained in:
Eric Wasylishen 2016-04-23 22:19:29 -06:00
parent b6116ff42a
commit 318fc23481
3 changed files with 10 additions and 1 deletions

View File

@ -72,6 +72,7 @@ typedef struct entity_s {
float atten;
float anglescale;
int style;
qboolean bleed;
/* worldspawn only */
vec_t dirtdepth;

View File

@ -1032,6 +1032,9 @@ LoadEntities(const bsp2_t *bsp)
{
projfov = atof(com_token);
}
else if (!strcmp(key, "_bleed")) {
entity->bleed = atoi(com_token);
}
else if (!strcmp(key, "_sunlight_penumbra")) {
sun_deviance = atof(com_token);
}

View File

@ -1244,7 +1244,7 @@ LightFace_Entity(const bsp2_t *bsp,
planedist = DotProduct(entity->origin, plane->normal) - plane->dist;
/* don't bother with lights behind the surface */
if (planedist < 0)
if (planedist < 0 && !entity->bleed)
return;
/* sphere cull surface and light */
@ -1270,6 +1270,11 @@ LightFace_Entity(const bsp2_t *bsp,
continue;
angle = DotProduct(surfpointToLightDir, surfnorm);
if (entity->bleed) {
if (angle < 0) {
angle = -angle; // ericw -- support "_bleed" option
}
}
angle = qmax(0.0f, angle); // light can be behind sample point if the light is right on the face
/* Check spotlight cone */