Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. attribute vec3 position;
  2. uniform mat4 modelViewMatrix;
  3. uniform mat4 modelMatrix;
  4. uniform mat4 projectionMatrix;
  5.  
  6. uniform float scale;
  7. uniform float size;
  8. uniform float aspect;
  9. varying vec2 vUv;
  10.  
  11. void main() {
  12. vec2 scale = vec2(
  13. length(modelViewMatrix[0]) / aspect,
  14. length(modelViewMatrix[1])
  15. );
  16.  
  17. vec4 billboard = (modelViewMatrix * vec4(vec3(0.0), 1.0));
  18. vec4 newPosition = projectionMatrix
  19. * billboard
  20. + vec4(scale * position.xy, 0.0, 0.0);
  21.  
  22. gl_Position = newPosition;
  23. vUv = vec2(position.x + 0.5, position.y + 0.5);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement