Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 49 lines (37 sloc) 1.06 kb
21d28377 »
2012-03-11 initial commit
1 #version 150
2
3 // Vertex shader for texture mapping
4
5 #define PI 3.14159265358979323846264338327
6
7 uniform int gouraudMode;
8 uniform int seamFix;
9 uniform mat4 modelMatrix;
10 uniform mat3 normalMatrix;
11 uniform mat4 viewMatrix;
12 uniform mat4 inverseViewMatrix;
13 uniform mat4 projMatrix;
14 uniform vec3 lightDir; // assumed to be unit-length (already normalized)
15 uniform vec3 lightColor;
16 uniform vec3 objColor;
17 uniform float Ka;
18 uniform float Kd;
19 uniform float Ks;
20 uniform float shexp;
21
22 in vec4 vertPos;
23 in vec3 vertRgb;
24 in vec3 vertNorm;
25 in vec2 vertTex2;
26
27 out vec4 fragColor;
28 out vec3 texCoord;
29 out vec3 vnrm;
30
31 out vec3 fromEye;
32
33 void main() {
34
35 vnrm = normalMatrix * vertNorm;
36 vec4 vVert4 = viewMatrix * modelMatrix * vertPos;
37 vec3 vEyeVertex = normalize(vVert4.xyz / vVert4.w);
38 vec4 vCoords = vec4(reflect(vEyeVertex, vnrm), 1.0);
39 vCoords = inverseViewMatrix * vCoords;
40 texCoord = normalize(vCoords.xyz);
41
42 fromEye = vEyeVertex;
43
44 // transform vertices
45 gl_Position = projMatrix * viewMatrix * modelMatrix * vertPos;
46
47 // texCoord = normalize(vertPos.xyz);
48
49 }
Something went wrong with that request. Please try again.