audio-vis/shaders/sphere.vert
VersusTune d1ae2059f7 WIP
2020-04-07 21:44:46 +02:00

19 lines
469 B
GLSL

#version 300 es
in vec4 a_position;
uniform mat4 u_matrix;
uniform vec3 u_lightPos;
uniform float u_pointSize;
out vec4 fragNormal;
out vec3 v_surfaceToLight;
void main() {
// convert the position from pixels to 0.0 to 1.0
vec4 pos = a_position * u_matrix;
gl_Position = pos;
gl_PointSize = u_pointSize;
fragNormal = normalize(pos);
vec3 surfaceWorldPosition = (u_matrix * pos).xyz;
v_surfaceToLight = u_lightPos - surfaceWorldPosition;
}