aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/app_settings/shaders/class3/objects/bumpshinyF.glsl
blob: 9d1a91db6138a906f930d6c051972233f16e3622 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
vec4 getLightColor();
void applyScatter(inout vec3 col);

uniform samplerCube environmentMap;
uniform sampler2D diffuseMap;
uniform sampler2D bumpMap;

void main() 
{
	vec4 diff = texture2D(diffuseMap, gl_TexCoord[0].xy);
	float b = texture2D(bumpMap, gl_TexCoord[0].xy).a;
	b -= texture2D(bumpMap, gl_TexCoord[2].xy).a;
	vec3 ref = textureCube(environmentMap, gl_TexCoord[1].xyz*vec3(1.0,1.0,1.0-b*5.0)).rgb;
	vec4 specular = gl_TexCoord[3];	
	vec3 col = mix(getLightColor().rgb * diff.rgb, ref, specular.a)+specular.rgb*diff.rgb;
	col += col * b;
	float m = (col.r + col.g + col.b);
	m *= 1.0/3.0;
	col = mix(col, vec3(m), -specular.a*specular.a);
	
	applyScatter(col);
			
	gl_FragColor.rgb = col;
	gl_FragColor.a = diff.a;
}