Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/blender_light.cpp
| Show All 33 Lines | void BlenderSync::sync_light(BL::Object &b_parent, | ||||
| bool *use_portal) | bool *use_portal) | ||||
| { | { | ||||
| /* test if we need to sync */ | /* test if we need to sync */ | ||||
| Light *light; | Light *light; | ||||
| ObjectKey key(b_parent, persistent_id, b_ob_instance, false); | ObjectKey key(b_parent, persistent_id, b_ob_instance, false); | ||||
| BL::Light b_light(b_ob.data()); | BL::Light b_light(b_ob.data()); | ||||
| /* Update if either object or light data changed. */ | /* Update if either object or light data changed. */ | ||||
| if (!light_map.add_or_update(scene, &light, b_ob, b_parent, key)) { | if (!light_map.add_or_update(&light, b_ob, b_parent, key)) { | ||||
| Shader *shader; | Shader *shader; | ||||
| if (!shader_map.add_or_update(scene, &shader, b_light)) { | if (!shader_map.add_or_update(&shader, b_light)) { | ||||
| if (light->is_portal) | if (light->is_portal) | ||||
| *use_portal = true; | *use_portal = true; | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| /* type */ | /* type */ | ||||
| switch (b_light.type()) { | switch (b_light.type()) { | ||||
| ▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | if (b_world) { | ||||
| int sampling_method = get_enum(cworld, "sampling_method", SAMPLING_NUM, SAMPLING_AUTOMATIC); | int sampling_method = get_enum(cworld, "sampling_method", SAMPLING_NUM, SAMPLING_AUTOMATIC); | ||||
| bool sample_as_light = (sampling_method != SAMPLING_NONE); | bool sample_as_light = (sampling_method != SAMPLING_NONE); | ||||
| if (sample_as_light || use_portal) { | if (sample_as_light || 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, false); | ObjectKey key(b_world, 0, b_world, false); | ||||
| if (light_map.add_or_update(scene, &light, b_world, b_world, key) || world_recalc || | if (light_map.add_or_update(&light, b_world, b_world, key) || world_recalc || | ||||
| b_world.ptr.data != world_map) { | b_world.ptr.data != world_map) { | ||||
| light->type = LIGHT_BACKGROUND; | light->type = LIGHT_BACKGROUND; | ||||
| if (sampling_method == SAMPLING_MANUAL) { | if (sampling_method == SAMPLING_MANUAL) { | ||||
| light->map_resolution = get_int(cworld, "sample_map_resolution"); | light->map_resolution = get_int(cworld, "sample_map_resolution"); | ||||
| } | } | ||||
| else { | else { | ||||
| light->map_resolution = 0; | light->map_resolution = 0; | ||||
| } | } | ||||
| Show All 25 Lines | |||||