diff options
author | Thomas Dinges <blender@dingto.org> | 2013-05-12 18:13:29 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2013-05-12 18:13:29 +0400 |
commit | 7636aeffe1674ea2281869a0d81cbe20ee42e8b9 (patch) | |
tree | 61ab2f2c9bd74ff35d074e4f27a0885b6ac98a32 /intern/cycles/kernel/kernel_light.h | |
parent | 469979f9cb08640fbc00a43b59eee459460e74e1 (diff) |
Cycles / Math:
* Add M_2PI_F and M_4PI_F constants and use them inside the codebase.
Diffstat (limited to 'intern/cycles/kernel/kernel_light.h')
-rw-r--r-- | intern/cycles/kernel/kernel_light.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h index 88ee0155f5f..a4877acdc53 100644 --- a/intern/cycles/kernel/kernel_light.h +++ b/intern/cycles/kernel/kernel_light.h @@ -106,7 +106,7 @@ __device float3 background_light_sample(KernelGlobals *kg, float randu, float ra if(sin_theta == 0.0f || denom == 0.0f) *pdf = 0.0f; else - *pdf = (cdf_u.x * cdf_v.x)/(2.0f * M_PI_F * M_PI_F * sin_theta * denom); + *pdf = (cdf_u.x * cdf_v.x)/(M_2PI_F * M_PI_F * sin_theta * denom); *pdf *= kernel_data.integrator.pdf_lights; @@ -140,7 +140,7 @@ __device float background_light_pdf(KernelGlobals *kg, float3 direction) float2 cdf_u = kernel_tex_fetch(__light_background_conditional_cdf, index_v * (res + 1) + index_u); float2 cdf_v = kernel_tex_fetch(__light_background_marginal_cdf, index_v); - float pdf = (cdf_u.x * cdf_v.x)/(2.0f * M_PI_F * M_PI_F * sin_theta * denom); + float pdf = (cdf_u.x * cdf_v.x)/(M_2PI_F * M_PI_F * sin_theta * denom); return pdf * kernel_data.integrator.pdf_lights; } @@ -499,7 +499,7 @@ __device void curve_segment_light_sample(KernelGlobals *kg, int prim, int object float gd = ((r2 - r1)/l); /* normal currently ignores gradient */ - ls->Ng = sinf(2 * M_PI_F * randv) * xc + cosf(2 * M_PI_F * randv) * yc; + ls->Ng = sinf(M_2PI_F * randv) * xc + cosf(M_2PI_F * randv) * yc; ls->P = randu * l * tg + (gd * l + r1) * ls->Ng; ls->object = object; ls->prim = prim; |