Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/scene/background.cpp
| /* SPDX-License-Identifier: Apache-2.0 | /* SPDX-License-Identifier: Apache-2.0 | ||||
| * Copyright 2011-2022 Blender Foundation */ | * Copyright 2011-2022 Blender Foundation */ | ||||
| #include "scene/background.h" | #include "scene/background.h" | ||||
| #include "device/device.h" | #include "device/device.h" | ||||
| #include "scene/integrator.h" | #include "scene/integrator.h" | ||||
| #include "scene/light.h" | |||||
| #include "scene/scene.h" | #include "scene/scene.h" | ||||
| #include "scene/shader.h" | #include "scene/shader.h" | ||||
| #include "scene/shader_graph.h" | #include "scene/shader_graph.h" | ||||
| #include "scene/shader_nodes.h" | #include "scene/shader_nodes.h" | ||||
| #include "scene/stats.h" | #include "scene/stats.h" | ||||
| #include "util/foreach.h" | #include "util/foreach.h" | ||||
| #include "util/math.h" | #include "util/math.h" | ||||
| ▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | else { | ||||
| if (!(visibility & PATH_RAY_TRANSMIT)) | if (!(visibility & PATH_RAY_TRANSMIT)) | ||||
| kbackground->surface_shader |= SHADER_EXCLUDE_TRANSMIT; | kbackground->surface_shader |= SHADER_EXCLUDE_TRANSMIT; | ||||
| if (!(visibility & PATH_RAY_VOLUME_SCATTER)) | if (!(visibility & PATH_RAY_VOLUME_SCATTER)) | ||||
| kbackground->surface_shader |= SHADER_EXCLUDE_SCATTER; | kbackground->surface_shader |= SHADER_EXCLUDE_SCATTER; | ||||
| if (!(visibility & PATH_RAY_CAMERA)) | if (!(visibility & PATH_RAY_CAMERA)) | ||||
| kbackground->surface_shader |= SHADER_EXCLUDE_CAMERA; | kbackground->surface_shader |= SHADER_EXCLUDE_CAMERA; | ||||
| } | } | ||||
| /* Find background index in lights. */ | |||||
| int device_light_index = 0; | |||||
| int background_light_index = -1; | |||||
| foreach (Light *light, scene->lights) { | |||||
| if (light->get_is_enabled()) { | |||||
| if (light->get_light_type() == LIGHT_BACKGROUND) { | |||||
| background_light_index = device_light_index; | |||||
| } | |||||
| device_light_index++; | |||||
| } | |||||
| } | |||||
| kbackground->light_index = background_light_index; | |||||
| /* Light group. */ | /* Light group. */ | ||||
| auto it = scene->lightgroups.find(lightgroup); | auto it = scene->lightgroups.find(lightgroup); | ||||
| if (it != scene->lightgroups.end()) { | if (it != scene->lightgroups.end()) { | ||||
| kbackground->lightgroup = it->second; | kbackground->lightgroup = it->second; | ||||
| } | } | ||||
| else { | else { | ||||
| kbackground->lightgroup = LIGHTGROUP_NONE; | kbackground->lightgroup = LIGHTGROUP_NONE; | ||||
| } | } | ||||
| Show All 25 Lines | |||||