You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

50 lines
901 B

  1. [vert.glsl]
  2. #version 120
  3. attribute vec3 in_vertex;
  4. attribute vec4 in_color;
  5. attribute vec4 in_texcoord;
  6. uniform mat4 in_model_view;
  7. uniform mat3 in_normal_mat;
  8. uniform mat4 in_proj;
  9. varying vec4 pass_texcoord;
  10. varying vec4 pass_color;
  11. void main(void)
  12. {
  13. vec4 vertex = in_model_view * vec4(in_vertex - vec3(0.0,0.5,0.0), 1.0);
  14. //Billboard calculations
  15. vertex.x += (1.0 * in_texcoord.z);
  16. vertex.y += (- 1.0 * in_texcoord.w);
  17. //pass datas
  18. pass_texcoord = in_texcoord;
  19. pass_color = in_color;
  20. gl_Position = in_proj * vertex;
  21. }
  22. [frag.glsl]
  23. #version 120
  24. #if defined GL_ES
  25. precision highp float;
  26. #endif
  27. uniform sampler2D in_texture;
  28. varying vec4 pass_texcoord;
  29. varying vec4 pass_color;
  30. const float cos_45 = 0.70710678118;
  31. const float PI = 3.14159265358979323846264;
  32. void main(void)
  33. {
  34. gl_FragColor = texture2D(in_texture, pass_texcoord.xy) * pass_color;
  35. }