diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-04-03 14:58:53 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-04-03 15:10:39 +0300 |
commit | 3b6eaf8d96bce59756f669e0c5105ae3bb31bef8 (patch) | |
tree | 3ef5cf7c91181651c53bcb7ed6694204abe2e80c | |
parent | fbcb92074893480aa7c2ec14357f1f1a62f63f6a (diff) |
Cleanup: style
-rw-r--r-- | source/blender/editors/screen/glutil.c | 44 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_batch.c | 34 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_gesture.c | 12 |
3 files changed, 44 insertions, 46 deletions
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 13e3fa2f50b..3108f965075 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -87,8 +87,7 @@ static void imm_draw_circle(PrimitiveType prim_type, unsigned pos, float x, floa immBegin(prim_type, nsegments); for (int i = 0; i < nsegments; ++i) { float angle = 2 * M_PI * ((float)i / (float)nsegments); - immVertex2f(pos, x + rad * cosf(angle), - y + rad * sinf(angle)); + immVertex2f(pos, x + rad * cosf(angle), y + rad * sinf(angle)); } immEnd(); } @@ -140,8 +139,7 @@ void imm_draw_lined_circle_3D(unsigned pos, float x, float y, float rad, int nse immBegin(PRIM_LINE_LOOP, nsegments); for (int i = 0; i < nsegments; ++i) { float angle = 2 * M_PI * ((float)i / (float)nsegments); - immVertex3f(pos, x + rad * cosf(angle), - y + rad * sinf(angle), 0.0f); + immVertex3f(pos, x + rad * cosf(angle), y + rad * sinf(angle), 0.0f); } immEnd(); } @@ -183,9 +181,9 @@ void imm_draw_checker_box(float x1, float y1, float x2, float y2) void imm_cpack(unsigned int x) { - immUniformColor3ub(((x)& 0xFF), - (((x) >> 8) & 0xFF), - (((x) >> 16) & 0xFF)); + immUniformColor3ub(((x) & 0xFF), + (((x) >> 8) & 0xFF), + (((x) >> 16) & 0xFF)); } void imm_cylinder_nor(unsigned int pos, unsigned int nor, float base, float top, float height, int slices, int stacks) @@ -193,7 +191,7 @@ void imm_cylinder_nor(unsigned int pos, unsigned int nor, float base, float top, immBegin(GL_TRIANGLES, 6 * slices * stacks); for (int i = 0; i < slices; ++i) { const float angle1 = 2 * M_PI * ((float)i / (float)slices); - const float angle2 = 2 * M_PI * ((float)(i+1) / (float)slices); + const float angle2 = 2 * M_PI * ((float)(i + 1) / (float)slices); const float cos1 = cosf(angle1); const float sin1 = sinf(angle1); const float cos2 = cosf(angle2); @@ -201,26 +199,26 @@ void imm_cylinder_nor(unsigned int pos, unsigned int nor, float base, float top, for (int j = 0; j < stacks; ++j) { float fac1 = (float)j / (float)stacks; - float fac2 = (float)(j+1) / (float)stacks; + float fac2 = (float)(j + 1) / (float)stacks; float r1 = base * (1.f - fac1) + top * fac1; float r2 = base * (1.f - fac2) + top * fac2; float h1 = height * ((float)j / (float)stacks); - float h2 = height * ((float)(j+1) / (float)stacks); + float h2 = height * ((float)(j + 1) / (float)stacks); - float v1[3] = {r1 * cos2, r1 * sin2, h1}; - float v2[3] = {r2 * cos2, r2 * sin2, h2}; - float v3[3] = {r2 * cos1, r2 * sin1, h2}; - float v4[3] = {r1 * cos1, r1 * sin1, h1}; + float v1[3] = {r1 *cos2, r1 * sin2, h1}; + float v2[3] = {r2 *cos2, r2 * sin2, h2}; + float v3[3] = {r2 *cos1, r2 * sin1, h2}; + float v4[3] = {r1 *cos1, r1 * sin1, h1}; float n1[3], n2[3]; /* calc normals */ sub_v3_v3v3(n1, v2, v1); normalize_v3(n1); - n1[0] = cos1; n1[1] = sin1; n1[2] = 1-n1[2]; + n1[0] = cos1; n1[1] = sin1; n1[2] = 1 - n1[2]; sub_v3_v3v3(n2, v3, v4); normalize_v3(n2); - n2[0] = cos2; n2[1] = sin2; n2[2] = 1-n2[2]; + n2[0] = cos2; n2[1] = sin2; n2[2] = 1 - n2[2]; /* first tri */ immAttrib3fv(nor, n2); @@ -244,7 +242,7 @@ void imm_cylinder_wire(unsigned int pos, float base, float top, float height, in immBegin(GL_LINES, 6 * slices * stacks); for (int i = 0; i < slices; ++i) { const float angle1 = 2 * M_PI * ((float)i / (float)slices); - const float angle2 = 2 * M_PI * ((float)(i+1) / (float)slices); + const float angle2 = 2 * M_PI * ((float)(i + 1) / (float)slices); const float cos1 = cosf(angle1); const float sin1 = sinf(angle1); const float cos2 = cosf(angle2); @@ -252,11 +250,11 @@ void imm_cylinder_wire(unsigned int pos, float base, float top, float height, in for (int j = 0; j < stacks; ++j) { float fac1 = (float)j / (float)stacks; - float fac2 = (float)(j+1) / (float)stacks; + float fac2 = (float)(j + 1) / (float)stacks; float r1 = base * (1.f - fac1) + top * fac1; float r2 = base * (1.f - fac2) + top * fac2; float h1 = height * ((float)j / (float)stacks); - float h2 = height * ((float)(j+1) / (float)stacks); + float h2 = height * ((float)(j + 1) / (float)stacks); float v1[3] = {r1 * cos2, r1 * sin2, h1}; float v2[3] = {r2 * cos2, r2 * sin2, h2}; @@ -295,10 +293,10 @@ void imm_cylinder(unsigned int pos, float base, float top, float height, int sli float h1 = height * ((float)j / (float)stacks); float h2 = height * ((float)(j + 1) / (float)stacks); - float v1[3] = { r1 * cos2, r1 * sin2, h1 }; - float v2[3] = { r2 * cos2, r2 * sin2, h2 }; - float v3[3] = { r2 * cos1, r2 * sin1, h2 }; - float v4[3] = { r1 * cos1, r1 * sin1, h1 }; + float v1[3] = {r1 * cos2, r1 * sin2, h1}; + float v2[3] = {r2 * cos2, r2 * sin2, h2}; + float v3[3] = {r2 * cos1, r2 * sin1, h2}; + float v4[3] = {r1 * cos1, r1 * sin1, h1}; /* first tri */ immVertex3fv(pos, v1); diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c index 19229cde7f0..65a827febde 100644 --- a/source/blender/gpu/intern/gpu_batch.c +++ b/source/blender/gpu/intern/gpu_batch.c @@ -31,7 +31,7 @@ #include "GPU_batch.h" #include "gpu_shader_private.h" -void Batch_set_builtin_program(Batch* batch, GPUBuiltinShader shader_id) +void Batch_set_builtin_program(Batch *batch, GPUBuiltinShader shader_id) { GPUShader *shader = GPU_shader_get_builtin_shader(shader_id); Batch_set_program(batch, shader->program); @@ -72,23 +72,23 @@ static Batch *batch_sphere(int lat_res, int lon_res) } vbo = VertexBuffer_create_with_format(&format); - VertexBuffer_allocate_data(vbo, (lat_res-1) * lon_res * 6); + VertexBuffer_allocate_data(vbo, (lat_res - 1) * lon_res * 6); vert = 0; lon = 0.0f; - for(int i = 0; i < lon_res; i++, lon += lon_inc) { + for (int i = 0; i < lon_res; i++, lon += lon_inc) { lat = 0.0f; - for(int j = 0; j < lat_res; j++, lat += lat_inc) { + for (int j = 0; j < lat_res; j++, lat += lat_inc) { if (j != lat_res - 1) { /* Pole */ - batch_sphere_lat_lon_vert(lat+lat_inc, lon+lon_inc); - batch_sphere_lat_lon_vert(lat+lat_inc, lon); - batch_sphere_lat_lon_vert(lat, lon); + batch_sphere_lat_lon_vert(lat + lat_inc, lon + lon_inc); + batch_sphere_lat_lon_vert(lat + lat_inc, lon); + batch_sphere_lat_lon_vert(lat, lon); } if (j != 0) { /* Pole */ - batch_sphere_lat_lon_vert(lat, lon+lon_inc); - batch_sphere_lat_lon_vert(lat+lat_inc, lon+lon_inc); - batch_sphere_lat_lon_vert(lat, lon); + batch_sphere_lat_lon_vert(lat, lon + lon_inc); + batch_sphere_lat_lon_vert(lat + lat_inc, lon + lon_inc); + batch_sphere_lat_lon_vert(lat, lon); } } } @@ -108,19 +108,19 @@ static Batch *batch_sphere_wire(int lat_res, int lon_res) } vbo = VertexBuffer_create_with_format(&format); - VertexBuffer_allocate_data(vbo, (lat_res * lon_res * 2) + ((lat_res-1) * lon_res * 2)); + VertexBuffer_allocate_data(vbo, (lat_res * lon_res * 2) + ((lat_res - 1) * lon_res * 2)); vert = 0; lon = 0.0f; - for(int i = 0; i < lon_res; i++, lon += lon_inc) { + for (int i = 0; i < lon_res; i++, lon += lon_inc) { lat = 0.0f; - for(int j = 0; j < lat_res; j++, lat += lat_inc) { - batch_sphere_lat_lon_vert(lat+lat_inc, lon); - batch_sphere_lat_lon_vert(lat, lon); + for (int j = 0; j < lat_res; j++, lat += lat_inc) { + batch_sphere_lat_lon_vert(lat + lat_inc, lon); + batch_sphere_lat_lon_vert(lat, lon); if (j != lat_res - 1) { /* Pole */ - batch_sphere_lat_lon_vert(lat+lat_inc, lon+lon_inc); - batch_sphere_lat_lon_vert(lat+lat_inc, lon); + batch_sphere_lat_lon_vert(lat + lat_inc, lon + lon_inc); + batch_sphere_lat_lon_vert(lat + lat_inc, lon); } } } diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index d4bbc4c7a61..30867a2bba4 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -171,7 +171,7 @@ static void wm_gesture_draw_line(wmGesture *gt) { rcti *rect = (rcti *)gt->customdata; - VertexFormat* format = immVertexFormat(); + VertexFormat *format = immVertexFormat(); unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); unsigned line_origin = add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT); @@ -219,7 +219,7 @@ static void wm_gesture_draw_rect(wmGesture *gt) { rcti *rect = (rcti *)gt->customdata; - VertexFormat* format = immVertexFormat(); + VertexFormat *format = immVertexFormat(); unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -290,7 +290,7 @@ static void wm_gesture_draw_circle(wmGesture *gt) glEnable(GL_BLEND); - VertexFormat* format = immVertexFormat(); + VertexFormat *format = immVertexFormat(); unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -406,11 +406,11 @@ static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled) } /* Nothing to drawe, do early output. */ - if(numverts < 2) { + if (numverts < 2) { return; } - VertexFormat* format = immVertexFormat(); + VertexFormat *format = immVertexFormat(); unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); unsigned line_origin = add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT); @@ -454,7 +454,7 @@ static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt) float x1, x2, y1, y2; - VertexFormat* format = immVertexFormat(); + VertexFormat *format = immVertexFormat(); unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); unsigned line_origin = add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT); |