|
@@ -734,9 +734,18 @@ void main(void) {
|
|
#ifdef REFLECTIONFRESNEL
|
|
#ifdef REFLECTIONFRESNEL
|
|
float reflectionFresnelTerm = computeFresnelTerm(viewDirectionW, normalW, reflectionRightColor.a, reflectionLeftColor.a);
|
|
float reflectionFresnelTerm = computeFresnelTerm(viewDirectionW, normalW, reflectionRightColor.a, reflectionLeftColor.a);
|
|
|
|
|
|
|
|
+#ifdef REFLECTIONFRESNELFROMSPECULAR
|
|
|
|
+#ifdef SPECULARTERM
|
|
|
|
+ reflectionColor *= specularColor.rgb * (1.0 - reflectionFresnelTerm) + reflectionFresnelTerm * reflectionRightColor.rgb;
|
|
|
|
+#else
|
|
|
|
+ reflectionColor *= reflectionLeftColor.rgb * (1.0 - reflectionFresnelTerm) + reflectionFresnelTerm * reflectionRightColor.rgb;
|
|
|
|
+#endif
|
|
|
|
+#else
|
|
reflectionColor *= reflectionLeftColor.rgb * (1.0 - reflectionFresnelTerm) + reflectionFresnelTerm * reflectionRightColor.rgb;
|
|
reflectionColor *= reflectionLeftColor.rgb * (1.0 - reflectionFresnelTerm) + reflectionFresnelTerm * reflectionRightColor.rgb;
|
|
#endif
|
|
#endif
|
|
#endif
|
|
#endif
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
|
|
#ifdef OPACITY
|
|
#ifdef OPACITY
|
|
vec4 opacityMap = texture2D(opacitySampler, vOpacityUV);
|
|
vec4 opacityMap = texture2D(opacitySampler, vOpacityUV);
|
|
@@ -763,7 +772,7 @@ void main(void) {
|
|
// Emissive
|
|
// Emissive
|
|
vec3 emissiveColor = vEmissiveColor;
|
|
vec3 emissiveColor = vEmissiveColor;
|
|
#ifdef EMISSIVE
|
|
#ifdef EMISSIVE
|
|
- emissiveColor += texture2D(emissiveSampler, vEmissiveUV).rgb * vEmissiveInfos.y;
|
|
|
|
|
|
+ emissiveColor += texture2D(emissiveSampler, vEmissiveUV).rgb * vEmissiveInfos.y;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#ifdef EMISSIVEFRESNEL
|
|
#ifdef EMISSIVEFRESNEL
|
|
@@ -780,7 +789,12 @@ void main(void) {
|
|
#endif
|
|
#endif
|
|
|
|
|
|
// Composition
|
|
// Composition
|
|
- vec3 finalDiffuse = clamp(diffuseBase * diffuseColor + emissiveColor + vAmbientColor, 0.0, 1.0) * baseColor.rgb;
|
|
|
|
|
|
+#ifdef EMISSIVEASILLUMINATION
|
|
|
|
+ vec3 finalDiffuse = clamp(diffuseBase * diffuseColor + vAmbientColor, 0.0, 1.0) * baseColor.rgb;
|
|
|
|
+#else
|
|
|
|
+ vec3 finalDiffuse = clamp(diffuseBase * diffuseColor + emissiveColor + vAmbientColor, 0.0, 1.0) * baseColor.rgb;
|
|
|
|
+#endif
|
|
|
|
+
|
|
#ifdef SPECULARTERM
|
|
#ifdef SPECULARTERM
|
|
vec3 finalSpecular = specularBase * specularColor;
|
|
vec3 finalSpecular = specularBase * specularColor;
|
|
#else
|
|
#else
|
|
@@ -791,7 +805,12 @@ void main(void) {
|
|
alpha = clamp(alpha + dot(finalSpecular, vec3(0.3, 0.59, 0.11)), 0., 1.);
|
|
alpha = clamp(alpha + dot(finalSpecular, vec3(0.3, 0.59, 0.11)), 0., 1.);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- vec4 color = vec4(finalDiffuse * baseAmbientColor + finalSpecular + reflectionColor, alpha);
|
|
|
|
|
|
+// Composition
|
|
|
|
+#ifdef EMISSIVEASILLUMINATION
|
|
|
|
+ vec4 color = vec4(clamp(finalDiffuse * baseAmbientColor + finalSpecular + reflectionColor + emissiveColor, 0.0, 1.0), alpha);
|
|
|
|
+#else
|
|
|
|
+ vec4 color = vec4(finalDiffuse * baseAmbientColor + finalSpecular + reflectionColor, alpha);
|
|
|
|
+#endif
|
|
|
|
|
|
#ifdef FOG
|
|
#ifdef FOG
|
|
float fog = CalcFogFactor();
|
|
float fog = CalcFogFactor();
|