Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/light/sample.h
| Show First 20 Lines • Show All 316 Lines • ▼ Show 20 Lines | |||||
| * | * | ||||
| * Sample a position on a light in the scene, from a position on a surface or | * Sample a position on a light in the scene, from a position on a surface or | ||||
| * from a volume segment. | * from a volume segment. | ||||
| * | * | ||||
| * Uses either a flat distribution or light tree. */ | * Uses either a flat distribution or light tree. */ | ||||
| ccl_device_inline bool light_sample_from_volume_segment(KernelGlobals kg, | ccl_device_inline bool light_sample_from_volume_segment(KernelGlobals kg, | ||||
| ccl_private const RNGState *rng_state, | ccl_private const RNGState *rng_state, | ||||
| const float randu, | float randu, | ||||
| const float randv, | const float randv, | ||||
| const float time, | const float time, | ||||
| const float3 P, | const float3 P, | ||||
| const float3 D, | const float3 D, | ||||
| const float t, | const float t, | ||||
| const int bounce, | const int bounce, | ||||
| const uint32_t path_flag, | const uint32_t path_flag, | ||||
| ccl_private LightSample *ls) | ccl_private LightSample *ls) | ||||
| { | { | ||||
| /* TODO: implement light tree support. */ | |||||
| #if 0 | |||||
| if (kernel_data.integrator.use_light_tree) { | if (kernel_data.integrator.use_light_tree) { | ||||
| return light_tree_sample<true>( | return light_tree_sample<true>(kg, | ||||
| kg, | |||||
| rng_state, | rng_state, | ||||
| randu, | randu, | ||||
| randv, | randv, | ||||
| time, | time, | ||||
| P, | P, | ||||
| D, | D, | ||||
| t, | t, | ||||
| SD_BSDF_HAS_TRANSMISSION, | SD_BSDF_HAS_TRANSMISSION, | ||||
| bounce, | bounce, | ||||
| path_flag, | path_flag, | ||||
| ls); | ls); | ||||
| } | } | ||||
| else { | else { | ||||
| #endif | |||||
| return light_distribution_sample<true>(kg, randu, randv, time, P, bounce, path_flag, ls); | return light_distribution_sample<true>(kg, randu, randv, time, P, bounce, path_flag, ls); | ||||
| #if 0 | |||||
| } | } | ||||
| #endif | |||||
| } | } | ||||
| ccl_device bool light_sample_from_position(KernelGlobals kg, | ccl_device bool light_sample_from_position(KernelGlobals kg, | ||||
| ccl_private const RNGState *rng_state, | ccl_private const RNGState *rng_state, | ||||
| const float randu, | const float randu, | ||||
| const float randv, | const float randv, | ||||
| const float time, | const float time, | ||||
| const float3 P, | const float3 P, | ||||
| const float3 N, | const float3 N, | ||||
| const int shader_flags, | const int shader_flags, | ||||
| const int bounce, | const int bounce, | ||||
| const uint32_t path_flag, | const uint32_t path_flag, | ||||
| ccl_private LightSample *ls) | ccl_private LightSample *ls) | ||||
| { | { | ||||
| if (kernel_data.integrator.use_light_tree) { | if (kernel_data.integrator.use_light_tree) { | ||||
| return light_tree_sample<false>( | return light_tree_sample<false>( | ||||
| kg, rng_state, randu, randv, time, P, N, shader_flags, bounce, path_flag, ls); | kg, rng_state, randu, randv, time, P, N, 0, shader_flags, bounce, path_flag, ls); | ||||
| } | } | ||||
| else { | else { | ||||
| return light_distribution_sample<false>(kg, randu, randv, time, P, bounce, path_flag, ls); | return light_distribution_sample<false>(kg, randu, randv, time, P, bounce, path_flag, ls); | ||||
| } | } | ||||
| } | } | ||||
| ccl_device_inline bool light_sample_new_position(KernelGlobals kg, | ccl_device_inline bool light_sample_new_position(KernelGlobals kg, | ||||
| const float randu, | const float randu, | ||||
| ▲ Show 20 Lines • Show All 139 Lines • Show Last 20 Lines | |||||