mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 23:32:02 +00:00
- fixed: IsVisibleToPlayer needs to be checked for the owner of owned dynamic lights.
This commit is contained in:
parent
992994239b
commit
9ac3b6aa1b
2 changed files with 36 additions and 29 deletions
|
@ -183,6 +183,10 @@ bool gl_SetupLight(Plane & p, ADynamicLight * light, Vector & nearPt, Vector & u
|
|||
{
|
||||
return false;
|
||||
}
|
||||
if (light->owned && light->target != NULL && !light->target->IsVisibleToPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
scale = 1.0f / ((2.f * radius) - dist);
|
||||
|
||||
|
|
|
@ -79,42 +79,45 @@ bool gl_GetSpriteLight(AActor *self, fixed_t x, fixed_t y, fixed_t z, subsector_
|
|||
while (node)
|
||||
{
|
||||
light=node->lightsource;
|
||||
if (!(light->flags2&MF2_DORMANT) &&
|
||||
(!(light->flags4&MF4_DONTLIGHTSELF) || light->target != self))
|
||||
if (!light->owned || light->target == NULL || light->target->IsVisibleToPlayer())
|
||||
{
|
||||
float dist = FVector3( FIXED2FLOAT(x - light->x), FIXED2FLOAT(y - light->y), FIXED2FLOAT(z - light->z) ).Length();
|
||||
radius = light->GetRadius() * gl_lights_size;
|
||||
|
||||
if (dist < radius)
|
||||
if (!(light->flags2&MF2_DORMANT) &&
|
||||
(!(light->flags4&MF4_DONTLIGHTSELF) || light->target != self))
|
||||
{
|
||||
frac = 1.0f - (dist / radius);
|
||||
|
||||
if (frac > 0)
|
||||
float dist = FVector3(FIXED2FLOAT(x - light->x), FIXED2FLOAT(y - light->y), FIXED2FLOAT(z - light->z)).Length();
|
||||
radius = light->GetRadius() * gl_lights_size;
|
||||
|
||||
if (dist < radius)
|
||||
{
|
||||
if (line != NULL)
|
||||
frac = 1.0f - (dist / radius);
|
||||
|
||||
if (frac > 0)
|
||||
{
|
||||
if (P_PointOnLineSide(light->x, light->y, line) != side)
|
||||
if (line != NULL)
|
||||
{
|
||||
node = node->nextLight;
|
||||
continue;
|
||||
if (P_PointOnLineSide(light->x, light->y, line) != side)
|
||||
{
|
||||
node = node->nextLight;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
lr = light->GetRed() / 255.0f * gl_lights_intensity;
|
||||
lg = light->GetGreen() / 255.0f * gl_lights_intensity;
|
||||
lb = light->GetBlue() / 255.0f * gl_lights_intensity;
|
||||
if (light->IsSubtractive())
|
||||
{
|
||||
float bright = FVector3(lr, lg, lb).Length();
|
||||
FVector3 lightColor(lr, lg, lb);
|
||||
lr = (bright - lr) * -1;
|
||||
lg = (bright - lg) * -1;
|
||||
lb = (bright - lb) * -1;
|
||||
}
|
||||
|
||||
out[0] += lr * frac;
|
||||
out[1] += lg * frac;
|
||||
out[2] += lb * frac;
|
||||
changed = true;
|
||||
}
|
||||
lr = light->GetRed() / 255.0f * gl_lights_intensity;
|
||||
lg = light->GetGreen() / 255.0f * gl_lights_intensity;
|
||||
lb = light->GetBlue() / 255.0f * gl_lights_intensity;
|
||||
if (light->IsSubtractive())
|
||||
{
|
||||
float bright = FVector3(lr, lg, lb).Length();
|
||||
FVector3 lightColor(lr, lg, lb);
|
||||
lr = (bright - lr) * -1;
|
||||
lg = (bright - lg) * -1;
|
||||
lb = (bright - lb) * -1;
|
||||
}
|
||||
|
||||
out[0] += lr * frac;
|
||||
out[1] += lg * frac;
|
||||
out[2] += lb * frac;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue