diff options
author | Aaron Carlisle <carlisle.b3d@gmail.com> | 2021-12-08 07:12:13 +0300 |
---|---|---|
committer | Aaron Carlisle <carlisle.b3d@gmail.com> | 2021-12-08 07:12:13 +0300 |
commit | b71e29b3dacb4c3071858cb8797e4a4879430392 (patch) | |
tree | 029a421e308415d8eed2242868bc5edf25033170 /intern/cycles | |
parent | 47b36ddccee07206b68db46b10320f5e69c48ef9 (diff) |
Cleanup: clang-format
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/kernel/camera/projection.h | 38 | ||||
-rw-r--r-- | intern/cycles/scene/camera.cpp | 4 |
2 files changed, 23 insertions, 19 deletions
diff --git a/intern/cycles/kernel/camera/projection.h b/intern/cycles/kernel/camera/projection.h index ddbe8ad5748..7b4e23e4ed0 100644 --- a/intern/cycles/kernel/camera/projection.h +++ b/intern/cycles/kernel/camera/projection.h @@ -146,16 +146,15 @@ fisheye_equisolid_to_direction(float u, float v, float lens, float fov, float wi return make_float3(cosf(theta), -cosf(phi) * sinf(theta), sinf(phi) * sinf(theta)); } -ccl_device_inline float3 -fisheye_lens_polynomial_to_direction(float u, float v, float coeff0, float4 coeffs, - float fov, float width, float height) +ccl_device_inline float3 fisheye_lens_polynomial_to_direction( + float u, float v, float coeff0, float4 coeffs, float fov, float width, float height) { u = (u - 0.5f) * width; v = (v - 0.5f) * height; float r = sqrtf(u * u + v * v); - float r2 = r*r; - float4 rr = make_float4(r, r2, r2*r, r2*r2); + float r2 = r * r; + float4 rr = make_float4(r, r2, r2 * r, r2 * r2); float theta = -(coeff0 + dot(coeffs, rr)); if (fabsf(theta) > 0.5f * fov) @@ -169,16 +168,16 @@ fisheye_lens_polynomial_to_direction(float u, float v, float coeff0, float4 coef return make_float3(cosf(theta), -cosf(phi) * sinf(theta), sinf(phi) * sinf(theta)); } -ccl_device float2 direction_to_fisheye_lens_polynomial(float3 dir, float coeff0, float4 coeffs, - float width, float height) +ccl_device float2 direction_to_fisheye_lens_polynomial( + float3 dir, float coeff0, float4 coeffs, float width, float height) { float theta = -safe_acosf(dir.x); float r = (theta - coeff0) / coeffs.x; - for (int i=0; i<20; i++) { - float r2 = r*r; - float4 rr = make_float4(r, r2, r2*r, r2*r2); + for (int i = 0; i < 20; i++) { + float r2 = r * r; + float4 rr = make_float4(r, r2, r2 * r, r2 * r2); r = (theta - (coeff0 + dot(coeffs, rr))) / coeffs.x; } @@ -190,7 +189,6 @@ ccl_device float2 direction_to_fisheye_lens_polynomial(float3 dir, float coeff0, return make_float2(u, v); } - /* Mirror Ball <-> Cartesion direction */ ccl_device float3 mirrorball_to_direction(float u, float v) @@ -237,9 +235,13 @@ ccl_device_inline float3 panorama_to_direction(ccl_constant KernelCamera *cam, f case PANORAMA_FISHEYE_EQUIDISTANT: return fisheye_to_direction(u, v, cam->fisheye_fov); case PANORAMA_FISHEYE_LENS_POLYNOMIAL: - return fisheye_lens_polynomial_to_direction( - u, v, cam->fisheye_lens_polynomial_bias, cam->fisheye_lens_polynomial_coefficients, cam->fisheye_fov, - cam->sensorwidth, cam->sensorheight); + return fisheye_lens_polynomial_to_direction(u, + v, + cam->fisheye_lens_polynomial_bias, + cam->fisheye_lens_polynomial_coefficients, + cam->fisheye_fov, + cam->sensorwidth, + cam->sensorheight); case PANORAMA_FISHEYE_EQUISOLID: default: return fisheye_equisolid_to_direction( @@ -257,9 +259,11 @@ ccl_device_inline float2 direction_to_panorama(ccl_constant KernelCamera *cam, f case PANORAMA_FISHEYE_EQUIDISTANT: return direction_to_fisheye(dir, cam->fisheye_fov); case PANORAMA_FISHEYE_LENS_POLYNOMIAL: - return direction_to_fisheye_lens_polynomial( - dir, cam->fisheye_lens_polynomial_bias, cam->fisheye_lens_polynomial_coefficients, - cam->sensorwidth, cam->sensorheight); + return direction_to_fisheye_lens_polynomial(dir, + cam->fisheye_lens_polynomial_bias, + cam->fisheye_lens_polynomial_coefficients, + cam->sensorwidth, + cam->sensorheight); case PANORAMA_FISHEYE_EQUISOLID: default: return direction_to_fisheye_equisolid( diff --git a/intern/cycles/scene/camera.cpp b/intern/cycles/scene/camera.cpp index 12e106779e3..2f3b55f887f 100644 --- a/intern/cycles/scene/camera.cpp +++ b/intern/cycles/scene/camera.cpp @@ -426,8 +426,8 @@ void Camera::update(Scene *scene) latitude_min - latitude_max, -latitude_min + M_PI_2_F); kcam->fisheye_lens_polynomial_bias = fisheye_polynomial_k0; - kcam->fisheye_lens_polynomial_coefficients = make_float4(fisheye_polynomial_k1, fisheye_polynomial_k2, - fisheye_polynomial_k3, fisheye_polynomial_k4); + kcam->fisheye_lens_polynomial_coefficients = make_float4( + fisheye_polynomial_k1, fisheye_polynomial_k2, fisheye_polynomial_k3, fisheye_polynomial_k4); switch (stereo_eye) { case STEREO_LEFT: |