audio-vis/shaders/sphere.vert

21 lines
460 B
GLSL
Raw Normal View History

2020-04-05 15:28:22 +02:00
#version 300 es
in vec4 a_position;
uniform mat4 u_world;
uniform mat4 u_matrix;
uniform vec3 u_lightPos;
uniform vec3 u_light;
uniform float u_pointSize;
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;
vec3 surfaceWorldPosition = (u_world * pos).xyz;
v_surfaceToLight = u_lightPos - surfaceWorldPosition;
}