Advertisement
Guest User

Untitled

a guest
Apr 8th, 2019
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. uniform vec2 size;
  2. uniform vec3 center;
  3.  
  4. vec3 billboard(vec3 v, mat4 view) {
  5.     vec3 up = vec3(view[0][1], view[1][1], view[2][1]);
  6.     vec3 right = vec3(view[0][0], view[1][0], view[2][0]);
  7.     vec3 pos = center + right * v.x * size.x + up * v.y * size.y;
  8.     return pos;
  9. }
  10.  
  11. void main() {
  12.    vec3 worldPos = billboard(position, viewMatrix);
  13.    gl_Position = projectionMatrix * modelViewMatrix * vec4(worldPos, 1.0);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement