Cleanup: sync map_to_sphere, UNLIKELY xy zero case
This commit is contained in:
@@ -1419,10 +1419,12 @@ ccl_device bool map_to_sphere(float *r_u, float *r_v,
|
||||
{
|
||||
float len = sqrtf(x * x + y * y + z * z);
|
||||
if(len > 0.0f) {
|
||||
if(x == 0.0f && y == 0.0f)
|
||||
if(UNLIKELY(x == 0.0f && y == 0.0f)) {
|
||||
*r_u = 0.0f; /* othwise domain error */
|
||||
else
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user