10 uniform mat4 projection;
14 uniform vec3 vLightPos;
15 uniform vec3 vViewPos;
26 sampler2D specularMap;
36 uniform Material material;
40 vec4 pos = model * vec4(vPosition, 1.f);
41 defNormal = mat3(transpose(inverse(model))) * vNormal;
45 if (material.hasNormalMap) {
46 vec3 T = normalize(vec3(model * vec4(tangent, 0.0)));
47 vec3 B = normalize(vec3(model * vec4(bitangent, 0.0)));
48 vec3 N = normalize(vec3(model * vec4(vNormal, 0.0)));
49 // convert TBN to world->tangent space
50 mat3 TBN = transpose(mat3(T, B, N));
51 lightPos = TBN * vLightPos;
52 viewPos = TBN * vViewPos;
53 fragPos = TBN * vec3(pos);
60 gl_Position = projection * view * pos;