vertex.glsl (661B)
1 #version 330 core 2 layout (location = 0) in vec3 pos; 3 layout (location = 1) in vec3 col; 4 layout (location = 2) in vec2 vTexPos; 5 layout (location = 3) in vec3 normal; 6 layout (location = 4) in vec3 tangent; 7 8 struct trans { 9 mat4 Projection; 10 mat4 View; 11 mat4 Model; 12 }; 13 14 uniform trans Trans; 15 out vec3 fnormal; 16 //out vec3 ftangent; 17 out vec3 fpos; 18 out vec2 texPos; 19 20 void main() { 21 gl_Position = Trans.Projection * Trans.View * Trans.Model * vec4(pos, 1.0); 22 fnormal = normalize(mat3(transpose(inverse(Trans.Model))) * normal); 23 // ftangent = normalize(mat3(transpose(inverse(Trans.Model))) * tangent); 24 fpos = vec3(Trans.Model * vec4(pos, 1.0)); 25 texPos = vTexPos; 26 } 27