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:
parent
b6116ff42a
commit
318fc23481
|
|
@ -72,6 +72,7 @@ typedef struct entity_s {
|
|||
float atten;
|
||||
float anglescale;
|
||||
int style;
|
||||
qboolean bleed;
|
||||
|
||||
/* worldspawn only */
|
||||
vec_t dirtdepth;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Reference in New Issue