Brian | edf24e6 | 2007-02-03 11:36:16 -0700 | [diff] [blame] | 1 | // Fragment shader for cube-texture reflection mapping |
2 | // Brian Paul | ||||
3 | |||||
4 | |||||
5 | uniform samplerCube cubeTex; | ||||
6 | varying vec3 normal; | ||||
7 | uniform vec3 lightPos; | ||||
8 | |||||
9 | void main() | ||||
10 | { | ||||
11 | // simple diffuse, specular lighting: | ||||
12 | vec3 lp = normalize(lightPos); | ||||
13 | float dp = dot(lp, normalize(normal)); | ||||
14 | float spec = pow(dp, 5.0); | ||||
15 | |||||
16 | // final color: | ||||
17 | gl_FragColor = dp * textureCube(cubeTex, gl_TexCoord[0].xyz, 0.0) + spec; | ||||
18 | } |