summaryrefslogtreecommitdiff
path: root/progs/glsl/cubemap.frag
blob: 9c27648aaf93d598c9e4f8ed28f5dee5c24ab3ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Fragment shader for cube-texture reflection mapping
// Brian Paul


uniform samplerCube cubeTex;
varying vec3 normal;
uniform vec3 lightPos;

void main()
{
   // simple diffuse, specular lighting:
   vec3 lp = normalize(lightPos);
   float dp = dot(lp, normalize(normal));
   float spec = pow(dp, 5.0);

   // final color:
   gl_FragColor = dp * textureCube(cubeTex, gl_TexCoord[0].xyz, 0.0) + spec;
}