Eevee: Opti: Don't consider lights that have no power

This may be usefull if power is animated ans is to be activated at one
particular point in time.
This commit is contained in:
Clément Foucault 2019-03-23 19:18:51 +01:00
parent b40aa83910
commit 839fe4e01c
1 changed files with 6 additions and 1 deletions

View File

@ -336,13 +336,18 @@ void EEVEE_lights_cache_add(EEVEE_ViewLayerData *sldata, Object *ob)
const DRWContextState *draw_ctx = DRW_context_state_get();
const float threshold = draw_ctx->scene->eevee.light_threshold;
/* Step 1 find all lights in the scene and setup them */
if (linfo->num_light >= MAX_LIGHT) {
printf("Too many lights in the scene !!!\n");
}
else {
Light *la = (Light *)ob->data;
/* Early out if light has no power. */
if (la->energy == 0.0f || is_zero_v3(&la->r)) {
return;
}
EEVEE_Light *evli = linfo->light_data + linfo->num_light;
eevee_light_setup(ob, evli);