]> git.tdb.fi Git - libs/gl.git/commitdiff
Hide the use of the tangent variable in common.glsl behind an if
authorMikko Rasa <tdb@tdb.fi>
Wed, 17 Nov 2021 13:46:19 +0000 (15:46 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 17 Nov 2021 13:48:20 +0000 (15:48 +0200)
shaderlib/common.glsl

index 481d86c48a604bfe2b1622836a72aaee3a94ffe5..35d5a87eafb8bf8c83e8fe877cdf5e90b0a3d724 100644 (file)
@@ -43,9 +43,12 @@ void standard_transform()
        gl_Position = clip_eye_matrix*eye_vertex;
 
        out vec3 world_normal = normal_tf*get_vertex_normal();
-       vec3 world_tangent = normal_tf*tangent;
-       vec3 world_binormal = cross(world_normal, world_tangent);
-       out mat3 world_tbn_matrix = mat3(world_tangent, world_binormal, world_normal);
+       if(use_normal_map)
+       {
+               vec3 world_tangent = normal_tf*tangent;
+               vec3 world_binormal = cross(world_normal, world_tangent);
+               out mat3 world_tbn_matrix = mat3(world_tangent, world_binormal, world_normal);
+       }
 
        vec3 eye_pos = world_eye_matrix[3].xyz;
        out vec3 world_look_dir = normalize(world_vertex.xyz-eye_pos);