From 0f256116c84a5b926bc923f5bbad95622933517a Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 17 Nov 2021 15:46:19 +0200 Subject: [PATCH] Hide the use of the tangent variable in common.glsl behind an if --- shaderlib/common.glsl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/shaderlib/common.glsl b/shaderlib/common.glsl index 481d86c4..35d5a87e 100644 --- a/shaderlib/common.glsl +++ b/shaderlib/common.glsl @@ -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); -- 2.45.2