mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-28 15:57:59 +03:00
Fixed dynamic light shadows not being handled correctly
This commit is contained in:
parent
db2649e936
commit
7be096f86a
2 changed files with 15 additions and 14 deletions
|
@ -7,9 +7,9 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
|
|||
|
||||
### Bug fixes
|
||||
* Fixed two block platform room portal traversal failing in some cases.
|
||||
* Fixed dynamic light shadows not being handled correctly.
|
||||
|
||||
### New Features
|
||||
|
||||
* Added a particle based waterfall emitter object and associated sprite slots.
|
||||
- You must use this version: https://github.com/TombEngine/Resources/raw/refs/heads/main/Wad2%20Objects/Interactables/TEN_Waterfall_Emitter.wad2
|
||||
|
||||
|
|
|
@ -589,6 +589,13 @@ namespace TEN::Renderer
|
|||
float attenuation = 1.0f - distance / light.Out;
|
||||
float intensity = attenuation * light.Intensity * light.Luma;
|
||||
|
||||
// If collecting shadows, try collecting shadow-casting light.
|
||||
if (prioritizeShadowLight && light.CastShadows && intensity >= brightest)
|
||||
{
|
||||
brightest = intensity;
|
||||
brightestLight = &light;
|
||||
}
|
||||
|
||||
RendererLightNode node = { &light, intensity, distance, 1 };
|
||||
tempLights.push_back(node);
|
||||
}
|
||||
|
@ -635,13 +642,10 @@ namespace TEN::Renderer
|
|||
intensity = attenuation * light.Intensity * Luma(light.Color);
|
||||
|
||||
// If collecting shadows, try collecting shadow-casting light.
|
||||
if (light.CastShadows && prioritizeShadowLight && light.Type == LightType::Point)
|
||||
if (prioritizeShadowLight && light.CastShadows && light.Type == LightType::Point && intensity >= brightest)
|
||||
{
|
||||
if (intensity >= brightest)
|
||||
{
|
||||
brightest = intensity;
|
||||
brightestLight = &light;
|
||||
}
|
||||
brightest = intensity;
|
||||
brightestLight = &light;
|
||||
}
|
||||
}
|
||||
else if (light.Type == LightType::Spot)
|
||||
|
@ -660,14 +664,11 @@ namespace TEN::Renderer
|
|||
float attenuation = 1.0f - dist / light.Out;
|
||||
intensity = attenuation * light.Intensity * light.Luma;
|
||||
|
||||
// If shadow pointer provided, try collecting shadow-casting light.
|
||||
if (light.CastShadows && prioritizeShadowLight)
|
||||
// If collecting shadows, try collecting shadow-casting light.
|
||||
if (prioritizeShadowLight && light.CastShadows && intensity >= brightest)
|
||||
{
|
||||
if (intensity >= brightest)
|
||||
{
|
||||
brightest = intensity;
|
||||
brightestLight = &light;
|
||||
}
|
||||
brightest = intensity;
|
||||
brightestLight = &light;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue