23 lines
No EOL
473 B
GLSL
23 lines
No EOL
473 B
GLSL
#version 120
|
|
|
|
attribute vec3 in_vertex;
|
|
attribute vec3 in_normal;
|
|
|
|
varying vec3 vertex;
|
|
varying vec3 normal;
|
|
varying vec3 lightDirection;
|
|
|
|
uniform mat4 model;
|
|
uniform vec3 lightPosition;
|
|
|
|
void main()
|
|
{
|
|
// TODO: this becomes invalid when projection matrices are used
|
|
vec3 p = (model*vec4(in_vertex, 1.0)).xyz;
|
|
lightDirection = normalize(lightPosition - p);
|
|
|
|
vertex = p.xyz;
|
|
normal = normalize((model*vec4(in_normal.xyz, 0.0)).xyz);
|
|
|
|
gl_Position = vec4(p, 1.0);
|
|
} |