diff options
Diffstat (limited to 'intern/cycles/util/util_math.h')
-rw-r--r-- | intern/cycles/util/util_math.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h index 53944ec1cc4..cfe6fa65143 100644 --- a/intern/cycles/util/util_math.h +++ b/intern/cycles/util/util_math.h @@ -545,6 +545,11 @@ ccl_device_inline float3 normalize(const float3 a) #endif +ccl_device_inline float3 saturate3(float3 a) +{ + return make_float3(saturate(a.x), saturate(a.y), saturate(a.z)); +} + ccl_device_inline float3 normalize_len(const float3 a, float *t) { *t = len(a); @@ -1329,6 +1334,15 @@ ccl_device float safe_modulo(float a, float b) return (b != 0.0f)? fmodf(a, b): 0.0f; } +ccl_device_inline float beta(float x, float y) +{ +#ifndef __KERNEL_OPENCL__ + return expf(lgammaf(x) + lgammaf(y) - lgammaf(x+y)); +#else + return expf(lgamma(x) + lgamma(y) - lgamma(x+y)); +#endif +} + /* Ray Intersection */ ccl_device bool ray_sphere_intersect( |