Merge branch 'blender2.7'
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 18 Mar 2019 11:03:22 +0000 (12:03 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 18 Mar 2019 11:03:22 +0000 (12:03 +0100)
1  2 
intern/cycles/render/light.cpp

index 755b941717e6e83c3a66987c1cd9d4448237e05b,7101d2ab60c9c6a3d158ade8996e70941718c6fd..ac41fce96d77edaf648ed838757fd9fce8f1bd8f
@@@ -118,7 -118,6 +118,7 @@@ NODE_DEFINE(Light
        SOCKET_FLOAT(sizeu, "Size U", 1.0f);
        SOCKET_VECTOR(axisv, "Axis V", make_float3(0.0f, 0.0f, 0.0f));
        SOCKET_FLOAT(sizev, "Size V", 1.0f);
 +      SOCKET_BOOLEAN(round, "Round", false);
  
        SOCKET_INT(map_resolution, "Map Resolution", 0);
  
@@@ -192,7 -191,7 +192,7 @@@ bool LightManager::has_background_light
        return false;
  }
  
- void LightManager::disable_ineffective_light(Device *device, Scene *scene)
+ void LightManager::disable_ineffective_light(Device * /*device*/, Scene *scene)
  {
        /* Make all lights enabled by default, and perform some preliminary checks
         * needed for finer-tuning of settings (for example, check whether we've
@@@ -757,15 -756,12 +757,15 @@@ void LightManager::device_update_points
                        float3 axisu = light->axisu*(light->sizeu*light->size);
                        float3 axisv = light->axisv*(light->sizev*light->size);
                        float area = len(axisu)*len(axisv);
 -                      float invarea = (area > 0.0f)? 1.0f/area: 1.0f;
 +                      if(light->round) {
 +                              area *= -M_PI_4_F;
 +                      }
 +                      float invarea = (area != 0.0f)? 1.0f/area: 1.0f;
                        float3 dir = light->dir;
  
                        dir = safe_normalize(dir);
  
 -                      if(light->use_mis && area > 0.0f)
 +                      if(light->use_mis && area != 0.0f)
                                shader_id |= SHADER_USE_MIS;
  
                        klights[light_index].co[0] = co.x;
                float3 axisu = light->axisu*(light->sizeu*light->size);
                float3 axisv = light->axisv*(light->sizev*light->size);
                float area = len(axisu)*len(axisv);
 -              float invarea = (area > 0.0f)? 1.0f/area: 1.0f;
 +              if(light->round) {
 +                      area *= -M_PI_4_F;
 +              }
 +              float invarea = (area != 0.0f)? 1.0f/area: 1.0f;
                float3 dir = light->dir;
  
                dir = safe_normalize(dir);