standard_vertex.glsl 1015 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include <attributes>
  2. // Model uniforms
  3. uniform mat4 ModelViewMatrix;
  4. uniform mat3 NormalMatrix;
  5. uniform mat4 MVP;
  6. #include <material>
  7. #include <morphtarget_vertex_declaration>
  8. #include <bones_vertex_declaration>
  9. // Output variables for Fragment shader
  10. out vec4 Position;
  11. out vec3 Normal;
  12. out vec2 FragTexcoord;
  13. void main() {
  14. // Transform vertex position to camera coordinates
  15. Position = ModelViewMatrix * vec4(VertexPosition, 1.0);
  16. // Transform vertex normal to camera coordinates
  17. Normal = normalize(NormalMatrix * VertexNormal);
  18. vec2 texcoord = VertexTexcoord;
  19. #if MAT_TEXTURES > 0
  20. // Flip texture coordinate Y if requested.
  21. if (MatTexFlipY(0)) {
  22. texcoord.y = 1.0 - texcoord.y;
  23. }
  24. #endif
  25. FragTexcoord = texcoord;
  26. vec3 vPosition = VertexPosition;
  27. mat4 finalWorld = mat4(1.0);
  28. #include <morphtarget_vertex>
  29. #include <bones_vertex>
  30. // Output projected and transformed vertex position
  31. gl_Position = MVP * finalWorld * vec4(vPosition, 1.0);
  32. }