Initial commit, stymied by LÖVR bugs
[lovr-particles] / shaders / particles.vert
1 in vec2 vertPosition;
2 uniform vec3 headPos;
3 layout(std430) buffer particleData { vec4 particlePos[2]; };
4
5 vec4 position(mat4 projection, mat4 transform, vec4 vertex) {
6 vec3 pos = particlePos[gl_InstanceID].xyz;
7 vec3 forward = normalize(pos - headPos);
8 vec3 right = normalize(cross(forward, vec3(0, 1, 0)));
9 vec3 up = cross(right, forward);
10 mat2 frame = mat2(up, right);
11 // vec3 vert = pos + vec3(frame * vertPosition * 0.3, 0);
12 vec3 vert = pos + vec3(vertPosition, 0);
13 return projection * transform * vec4(vert, 1);
14 }