Refactor: flatten light tree in recursive function #107560

Merged
Brecht Van Lommel merged 6 commits from brecht/blender:recursive-light-tree-flatten into main 2023-05-05 16:33:06 +02:00
1 changed files with 2 additions and 2 deletions
Showing only changes of commit 745ff1c3c9 - Show all commits

View File

@ -1077,8 +1077,8 @@ void LightManager::device_update_lights(Device *device, DeviceScene *dscene, Sce
float invarea = (light->normalize && area != 0.0f) ? 1.0f / area : 1.0f;
float3 dir = light->dir;
/* Clamp angles in (0, 0.1) to 0.1 to prevent zero intensity due to floating-point
* precision issues, but still handles spread = 0 */
/* Clamp angles in (0, 0.1) to 0.1 to prevent zero intensity due to floating-point precision
* issues, but still handles spread = 0 */
const float min_spread = 0.1f * M_PI_F / 180.0f;
const float half_spread = light->spread == 0 ? 0.0f : 0.5f * max(light->spread, min_spread);
const float tan_half_spread = light->spread == M_PI_F ? FLT_MAX : tanf(half_spread);