X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=shaderlib%2Fcommon.glsl;h=35d5a87eafb8bf8c83e8fe877cdf5e90b0a3d724;hb=0f256116c84a5b926bc923f5bbad95622933517a;hp=4d6112d9f2b37a58127f6a5330837b5b55973217;hpb=4d276c9b986b111611b8396f94dae56dbe736387;p=libs%2Fgl.git diff --git a/shaderlib/common.glsl b/shaderlib/common.glsl index 4d6112d9..35d5a87e 100644 --- a/shaderlib/common.glsl +++ b/shaderlib/common.glsl @@ -43,20 +43,17 @@ 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 = (inverse(eye_world_matrix)*vec4(0.0, 0.0, 0.0, 1.0)).xyz; + vec3 eye_pos = world_eye_matrix[3].xyz; out vec3 world_look_dir = normalize(world_vertex.xyz-eye_pos); out float fog_coord = eye_vertex.z; - - if(use_clipping) - { - for(int i=0; i