KlassischeKeplerKriege/data/shader/gameobjects.vert
2016-10-04 16:09:15 +02:00

27 lines
No EOL
602 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 mat4 view;
uniform vec3 lightPosition;
uniform float aspectRatio;
void main()
{
// TODO: this becomes invalid when projection matrices are used
vec3 asp = vec3(aspectRatio, 1.0, 1.0);
//vec3 asp = vec3(1.0, 1.0, 1.0);
vec3 p = (view*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);
}