sprite_vertex.glsl 566 B

123456789101112131415161718192021222324252627282930313233
  1. //
  2. // Vertex shader for sprites
  3. //
  4. #include <attributes>
  5. // Input uniforms
  6. uniform mat4 MVP;
  7. #include <material>
  8. // Outputs for fragment shader
  9. out vec3 Color;
  10. out vec2 FragTexcoord;
  11. void main() {
  12. // Applies transformation to vertex position
  13. gl_Position = MVP * vec4(VertexPosition, 1.0);
  14. // Outputs color
  15. Color = MatDiffuseColor;
  16. // Flips texture coordinate Y if requested.
  17. vec2 texcoord = VertexTexcoord;
  18. #if MAT_TEXTURES>0
  19. if (MatTexFlipY[0]) {
  20. texcoord.y = 1 - texcoord.y;
  21. }
  22. #endif
  23. FragTexcoord = texcoord;
  24. }