From 9536f920e375cddbb83e55c53e50a3b8cab54ce6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 10 Jul 2018 09:29:30 +0200 Subject: Cleanup: style --- source/blender/blenkernel/intern/studiolight.c | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'source/blender/blenkernel/intern/studiolight.c') diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c index 468a961627e..dbe5228b6ea 100644 --- a/source/blender/blenkernel/intern/studiolight.c +++ b/source/blender/blenkernel/intern/studiolight.c @@ -120,7 +120,7 @@ static void studiolight_free(struct StudioLight *sl) STUDIOLIGHT_DELETE_ICON(sl->icon_id_matcap_flipped); #undef STUDIOLIGHT_DELETE_ICON - for (int index = 0 ; index < 6 ; index ++) { + for (int index = 0; index < 6; index++) { IMB_SAFE_FREE(sl->radiance_cubemap_buffers[index]); } GPU_TEXTURE_SAFE_FREE(sl->equirectangular_radiance_gputexture); @@ -152,7 +152,7 @@ static struct StudioLight *studiolight_create(int flag) sl->icon_id_irradiance = BKE_icon_ensure_studio_light(sl, STUDIOLIGHT_ICON_ID_TYPE_IRRADIANCE); } - for (int index = 0 ; index < 6 ; index ++) { + for (int index = 0; index < 6; index++) { sl->radiance_cubemap_buffers[index] = NULL; } @@ -193,9 +193,9 @@ static void studiolight_calculate_radiance_buffer( float xf; float *color = colbuf; - for (int y = 0; y < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; y ++, yf += add_y) { + for (int y = 0; y < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; y++, yf += add_y) { xf = start_x; - for (int x = 0; x < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; x ++, xf += add_x) { + for (int x = 0; x < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; x++, xf += add_x) { direction[index_x] = xf; direction[index_y] = yf; direction[index_z] = z; @@ -234,7 +234,7 @@ static void studiolight_create_equirectangular_radiance_gputexture(StudioLight * float *offset4 = ibuf->rect_float; float *offset3 = sl->gpu_matcap_3components; - for (int i = 0 ; i < ibuf->x * ibuf->y; i++) { + for (int i = 0; i < ibuf->x * ibuf->y; i++) { copy_v3_v3(offset3, offset4); offset3 += 3; offset4 += 4; @@ -336,8 +336,8 @@ BLI_INLINE void studiolight_evaluate_radiance_buffer( float angle; float *radiance_color = radiance_buffer->rect_float; float direction[3]; - for (int y = 0; y < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; y ++) { - for (int x = 0; x < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; x ++) { + for (int y = 0; y < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; y++) { + for (int x = 0; x < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; x++) { // calculate light direction; direction[zoffset] = zvalue; direction[xoffset] = (x / (float)STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE) - 0.5f; @@ -345,7 +345,7 @@ BLI_INLINE void studiolight_evaluate_radiance_buffer( normalize_v3(direction); angle = fmax(0.0f, dot_v3v3(direction, normal)); madd_v3_v3fl(color, radiance_color, angle); - (*hits) ++; + (*hits)++; radiance_color += 4; } } @@ -504,7 +504,7 @@ static void studiolight_calculate_spherical_harmonics_coefficient(StudioLight *s } case 11: { - coef = (0.9461746957575601f * nz * nx * (-1.0f +7.0f*ny2)) / -24.0f; + coef = (0.9461746957575601f * nz * nx * (-1.0f + 7.0f * ny2)) / -24.0f; break; } case 12: @@ -514,7 +514,7 @@ static void studiolight_calculate_spherical_harmonics_coefficient(StudioLight *s } case 13: { - coef = ((105.0f*ny4-90.0f*ny2+9.0f)/28.359261614f) / -24.0f; + coef = ((105.0f * ny4 - 90.0f * ny2 + 9.0f) / 28.359261614f) / -24.0f; break; } case 14: @@ -621,7 +621,7 @@ static void studiolight_apply_spherical_harmonics_windowing(StudioLight *sl, flo /* Apply windowing lambda */ index = 0; - for (int level = 0; level <= STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL; level ++) { + for (int level = 0; level <= STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL; level++) { float s = 1.0f / (1.0f + lambda * SQUARE(level) * SQUARE(level + 1.0f)); for (int m = -1; m <= level; m++) { @@ -666,9 +666,9 @@ BLI_INLINE void studiolight_sample_spherical_harmonics(StudioLight *sl, float co const float nz4 = SQUARE(nz2); madd_v3_v3fl(color, sl->spherical_harmonics_coefs[9], 2.5033429417967046f * nx * nz * (nx2 - nz2)); madd_v3_v3fl(color, sl->spherical_harmonics_coefs[10], -1.7701307697799304f * nz * ny * (3.0f * nx2 - nz2)); - madd_v3_v3fl(color, sl->spherical_harmonics_coefs[11], 0.9461746957575601f * nz * nx * (-1.0f + 7.0f*ny2)); + madd_v3_v3fl(color, sl->spherical_harmonics_coefs[11], 0.9461746957575601f * nz * nx * (-1.0f + 7.0f * ny2)); madd_v3_v3fl(color, sl->spherical_harmonics_coefs[12], -0.6690465435572892f * nz * ny * (-3.0f + 7.0f * ny2)); - madd_v3_v3fl(color, sl->spherical_harmonics_coefs[13], (105.0f*ny4-90.0f*ny2+9.0f)/28.359261614f); + madd_v3_v3fl(color, sl->spherical_harmonics_coefs[13], (105.0f * ny4 - 90.0f * ny2 + 9.0f) / 28.359261614f); madd_v3_v3fl(color, sl->spherical_harmonics_coefs[14], -0.6690465435572892f * nx * ny * (-3.0f + 7.0f * ny2)); madd_v3_v3fl(color, sl->spherical_harmonics_coefs[15], 0.9461746957575601f * (nx2 - nz2) * (-1.0f + 7.0f * ny2)); madd_v3_v3fl(color, sl->spherical_harmonics_coefs[16], -1.7701307697799304f * nx * ny * (nx2 - 3.0f * nz2)); @@ -683,7 +683,7 @@ static void studiolight_calculate_diffuse_light(StudioLight *sl) if (sl->flag & STUDIOLIGHT_EXTERNAL_FILE) { BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_RADIANCE_BUFFERS_CALCULATED); - for (int comp = 0; comp < STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS; comp ++) { + for (int comp = 0; comp < STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS; comp++) { studiolight_calculate_spherical_harmonics_coefficient(sl, comp); } @@ -705,8 +705,8 @@ static void studiolight_calculate_diffuse_light(StudioLight *sl) static float texel_coord_solid_angle(float a_U, float a_V, int a_Size) { //scale up to [-1, 1] range (inclusive), offset by 0.5 to point to texel center. - float u = (2.0f * ((float)a_U + 0.5f) / (float)a_Size ) - 1.0f; - float v = (2.0f * ((float)a_V + 0.5f) / (float)a_Size ) - 1.0f; + float u = (2.0f * ((float)a_U + 0.5f) / (float)a_Size) - 1.0f; + float v = (2.0f * ((float)a_V + 0.5f) / (float)a_Size) - 1.0f; float resolution_inv = 1.0f / a_Size; @@ -729,8 +729,8 @@ BLI_INLINE void studiolight_evaluate_specular_radiance_buffer( float angle; float *radiance_color = radiance_buffer->rect_float; float direction[3]; - for (int y = 0; y < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; y ++) { - for (int x = 0; x < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; x ++) { + for (int y = 0; y < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; y++) { + for (int x = 0; x < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; x++) { // calculate light direction; float u = (x / (float)STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE) - 0.5f; float v = (y / (float)STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE) - 0.5f; @@ -823,10 +823,10 @@ static void studiolight_calculate_irradiance_equirectangular_image(StudioLight * float *colbuf = MEM_mallocN(STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH * STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT * sizeof(float[4]), __func__); float *color = colbuf; - for (int y = 0; y < STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT ; y ++) { + for (int y = 0; y < STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT; y++) { float yf = y / (float)STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT; - for (int x = 0; x < STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH ; x ++) { + for (int x = 0; x < STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH; x++) { float xf = x / (float)STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH; float dir[3]; equirectangular_to_direction(dir, xf, yf); @@ -875,8 +875,8 @@ static void studiolight_calculate_light_direction(StudioLight *sl) /* go over every pixel, determine light, if higher calc direction off the light */ float new_light; float *color = ibuf->rect_float; - for (int y = 0; y < STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT; y ++) { - for (int x = 0; x < STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH; x ++) { + for (int y = 0; y < STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT; y++) { + for (int x = 0; x < STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH; x++) { new_light = color[0] + color[1] + color[2]; if (new_light > best_light) { float u = x / (float)STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH; -- cgit v1.2.3