Skip to content

Commit

Permalink
Allow setting a dynamic light's alpha to influence its brightness. Th…
Browse files Browse the repository at this point in the history
…is brings it in parity with VKDoom
  • Loading branch information
nashmuhandes authored and madame-rachelle committed Dec 26, 2024
1 parent d3e5cf7 commit a4e5279
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/rendering/hwrenderer/hw_dynlightdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ void AddLightToList(FDynLightData &dld, int group, FDynamicLight * light, bool f
cs = 1.0f;
}

if (light->target)
cs *= (float)light->target->Alpha;

float r = light->GetRed() / 255.0f * cs;
float g = light->GetGreen() / 255.0f * cs;
float b = light->GetBlue() / 255.0f * cs;
Expand Down
9 changes: 9 additions & 0 deletions src/rendering/hwrenderer/scene/hw_spritelight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,15 @@ void HWDrawInfo::GetDynSpriteLight(AActor *self, float x, float y, float z, FLig
lr = light->GetRed() / 255.0f;
lg = light->GetGreen() / 255.0f;
lb = light->GetBlue() / 255.0f;

if (light->target)
{
float alpha = (float)light->target->Alpha;
lr *= alpha;
lg *= alpha;
lb *= alpha;
}

if (light->IsSubtractive())
{
float bright = (float)FVector3(lr, lg, lb).Length();
Expand Down

0 comments on commit a4e5279

Please sign in to comment.