diff options
author | Thomas Dinges <blender@dingto.org> | 2014-09-15 16:22:39 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2014-09-15 16:22:39 +0400 |
commit | 03ce9882afa34873a8e3ea0e56d2a9ddc294e607 (patch) | |
tree | 4b4afffa8b4d3eb75836a32764c02b8a7c2e319b /intern | |
parent | e5adeed40be1603be912938e340415eb4bf55585 (diff) |
Fix T41839, OpenCL error.
Also some style fixes, we don't do the "put as much as possible in 1 line" contest.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/util/util_math.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h index 1cd8883a5c7..1e8d8f37d1e 100644 --- a/intern/cycles/util/util_math.h +++ b/intern/cycles/util/util_math.h @@ -1418,10 +1418,12 @@ ccl_device bool map_to_sphere(float *r_u, float *r_v, const float x, const float y, const float z) { float len = sqrtf(x * x + y * y + z * z); - if (len > 0.0f) { - if (x == 0.0f && y == 0.0f) *r_u = 0.0f; /* othwise domain error */ - else *r_u = (1.0f - atan2f(x, y) / (float)M_PI) / 2.0f; - *r_v = 1.0f - safe_acosf(z / len) / (float)M_PI; + if(len > 0.0f) { + if(x == 0.0f && y == 0.0f) + *r_u = 0.0f; /* othwise domain error */ + else + *r_u = (1.0f - atan2f(x, y) / M_PI_F) / 2.0f; + *r_v = 1.0f - safe_acosf(z / len) / M_PI_F; return true; } else { |