Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/scene.cpp
| Show First 20 Lines • Show All 521 Lines • ▼ Show 20 Lines | #endif | ||||
| kernel_features |= film->get_kernel_features(this); | kernel_features |= film->get_kernel_features(this); | ||||
| dscene.data.kernel_features = kernel_features; | dscene.data.kernel_features = kernel_features; | ||||
| /* Currently viewport render is faster with higher max_closures, needs investigating. */ | /* Currently viewport render is faster with higher max_closures, needs investigating. */ | ||||
| const uint max_closures = (params.background) ? get_max_closure_count() : MAX_CLOSURE; | const uint max_closures = (params.background) ? get_max_closure_count() : MAX_CLOSURE; | ||||
| dscene.data.max_closures = max_closures; | dscene.data.max_closures = max_closures; | ||||
| dscene.data.max_shaders = shaders.size(); | dscene.data.max_shaders = shaders.size(); | ||||
| dscene.data.volume_stack_size = get_volume_stack_size(); | |||||
| } | } | ||||
| bool Scene::update(Progress &progress) | bool Scene::update(Progress &progress) | ||||
| { | { | ||||
| if (!need_update()) { | if (!need_update()) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | VLOG(2) << "Maximum number of closures exceeded: " << max_closure_global << " > " | ||||
| << MAX_CLOSURE; | << MAX_CLOSURE; | ||||
| max_closure_global = MAX_CLOSURE; | max_closure_global = MAX_CLOSURE; | ||||
| } | } | ||||
| return max_closure_global; | return max_closure_global; | ||||
| } | } | ||||
| int Scene::get_volume_stack_size() const | |||||
| { | |||||
| /* Quick non-expensive check. Can over-estimate maximum possible nested level, but does not | |||||
| * require expensive calculation during pre-processing. */ | |||||
| int num_volume_objects = 0; | |||||
| for (const Object *object : objects) { | |||||
| if (object->check_is_volume()) { | |||||
| ++num_volume_objects; | |||||
| } | |||||
| if (num_volume_objects == MAX_VOLUME_STACK_SIZE) { | |||||
| break; | |||||
| } | |||||
| } | |||||
| /* Count background world for the stack. */ | |||||
| const Shader *background_shader = background->get_shader(this); | |||||
| if (background_shader && background_shader->has_volume_connected) { | |||||
| ++num_volume_objects; | |||||
| } | |||||
| /* Space for terminator. */ | |||||
| ++num_volume_objects; | |||||
| return min(num_volume_objects, MAX_VOLUME_STACK_SIZE); | |||||
| } | |||||
| bool Scene::has_shadow_catcher() | bool Scene::has_shadow_catcher() | ||||
| { | { | ||||
| if (shadow_catcher_modified_) { | if (shadow_catcher_modified_) { | ||||
| has_shadow_catcher_ = false; | has_shadow_catcher_ = false; | ||||
| for (Object *object : objects) { | for (Object *object : objects) { | ||||
| if (object->get_is_shadow_catcher()) { | if (object->get_is_shadow_catcher()) { | ||||
| has_shadow_catcher_ = true; | has_shadow_catcher_ = true; | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 260 Lines • Show Last 20 Lines | |||||