diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-08-05 18:22:07 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-08-05 18:22:07 +0400 |
commit | d01fbce3bbe03814211c4f283ab08bffa05ae20d (patch) | |
tree | d3d4cee012fc97e5eafee64ae416c47c0204c70a /intern | |
parent | 3bf175f27047d9b6894327e5ea7216110288aaa2 (diff) |
Fix #36380: cycles render error with sun lamp that has object scale 0,0,0.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/render/light.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 8b831c25d28..96eabe75ff7 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -517,7 +517,6 @@ void LightManager::device_update_points(Device *device, DeviceScene *dscene, Sce for(size_t i = 0; i < scene->lights.size(); i++) { Light *light = scene->lights[i]; float3 co = light->co; - float3 dir = normalize(light->dir); int shader_id = scene->shader_manager->get_shader_id(scene->lights[i]->shader); float samples = __int_as_float(light->samples); @@ -559,6 +558,10 @@ void LightManager::device_update_points(Device *device, DeviceScene *dscene, Sce float cosangle = cosf(angle); float area = M_PI_F*radius*radius; float invarea = (area > 0.0f)? 1.0f/area: 1.0f; + float3 dir = light->dir; + + if(len(dir) > 0.0f) + dir = normalize(dir); if(light->use_mis && area > 0.0f) shader_id |= SHADER_USE_MIS; @@ -597,6 +600,10 @@ void LightManager::device_update_points(Device *device, DeviceScene *dscene, Sce float3 axisv = light->axisv*(light->sizev*light->size); float area = len(axisu)*len(axisv); float invarea = (area > 0.0f)? 1.0f/area: 1.0f; + float3 dir = light->dir; + + if(len(dir) > 0.0f) + dir = normalize(dir); if(light->use_mis && area > 0.0f) shader_id |= SHADER_USE_MIS; @@ -613,6 +620,10 @@ void LightManager::device_update_points(Device *device, DeviceScene *dscene, Sce float invarea = (radius > 0.0f)? 1.0f/(M_PI_F*radius*radius): 1.0f; float spot_angle = cosf(light->spot_angle*0.5f); float spot_smooth = (1.0f - spot_angle)*light->spot_smooth; + float3 dir = light->dir; + + if(len(dir) > 0.0f) + dir = normalize(dir); if(light->use_mis && radius > 0.0f) shader_id |= SHADER_USE_MIS; |