1 uniform int StyleUVW ; // 0 = specular reflection, 1 = diffuse reflection, 2 = use model vertex coordinates for uvw.
\r
2 uniform vec3 CameraPos;
\r
7 gl_Position = ftransform(); // same as gl_ModelViewProjectionMatrix * gl_Vertex;
\r
9 // compute the reflection vector, and assign it to texcoord 0
\r
10 if ( StyleUVW == 0 )
\r
12 vec4 worldPos = World*gl_Vertex;
\r
13 vec3 viewNormal = normalize(worldPos.xyz - CameraPos); // view vector
\r
15 gl_TexCoord[0] = vec4( reflect( viewNormal, normalize(gl_Normal) ), 1.0 );
\r
17 else if ( StyleUVW == 1 )
\r
19 // just use the normal for the reflection vector
\r
20 gl_TexCoord[0] = vec4(normalize(gl_Normal), 1.0);
\r
22 else if ( StyleUVW == 2 )
\r
24 // use vertex-coordinates for texture coordinates
\r
25 gl_TexCoord[0] = normalize(gl_Vertex);
\r