Subversion Repository Public Repository

artic

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
//#define USE_CONTRA_SPECULAR


void main()
{
	mediump		vec3	normal=normalize(vNormal);
	mediump		float	dp_diffuse=max(0.0,-dot(normal,uLightDirection));
	mediump		float	dp_specular=max(0.0,dot(uEyeDirection,reflect(uLightDirection,normal)));
	#if defined(USE_CONTRA_SPECULAR)
	lowp	float	dp_contra_specular=max(0.0,dot(cross(uEyeDirection,vec3(0.0,0.0,-1.0)),reflect(uLightDirection,normal)));
	#endif
	
	#if defined(USE_TEXTURE)
		gl_FragColor = texture2D(uTexture,vTexCoords);
	#else
		gl_FragColor = uColor;
	#endif
	gl_FragColor.xyz *= vec3(dp_diffuse * 0.6 + 0.4);
	gl_FragColor.xyz += vec3(0.4*pow(dp_specular,16.0));

	#if defined(USE_CONTRA_SPECULAR)
	gl_FragColor.xyz += vec3(0.6*pow(dp_contra_specular,16.0));
	#endif
	
	//gl_FragColor.xyz = uEyeDirection;
}

Commits for artic/ARTIC/assets/ShaderEngine.fsh

Diff revisions: vs.
Revision Author Commited Message
3 CESAR-AIJU picture CESAR-AIJU Tue 01 Mar, 2016 17:50:10 +0000

Subiendo Proyecto Artic