Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (23 sloc) 0.743 kb
uniform sampler2D BaseMap;
uniform sampler2D NormalMap;
varying vec3 LightDir;
varying vec3 HalfVector;
//varying vec3 ViewDir;
varying vec4 ColorEA;
varying vec4 ColorD;
void main( void )
{
vec4 color = ColorEA;
vec4 normal = texture2D( NormalMap, gl_TexCoord[0].st );
normal.rgb = normal.rgb * 2.0 - 1.0;
float NdotL = max( dot( normal.rgb, normalize( LightDir ) ), 0.0 );
if ( NdotL > 0.0 )
{
color += ColorD * NdotL;
float NdotHV = max( dot( normal.rgb, normalize( HalfVector ) ), 0.0 );
color += normal.a * gl_FrontMaterial.specular * gl_LightSource[0].specular * pow( NdotHV, gl_FrontMaterial.shininess );
}
color = min( color, 1.0 );
color *= texture2D( BaseMap, gl_TexCoord[0].st );
gl_FragColor = color;
}
Jump to Line
Something went wrong with that request. Please try again.