diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-24 23:10:13 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-24 23:12:13 +0300 |
commit | a4fe338dd8c6822d27b8858bae5fa9a54972719c (patch) | |
tree | 9a6b671702a7cf41e98efef72e78c7cc54974111 /source/blender/draw/engines/workbench | |
parent | b1f3a86d999b6742d783de5a11d7de0c54cf5891 (diff) |
Cleanup: add missing braces to draw manager
Diffstat (limited to 'source/blender/draw/engines/workbench')
6 files changed, 24 insertions, 12 deletions
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl index 7b77139fb6c..998517e2e72 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl @@ -9,8 +9,9 @@ void ssao_factors( { cavities = edges = 0.0; /* early out if there is no need for SSAO */ - if (ssao_factor_cavity == 0.0 && ssao_factor_edge == 0.0) + if (ssao_factor_cavity == 0.0 && ssao_factor_edge == 0.0) { return; + } /* take the normalized ray direction here */ vec3 noise = texture(ssao_jitter, screenco.xy * jitter_tilling).rgb; @@ -45,8 +46,9 @@ void ssao_factors( vec2 uvcoords = screenco.xy + dir_jittered * offset; - if (uvcoords.x > 1.0 || uvcoords.x < 0.0 || uvcoords.y > 1.0 || uvcoords.y < 0.0) + if (uvcoords.x > 1.0 || uvcoords.x < 0.0 || uvcoords.y > 1.0 || uvcoords.y < 0.0) { continue; + } float depth_new = texture(depthBuffer, uvcoords).r; @@ -56,8 +58,9 @@ void ssao_factors( /* This trick provide good edge effect even if no neighboor is found. */ vec3 pos_new = get_view_space_from_depth(uvcoords, (is_background) ? depth : depth_new); - if (is_background) + if (is_background) { pos_new.z -= ssao_distance; + } vec3 dir = pos_new - position; float len = length(dir); @@ -68,11 +71,13 @@ void ssao_factors( float attenuation = 1.0 / (len * (1.0 + len * len * ssao_attenuation)); /* use minor bias here to avoid self shadowing */ - if (f_cavities > -f_bias) + if (f_cavities > -f_bias) { cavities += f_cavities * attenuation; + } - if (f_edge > f_bias) + if (f_edge > f_bias) { edges += f_edge * attenuation; + } } cavities /= ssao_samples_num; diff --git a/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl index ce8988de4a5..5f3dbd75b15 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl @@ -144,10 +144,12 @@ vec2 matcap_uv_compute(vec3 I, vec3 N, bool flipped) float srgb_to_linearrgb(float c) { - if (c < 0.04045) + if (c < 0.04045) { return (c < 0.0) ? 0.0 : c * (1.0 / 12.92); - else + } + else { return pow((c + 0.055) * (1.0 / 1.055), 2.4); + } } vec4 srgb_to_linearrgb(vec4 col_from) 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 a2f23fbf3dc..14f47556896 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl @@ -64,8 +64,9 @@ void main() bvec2 degen_faces = lessThan(abs(faces_area), vec2(DEGENERATE_THRESHOLD)); /* Both triangles are degenerate, abort. */ - if (all(degen_faces)) + if (all(degen_faces)) { return; + } #endif vec2 facing = vec2(dot(n1, lightDirection), @@ -92,8 +93,9 @@ void main() #endif /* If both faces face the same direction it's not an outline edge. */ - if (backface.x == backface.y) + if (backface.x == backface.y) { return; + } #ifdef USE_INVOC_EXT if (gl_InvocationID == 0) { diff --git a/source/blender/draw/engines/workbench/workbench_data.c b/source/blender/draw/engines/workbench/workbench_data.c index b5e55d157d0..2fdec4cf8fc 100644 --- a/source/blender/draw/engines/workbench/workbench_data.c +++ b/source/blender/draw/engines/workbench/workbench_data.c @@ -169,8 +169,9 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd) /* normalized trick see: * http://www.derschmale.com/2014/01/26/reconstructing-positions-from-the-depth-buffer */ mul_v3_fl(viewvecs[i], 1.0f / viewvecs[i][3]); - if (is_persp) + if (is_persp) { mul_v3_fl(viewvecs[i], 1.0f / viewvecs[i][2]); + } viewvecs[i][3] = 1.0; copy_v4_v4(wpd->viewvecs[i], viewvecs[i]); diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c index ac473dbdf7d..b48e64293fa 100644 --- a/source/blender/draw/engines/workbench/workbench_deferred.c +++ b/source/blender/draw/engines/workbench/workbench_deferred.c @@ -813,8 +813,9 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob) const DRWContextState *draw_ctx = DRW_context_state_get(); Scene *scene = draw_ctx->scene; - if (!DRW_object_is_renderable(ob)) + if (!DRW_object_is_renderable(ob)) { return; + } if (ob->type == OB_MESH) { workbench_cache_populate_particles(vedata, ob); diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c index 66ee25c0d82..80c35f3cfcd 100644 --- a/source/blender/draw/engines/workbench/workbench_forward.c +++ b/source/blender/draw/engines/workbench/workbench_forward.c @@ -498,8 +498,9 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob) Scene *scene = draw_ctx->scene; const bool is_wire = (ob->dt == OB_WIRE); - if (!DRW_object_is_renderable(ob)) + if (!DRW_object_is_renderable(ob)) { return; + } if (ob->type == OB_MESH) { workbench_forward_cache_populate_particles(vedata, ob); |