Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/render/light.cpp')
-rw-r--r--intern/cycles/render/light.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index cd19b03ac53..cb7474017fa 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -120,6 +120,7 @@ NODE_DEFINE(Light)
SOCKET_VECTOR(dir, "Dir", make_float3(0.0f, 0.0f, 0.0f));
SOCKET_FLOAT(size, "Size", 0.0f);
+ SOCKET_FLOAT(angle, "Angle", 0.0f);
SOCKET_VECTOR(axisu, "Axis U", make_float3(0.0f, 0.0f, 0.0f));
SOCKET_FLOAT(sizeu, "Size U", 1.0f);
@@ -183,6 +184,8 @@ LightManager::LightManager()
need_update = true;
need_update_background = true;
use_light_visibility = false;
+ last_background_enabled = false;
+ last_background_resolution = 0;
}
LightManager::~LightManager()
@@ -202,7 +205,7 @@ bool LightManager::has_background_light(Scene *scene)
return false;
}
-void LightManager::disable_ineffective_light(Scene *scene)
+void LightManager::test_enabled_lights(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
@@ -215,6 +218,9 @@ void LightManager::disable_ineffective_light(Scene *scene)
has_background |= light->type == LIGHT_BACKGROUND;
}
+ bool background_enabled = false;
+ int background_resolution = 0;
+
if (has_background) {
/* Ignore background light if:
* - If unsupported on a device
@@ -226,9 +232,18 @@ void LightManager::disable_ineffective_light(Scene *scene)
foreach (Light *light, scene->lights) {
if (light->type == LIGHT_BACKGROUND) {
light->is_enabled = !disable_mis;
+ background_enabled = !disable_mis;
+ background_resolution = light->map_resolution;
}
}
}
+
+ if (last_background_enabled != background_enabled ||
+ last_background_resolution != background_resolution) {
+ last_background_enabled = background_enabled;
+ last_background_resolution = background_resolution;
+ need_update_background = true;
+ }
}
bool LightManager::object_usable_as_light(Object *object)
@@ -902,12 +917,13 @@ void LightManager::device_update(Device *device,
VLOG(1) << "Total " << scene->lights.size() << " lights.";
+ /* Detect which lights are enabled, also determins if we need to update the background. */
+ test_enabled_lights(scene);
+
device_free(device, dscene, need_update_background);
use_light_visibility = false;
- disable_ineffective_light(scene);
-
device_update_points(device, dscene, scene);
if (progress.get_cancel())
return;