diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/draw/engines/eevee/shaders/default_frag.glsl | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/default_frag.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/default_frag.glsl | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/default_frag.glsl b/source/blender/draw/engines/eevee/shaders/default_frag.glsl index 3a5f6171a16..c568b4d94be 100644 --- a/source/blender/draw/engines/eevee/shaders/default_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/default_frag.glsl @@ -7,41 +7,40 @@ uniform float roughness; Closure nodetree_exec(void) { #ifdef HAIR_SHADER - vec3 B = normalize(cross(worldNormal, hairTangent)); - float cos_theta; - if (hairThicknessRes == 1) { - vec4 rand = texelFetch(utilTex, ivec3(ivec2(gl_FragCoord.xy) % LUT_SIZE, 2.0), 0); - /* Random cosine normal distribution on the hair surface. */ - cos_theta = rand.x * 2.0 - 1.0; - } - else { - /* Shade as a cylinder. */ - cos_theta = hairThickTime / hairThickness; - } - float sin_theta = sqrt(max(0.0, 1.0f - cos_theta*cos_theta)); - vec3 N = normalize(worldNormal * sin_theta + B * cos_theta); - vec3 vN = mat3(ViewMatrix) * N; + vec3 B = normalize(cross(worldNormal, hairTangent)); + float cos_theta; + if (hairThicknessRes == 1) { + vec4 rand = texelFetch(utilTex, ivec3(ivec2(gl_FragCoord.xy) % LUT_SIZE, 2.0), 0); + /* Random cosine normal distribution on the hair surface. */ + cos_theta = rand.x * 2.0 - 1.0; + } + else { + /* Shade as a cylinder. */ + cos_theta = hairThickTime / hairThickness; + } + float sin_theta = sqrt(max(0.0, 1.0f - cos_theta * cos_theta)); + vec3 N = normalize(worldNormal * sin_theta + B * cos_theta); + vec3 vN = mat3(ViewMatrix) * N; #else - vec3 N = normalize(gl_FrontFacing ? worldNormal : -worldNormal); - vec3 vN = normalize(gl_FrontFacing ? viewNormal : -viewNormal); + vec3 N = normalize(gl_FrontFacing ? worldNormal : -worldNormal); + vec3 vN = normalize(gl_FrontFacing ? viewNormal : -viewNormal); #endif - vec3 dielectric = vec3(0.034) * specular * 2.0; - vec3 albedo = mix(basecol, vec3(0.0), metallic); - vec3 f0 = mix(dielectric, basecol, metallic); - vec3 out_diff, out_spec, ssr_spec; - eevee_closure_default(N, albedo, f0, 1, roughness, 1.0, out_diff, out_spec, ssr_spec); + vec3 dielectric = vec3(0.034) * specular * 2.0; + vec3 albedo = mix(basecol, vec3(0.0), metallic); + vec3 f0 = mix(dielectric, basecol, metallic); + vec3 out_diff, out_spec, ssr_spec; + eevee_closure_default(N, albedo, f0, 1, roughness, 1.0, out_diff, out_spec, ssr_spec); - Closure result = Closure( - out_spec + out_diff * albedo, - 1.0, - vec4(ssr_spec, roughness), - normal_encode(vN, viewCameraVec), - 0); + Closure result = Closure(out_spec + out_diff * albedo, + 1.0, + vec4(ssr_spec, roughness), + normal_encode(vN, viewCameraVec), + 0); #ifdef LOOKDEV - gl_FragDepth = 0.0; + gl_FragDepth = 0.0; #endif - return result; + return result; } |