Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/blender_object.cpp
| Show First 20 Lines • Show All 221 Lines • ▼ Show 20 Lines | |||||
| void BlenderSync::sync_background_light(bool use_portal) | void BlenderSync::sync_background_light(bool use_portal) | ||||
| { | { | ||||
| BL::World b_world = b_scene.world(); | BL::World b_world = b_scene.world(); | ||||
| if(b_world) { | if(b_world) { | ||||
| PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles"); | PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles"); | ||||
| PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles"); | PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles"); | ||||
| bool sample_as_light = get_boolean(cworld, "sample_as_light"); | |||||
| if(sample_as_light || use_portal) { | enum SamplingType { | ||||
| SAMPLING_OFF = 0, | |||||
| SAMPLING_AUTOMATIC, | |||||
| SAMPLING_MANUAL, | |||||
| SAMPLING_NUM | |||||
| }; | |||||
| int sampling_type = get_enum(cworld, "sampling_type", SAMPLING_NUM, SAMPLING_AUTOMATIC); | |||||
| bool do_sample = (sampling_type != SAMPLING_OFF); | |||||
| if(do_sample || use_portal) { | |||||
| /* test if we need to sync */ | /* test if we need to sync */ | ||||
| Light *light; | Light *light; | ||||
| ObjectKey key(b_world, 0, b_world); | ObjectKey key(b_world, 0, b_world); | ||||
| if(light_map.sync(&light, b_world, b_world, key) || | if(light_map.sync(&light, b_world, b_world, key) || | ||||
| world_recalc || | world_recalc || | ||||
| b_world.ptr.data != world_map) | b_world.ptr.data != world_map) | ||||
| { | { | ||||
| light->type = LIGHT_BACKGROUND; | light->type = LIGHT_BACKGROUND; | ||||
| if(sampling_type == SAMPLING_MANUAL) { | |||||
| light->map_resolution = get_int(cworld, "sample_map_resolution"); | light->map_resolution = get_int(cworld, "sample_map_resolution"); | ||||
| } | |||||
| else { | |||||
| light->map_resolution = 0; | |||||
| } | |||||
| light->shader = scene->default_background; | light->shader = scene->default_background; | ||||
| light->use_mis = sample_as_light; | light->use_mis = do_sample; | ||||
| light->max_bounces = get_int(cworld, "max_bounces"); | light->max_bounces = get_int(cworld, "max_bounces"); | ||||
| int samples = get_int(cworld, "samples"); | int samples = get_int(cworld, "samples"); | ||||
| if(get_boolean(cscene, "use_square_samples")) | if(get_boolean(cscene, "use_square_samples")) | ||||
| light->samples = samples * samples; | light->samples = samples * samples; | ||||
| else | else | ||||
| light->samples = samples; | light->samples = samples; | ||||
| ▲ Show 20 Lines • Show All 492 Lines • Show Last 20 Lines | |||||