4 uniform samplerCube dstex;
7 // uniform vec4 specular;
8 // uniform float shininess;
10 uniform float fog_density;
11 const vec3 sky_color = vec3(0.35, 0.5, 0.65);
14 // varying vec3 normal;
16 varying vec2 tex_coord;
17 varying vec3 world_normal;
23 vec4 itexel = textureCube(dstex, normalize(world_normal));
24 // vec3 p = normalize(pos);
25 // vec3 n = normalize(normal);
26 // vec3 l = normalize(ldir);
28 // vec3 r = normalize(-reflect(l, n));
29 // vec3 vdir = normalize(-p);
31 // float cdiff = max(dot(l, n), 0.0);
32 // float cspec = pow(max(dot(r, vdir), 0.0), shininess);
34 vec4 texel = texture2D(tex, tex_coord);
35 // vec3 object_color = diffuse.xyz * cdiff * texel.xyz + specular.xyz * cspec;
36 vec3 object_color = diffuse.xyz * texel.xyz * itexel.xyz;
38 float fog = clamp(exp(-fog_density * dist), 0.0, 1.0);
40 color.xyz = mix(sky_color, object_color, fog);