Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uniform vec2 size;
- uniform vec3 center;
- vec3 billboard(vec3 v, mat4 view) {
- vec3 up = vec3(view[0][1], view[1][1], view[2][1]);
- vec3 right = vec3(view[0][0], view[1][0], view[2][0]);
- vec3 pos = center + right * v.x * size.x + up * v.y * size.y;
- return pos;
- }
- void main() {
- vec3 worldPos = billboard(position, viewMatrix);
- gl_Position = projectionMatrix * modelViewMatrix * vec4(worldPos, 1.0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement