Advertisement
Guest User

Untitled

a guest
Jul 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #shader vertex
  2. #version 150 core
  3.  
  4. in vec4 position;
  5. in vec2 texcoord;
  6.  
  7. uniform mat4 u_mvp;
  8.  
  9. struct v2f {
  10.     vec2 texcoord;
  11. };
  12.  
  13. out v2f _v2f;
  14.  
  15. void main()
  16. {
  17.     _v2f.texcoord = texcoord;
  18.     gl_Position = u_mvp * position;
  19. }
  20.  
  21. #shader fragment
  22. #version 150 core
  23.  
  24. struct v2f {
  25.     vec2 texcoord;
  26. };
  27.  
  28. in v2f _v2f;
  29.  
  30. struct material {
  31.     sampler2D mainTex;
  32.     vec2 offset;
  33.     vec4 tint;
  34.     float alpha;
  35. };
  36.  
  37. uniform material u_mat;
  38.  
  39. out vec4 outColor;
  40.  
  41. void main()
  42. {
  43.     outColor = texture(u_mat.mainTex, _v2f.texcoord - u_mat.offset) * u_mat.tint * vec4(1, 1, 1, u_mat.alpha);
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement