X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=shaderlib%2Fcommon.glsl;h=557d4d76a17cff24ef538946d8d95e531d5c099d;hb=8d211effd0c6db66e57f9ffd8ee712eef6069a1c;hp=dde09c12cff45bca1a4a60fe95d6a37305404ef8;hpb=a2b0d155023ca23afe7848ae5d17e0f7bc328525;p=libs%2Fgl.git diff --git a/shaderlib/common.glsl b/shaderlib/common.glsl index dde09c12..557d4d76 100644 --- a/shaderlib/common.glsl +++ b/shaderlib/common.glsl @@ -42,21 +42,18 @@ void standard_transform() vec4 eye_vertex = eye_world_matrix*world_vertex; 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); + out vec3 world_normal = normalize(normal_tf*get_vertex_normal()); + if(use_normal_map) + { + vec3 world_tangent = normalize(normal_tf*tangent); + vec3 world_binormal = normalize(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