tofu

Making something with OpenGL in Go
Log | Files | Refs

vertex.glsl (526B)


      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 
      7 struct trans {
      8 	mat4 Projection;
      9 	mat4 View;
     10 	mat4 Model;
     11 };
     12 
     13 uniform trans Trans;
     14 out vec3 fnormal;
     15 out vec3 fpos;
     16 out vec2 texPos;
     17 void main() {
     18 	gl_Position = Trans.Projection * Trans.View * Trans.Model * vec4(pos, 1.0);
     19 	fnormal = normalize(mat3(transpose(inverse(Trans.Model))) * normal);
     20 	fpos = vec3(Trans.Model * vec4(pos, 1.0));
     21 	texPos = vTexPos;
     22 }
     23