vol_clip_ps.txt 753 Bytes
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
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 26 27 28 29 30 31 32 33 34 35 36 37
//Pixel_Shader for flat rendering

varying vec3 normalFS, lightDirFS, eyeVecFS;

varying vec2 texCoordFS;
uniform sampler2D textureColor;
uniform sampler2D textureCenters;


varying vec4 toto;


void main (void)
{
	vec4 volColor;
	volColor.rgb = texture2D(textureColor, texCoordFS.xy).rgb;
	volColor.a = 1.0;

	vec4 final_color = 
	(gl_FrontLightModelProduct.sceneColor * gl_FrontMaterial.ambient) + 
	(gl_LightSource[0].ambient * gl_FrontMaterial.ambient);
							
	vec3 N = normalize(normalFS);
	vec3 L = normalize(lightDirFS);
	
	float lambertTerm = dot(N,L);
	
	if(lambertTerm > 0.0)
	{
		final_color += gl_LightSource[0].diffuse * 
					   volColor * 
					   lambertTerm;	
	}

	gl_FragColor = final_color;

 }