Cycles code refactor: deduplicate and symmetrize some path tracing code.

This commit is contained in:
Brecht Van Lommel
2014-04-04 14:21:35 +02:00
parent 5ab565283d
commit 51a1d6481b
2 changed files with 202 additions and 328 deletions

View File

@@ -69,7 +69,9 @@ ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadian
path_radiance_accum_emission(&L_sample, throughput, emission, state.bounce);
}
if(kernel_path_integrate_lighting(kg, &rng, sd, &throughput, &state, &L_sample, &ray)) {
kernel_path_surface_connect_light(kg, &rng, sd, throughput, &state, &L_sample);
if(kernel_path_surface_bounce(kg, &rng, sd, &throughput, &state, &L_sample, &ray)) {
#ifdef __LAMP_MIS__
state.ray_t = 0.0f;
#endif
@@ -107,7 +109,17 @@ ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadian
path_radiance_accum_emission(&L_sample, throughput, emission, state.bounce);
}
kernel_branched_path_integrate_lighting(kg, &rng,
#if defined(__EMISSION__)
/* direct light */
if(kernel_data.integrator.use_direct_light) {
bool all = kernel_data.integrator.sample_all_lights_direct;
kernel_branched_path_surface_connect_light(kg, &rng,
sd, &state, throughput, 1.0f, &L_sample, all);
}
#endif
/* indirect light */
kernel_branched_path_surface_indirect_light(kg, &rng,
sd, throughput, 1.0f, &state, &L_sample);
}
}