|
|
@ -77,10 +77,11 @@ void main()
|
|
|
|
vec3 specularColor = getSpecularColor().xyz;
|
|
|
|
vec3 specularColor = getSpecularColor().xyz;
|
|
|
|
#if @normalMap
|
|
|
|
#if @normalMap
|
|
|
|
vec4 normalTex = texture2D(normalMap, normalMapUV);
|
|
|
|
vec4 normalTex = texture2D(normalMap, normalMapUV);
|
|
|
|
|
|
|
|
vec3 normal = normalTex.xyz * 2.0 - 1.0;
|
|
|
|
#if @reconstructNormalZ
|
|
|
|
#if @reconstructNormalZ
|
|
|
|
normalTex.z = sqrt(1.0 - dot(normalTex.xy, normalTex.xy));
|
|
|
|
normal.z = sqrt(1.0 - dot(normal.xy, normal.xy));
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
vec3 viewNormal = normalToView(normalTex.xyz * 2.0 - 1.0);
|
|
|
|
vec3 viewNormal = normalToView(normal);
|
|
|
|
specularColor *= normalTex.a;
|
|
|
|
specularColor *= normalTex.a;
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
vec3 viewNormal = normalize(gl_NormalMatrix * passNormal);
|
|
|
|
vec3 viewNormal = normalize(gl_NormalMatrix * passNormal);
|
|
|
|