PageRenderTime 40ms CodeModel.GetById 35ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/extra/gpu/demos/bunny/bunny.v.glsl

http://github.com/abeaumont/factor
Unknown | 22 lines | 16 code | 6 blank | 0 comment | 0 complexity | d02422856b0661f59f5c3e68f4f561f9 MD5 | raw file
 1#version 110
 2
 3uniform mat4 mv_matrix, p_matrix;
 4uniform vec3 light_position;
 5
 6attribute vec3 vertex, normal;
 7
 8varying vec3 frag_normal;
 9varying vec3 frag_light_direction;
10varying vec3 frag_eye_direction;
11
12void
13main()
14{
15    vec4 position = mv_matrix * vec4(vertex, 1.0);
16
17    gl_Position = p_matrix * position;
18    frag_normal = (mv_matrix * vec4(normal, 0.0)).xyz;
19    frag_light_direction = (mv_matrix * vec4(light_position, 1.0)).xyz - position.xyz;
20    frag_eye_direction = position.xyz;
21
22}