[Bf-blender-cvs] [95f5272bda9] master: Cleanup: style, use braces in draw

Campbell Barton noreply at git.blender.org
Mon Jun 3 16:14:23 CEST 2019


Commit: 95f5272bda9e2824bb5e5ee8fd525029331eb5f5
Author: Campbell Barton
Date:   Tue Jun 4 00:13:11 2019 +1000
Branches: master
https://developer.blender.org/rB95f5272bda9e2824bb5e5ee8fd525029331eb5f5

Cleanup: style, use braces in draw

===================================================================

M	source/blender/draw/engines/eevee/eevee_materials.c
M	source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl
M	source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
M	source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl
M	source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl
M	source/blender/draw/modes/shaders/edit_curve_overlay_handle_geom.glsl

===================================================================

diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c
index 0c08082f50b..97b0f079500 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -225,26 +225,34 @@ static struct GPUTexture *create_ggx_refraction_lut_texture(int w, int h)
     fprintf(f, "\t{\n\t\t");
     for (int i = 0; i < w * h * 3; i += 3) {
       fprintf(f, "%ff,", data[i]);
-      if (((i / 3) + 1) % 12 == 0)
+      if (((i / 3) + 1) % 12 == 0) {
         fprintf(f, "\n\t\t");
-      else
+      }
+      else {
         fprintf(f, " ");
+      }
     }
     fprintf(f, "\n\t},\n");
 #  else
     for (int i = 0; i < w * h * 3; i += 3) {
-      if (data[i] < 0.01)
+      if (data[i] < 0.01) {
         printf(" ");
-      else if (data[i] < 0.3)
+      }
+      else if (data[i] < 0.3) {
         printf(".");
-      else if (data[i] < 0.6)
+      }
+      else if (data[i] < 0.6) {
         printf("+");
-      else if (data[i] < 0.9)
+      }
+      else if (data[i] < 0.9) {
         printf("%%");
-      else
+      }
+      else {
         printf("#");
-      if ((i / 3 + 1) % 64 == 0)
+      }
+      if ((i / 3 + 1) % 64 == 0) {
         printf("\n");
+      }
     }
 #  endif
 
diff --git a/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl b/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl
index 32076b47d8c..944caca6dab 100644
--- a/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl
@@ -232,8 +232,9 @@ void gtao(vec3 normal, vec3 position, vec4 noise, out float visibility, out vec3
  * Page 78 in the .pdf version. */
 float gtao_multibounce(float visibility, vec3 albedo)
 {
-  if (aoBounceFac == 0.0)
+  if (aoBounceFac == 0.0) {
     return visibility;
+  }
 
   /* Median luminance. Because Colored multibounce looks bad. */
   float lum = dot(albedo, vec3(0.3333));
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
index a5580e305d6..7d0ebe88aa4 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
@@ -104,6 +104,7 @@ void main()
   }
   */
 
-  if (fragColor.a < 0.0035)
+  if (fragColor.a < 0.0035) {
     discard;
+  }
 }
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl
index 9ea96806481..3300514dd13 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl
@@ -78,18 +78,23 @@ void main(void)
 
   /* culling outside viewport */
   vec2 area = Viewport * 4.0;
-  if (sp1.x < -area.x || sp1.x > area.x)
+  if (sp1.x < -area.x || sp1.x > area.x) {
     return;
-  if (sp1.y < -area.y || sp1.y > area.y)
+  }
+  if (sp1.y < -area.y || sp1.y > area.y) {
     return;
-  if (sp2.x < -area.x || sp2.x > area.x)
+  }
+  if (sp2.x < -area.x || sp2.x > area.x) {
     return;
-  if (sp2.y < -area.y || sp2.y > area.y)
+  }
+  if (sp2.y < -area.y || sp2.y > area.y) {
     return;
+  }
 
   /* culling behind camera */
-  if (P1.w < 0 || P2.w < 0)
+  if (P1.w < 0 || P2.w < 0) {
     return;
+  }
 
   /* determine the direction of each of the 3 segments (previous, current, next) */
   vec2 v0 = normalize(sp1 - sp0);
@@ -108,16 +113,20 @@ void main(void)
   /* determine the length of the miter by projecting it onto normal and then inverse it */
   float an1 = dot(miter_a, n1);
   float bn1 = dot(miter_b, n2);
-  if (an1 == 0)
+  if (an1 == 0) {
     an1 = 1;
-  if (bn1 == 0)
+  }
+  if (bn1 == 0) {
     bn1 = 1;
+  }
   float length_a = finalThickness[1] / an1;
   float length_b = finalThickness[2] / bn1;
-  if (length_a <= 0.0)
+  if (length_a <= 0.0) {
     length_a = 0.01;
-  if (length_b <= 0.0)
+  }
+  if (length_b <= 0.0) {
     length_b = 0.01;
+  }
 
   /* prevent excessively long miters at sharp corners */
   if (dot(v0, v1) < -MiterLimit) {
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl b/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl
index 5373648d4e4..8ee70c37949 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl
@@ -86,8 +86,9 @@ void main()
 #  ifndef DOUBLE_MANIFOLD
   /* If the mesh is known to be manifold and we don't use double count,
    * only create an quad if the we encounter a facing geom. */
-  if ((degen_faces.x && backface.y) || (degen_faces.y && backface.x))
+  if ((degen_faces.x && backface.y) || (degen_faces.y && backface.x)) {
     return;
+  }
 #  endif
 
   /* If one of the 2 triangles is degenerate, replace edge by a non-manifold one. */
diff --git a/source/blender/draw/modes/shaders/edit_curve_overlay_handle_geom.glsl b/source/blender/draw/modes/shaders/edit_curve_overlay_handle_geom.glsl
index 0a152cefaed..d5674e8f570 100644
--- a/source/blender/draw/modes/shaders/edit_curve_overlay_handle_geom.glsl
+++ b/source/blender/draw/modes/shaders/edit_curve_overlay_handle_geom.glsl
@@ -48,16 +48,21 @@ void main()
   bool edge_selected = (((vertFlag[1] | vertFlag[0]) & VERT_SELECTED) != 0);
 
   vec4 inner_color;
-  if (color_id == 0)
+  if (color_id == 0) {
     inner_color = (edge_selected) ? colorHandleSelFree : colorHandleFree;
-  else if (color_id == 1)
+  }
+  else if (color_id == 1) {
     inner_color = (edge_selected) ? colorHandleSelAuto : colorHandleAuto;
-  else if (color_id == 2)
+  }
+  else if (color_id == 2) {
     inner_color = (edge_selected) ? colorHandleSelVect : colorHandleVect;
-  else if (color_id == 3)
+  }
+  else if (color_id == 3) {
     inner_color = (edge_selected) ? colorHandleSelAlign : colorHandleAlign;
-  else if (color_id == 4)
+  }
+  else if (color_id == 4) {
     inner_color = (edge_selected) ? colorHandleSelAutoclamp : colorHandleAutoclamp;
+  }
   else {
     bool is_selected = (((vertFlag[1] & vertFlag[0]) & VERT_SELECTED) != 0);
     bool is_u_segment = (((vertFlag[1] ^ vertFlag[0]) & EVEN_U_BIT) != 0);



More information about the Bf-blender-cvs mailing list