]> Dogcows Code - chaz/rasterize/blob - vertex.glsl
add opengl support
[chaz/rasterize] / vertex.glsl
1
2 /*
3 * CS5600 University of Utah
4 * Charles McGarvey
5 * mcgarvey@eng.utah.edu
6 */
7
8 #define MAX_LIGHTS 2
9
10 attribute vec4 vPosition;
11 attribute vec3 vNormal;
12 attribute vec2 vTextureCoord;
13 attribute vec4 vColor;
14
15 uniform mat4 view;
16 uniform mat4 model;
17 uniform mat4 projection;
18 uniform int numLights;
19 uniform vec3 eye;
20 uniform vec4 light[MAX_LIGHTS];
21
22 varying vec3 normal;
23 varying vec2 textureCoord;
24 varying vec4 color;
25 varying vec3 lightDir[MAX_LIGHTS];
26 varying vec3 eyeVec;
27
28 void main()
29 {
30 gl_Position = projection * view * model * vPosition;
31 normal = vec3(model * vec4(vNormal, 0.0));
32 textureCoord = vTextureCoord;
33 color = vColor;
34
35 vec4 pos = model * vPosition;
36 eyeVec = eye - pos.xyz;
37
38 int i;
39 for (i = 0; i < numLights; ++i) {
40 lightDir[i] = light[i].xyz - pos.xyz;
41 }
42 }
43
This page took 0.032293 seconds and 4 git commands to generate.