diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-08-03 13:38:25 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-08-03 13:38:25 +0300 |
commit | 285e082a772f99fc09e52bcc8e8dd95f66431a60 (patch) | |
tree | d9b541fe3031ec8c207d7f23e8d77e8932af10be /intern/cycles/render/light.cpp | |
parent | 960db4c961da6c7faaa0b5fcdbba4d38c90ef298 (diff) |
Fix T49010: Portals don't work in recent Blender versions
Diffstat (limited to 'intern/cycles/render/light.cpp')
-rw-r--r-- | intern/cycles/render/light.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index ae6042cef34..4cd77f8c6e1 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -238,14 +238,19 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen /* count */ size_t num_lights = 0; + size_t num_portals = 0; size_t num_background_lights = 0; size_t num_triangles = 0; bool background_mis = false; foreach(Light *light, scene->lights) { - if(light->is_enabled) + if(light->is_enabled) { num_lights++; + } + if(light->is_portal) { + num_portals++; + } } foreach(Object *object, scene->objects) { @@ -435,9 +440,9 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen device->tex_alloc("__light_distribution", dscene->light_distribution); /* Portals */ - if(num_background_lights > 0 && light_index != num_lights) { + if(num_portals > 0) { kintegrator->portal_offset = light_index; - kintegrator->num_portals = num_lights - light_index; + kintegrator->num_portals = num_portals; kintegrator->portal_pdf = background_mis? 0.5f: 1.0f; } else { @@ -601,10 +606,10 @@ void LightManager::device_update_points(Device *device, Scene *scene) { int num_scene_lights = scene->lights.size(); - int num_lights = 0; + int num_lights = 0; foreach(Light *light, scene->lights) { - if(light->is_enabled) { + if(light->is_enabled || light->is_portal) { num_lights++; } } |