|
@@ -1,31 +1,3 @@
|
|
|
-#ifndef FLAT_SHADED
|
|
|
-
|
|
|
- vec3 normal = normalize( vNormal );
|
|
|
-
|
|
|
- #ifdef DOUBLE_SIDED
|
|
|
-
|
|
|
- normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );
|
|
|
-
|
|
|
- #endif
|
|
|
-
|
|
|
-#else
|
|
|
-
|
|
|
- vec3 fdx = dFdx( vViewPosition );
|
|
|
- vec3 fdy = dFdy( vViewPosition );
|
|
|
- vec3 normal = normalize( cross( fdx, fdy ) );
|
|
|
-
|
|
|
-#endif
|
|
|
-
|
|
|
-#ifdef USE_NORMALMAP
|
|
|
-
|
|
|
- normal = perturbNormal2Arb( -vViewPosition, normal );
|
|
|
-
|
|
|
-#elif defined( USE_BUMPMAP )
|
|
|
-
|
|
|
- normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );
|
|
|
-
|
|
|
-#endif
|
|
|
-
|
|
|
vec3 viewDir = normalize( vViewPosition );
|
|
|
|
|
|
vec3 totalDiffuseLight = vec3( 0.0 );
|
|
@@ -126,32 +98,6 @@ vec3 totalSpecularLight = vec3( 0.0 );
|
|
|
|
|
|
#endif
|
|
|
|
|
|
-#if MAX_HEMI_LIGHTS > 0
|
|
|
-
|
|
|
- for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {
|
|
|
-
|
|
|
- vec3 lightDir = hemisphereLightDirection[ i ];
|
|
|
-
|
|
|
- // diffuse
|
|
|
-
|
|
|
- float dotProduct = dot( normal, lightDir );
|
|
|
-
|
|
|
- float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;
|
|
|
-
|
|
|
- vec3 lightColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );
|
|
|
-
|
|
|
- totalDiffuseLight += lightColor;
|
|
|
-
|
|
|
- // specular (sky term only)
|
|
|
-
|
|
|
- vec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );
|
|
|
-
|
|
|
- totalSpecularLight += brdf * specularStrength * lightColor * max( dotProduct, 0.0 );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-#endif
|
|
|
-
|
|
|
#ifdef METAL
|
|
|
|
|
|
outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight ) * specular + totalSpecularLight + totalEmissiveLight;
|