|
@@ -3,8 +3,8 @@
|
|
|
// for specific lighting scenarios.
|
|
|
//
|
|
|
// Instructions for use:
|
|
|
-// - Ensure that both Material_RE_DirectLight, Material_RE_IndirectDiffuseLight and Material_RE_IndirectSpecularLight are defined
|
|
|
-// - If you have defined a Material_RE_IndirectSpecularLight, you need to also provide a Material_LightProbeLOD.
|
|
|
+// - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are defined
|
|
|
+// - If you have defined an RE_IndirectSpecular, you need to also provide a Material_LightProbeLOD. <---- ???
|
|
|
// - Create a material parameter that is to be passed as the third parameter to your lighting functions.
|
|
|
//
|
|
|
// TODO:
|
|
@@ -14,11 +14,12 @@
|
|
|
//
|
|
|
|
|
|
GeometricContext geometry;
|
|
|
-geometry.position = -vViewPosition;
|
|
|
+
|
|
|
+geometry.position = - vViewPosition;
|
|
|
geometry.normal = normal;
|
|
|
geometry.viewDir = normalize( vViewPosition );
|
|
|
|
|
|
-#if ( NUM_POINT_LIGHTS > 0 ) && defined( Material_RE_DirectLight )
|
|
|
+#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
|
|
|
|
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
|
|
|
|
@@ -36,13 +37,13 @@ geometry.viewDir = normalize( vViewPosition );
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
- Material_RE_DirectLight( directLight, geometry, material, reflectedLight );
|
|
|
+ RE_Direct( directLight, geometry, material, reflectedLight );
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
-#if ( NUM_SPOT_LIGHTS > 0 ) && defined( Material_RE_DirectLight )
|
|
|
+#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
|
|
|
|
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
|
|
|
|
@@ -60,13 +61,13 @@ geometry.viewDir = normalize( vViewPosition );
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
- Material_RE_DirectLight( directLight, geometry, material, reflectedLight );
|
|
|
+ RE_Direct( directLight, geometry, material, reflectedLight );
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
-#if ( NUM_DIR_LIGHTS > 0 ) && defined( Material_RE_DirectLight )
|
|
|
+#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
|
|
|
|
|
|
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|
|
|
|
@@ -84,21 +85,21 @@ geometry.viewDir = normalize( vViewPosition );
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
- Material_RE_DirectLight( directLight, geometry, material, reflectedLight );
|
|
|
+ RE_Direct( directLight, geometry, material, reflectedLight );
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
-#if defined( Material_RE_IndirectDiffuseLight )
|
|
|
+#if defined( RE_IndirectDiffuse )
|
|
|
|
|
|
{
|
|
|
|
|
|
- vec3 indirectDiffuseIrradiance = getAmbientLightIrradiance( ambientLightColor );
|
|
|
+ vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
|
|
|
|
|
|
#ifdef USE_LIGHTMAP
|
|
|
|
|
|
- indirectDiffuseIrradiance += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity; // factor of PI should not be present; included here to prevent breakage
|
|
|
+ irradiance += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity; // factor of PI should not be present; included here to prevent breakage
|
|
|
|
|
|
#endif
|
|
|
|
|
@@ -106,7 +107,7 @@ geometry.viewDir = normalize( vViewPosition );
|
|
|
|
|
|
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
|
|
|
|
|
- indirectDiffuseIrradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
|
|
|
+ irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -115,24 +116,24 @@ geometry.viewDir = normalize( vViewPosition );
|
|
|
// #if defined( USE_ENVMAP ) && defined( STANDARD )
|
|
|
|
|
|
// TODO, replace 8 with the real maxMIPLevel
|
|
|
- // indirectDiffuseIrradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, 8 ); // comment out until seams are fixed
|
|
|
+ // irradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, 8 ); // comment out until seams are fixed
|
|
|
|
|
|
// #endif
|
|
|
|
|
|
- Material_RE_IndirectDiffuseLight( indirectDiffuseIrradiance, geometry, material, reflectedLight );
|
|
|
+ RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
-#if defined( USE_ENVMAP ) && defined( Material_RE_IndirectSpecularLight )
|
|
|
+#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
|
|
|
|
|
|
{
|
|
|
|
|
|
// TODO, replace 8 with the real maxMIPLevel
|
|
|
- vec3 indirectSpecularRadiance = getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry, Material_BlinnShininessExponent( material ), 8 );
|
|
|
+ vec3 radiance = getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry, Material_BlinnShininessExponent( material ), 8 );
|
|
|
|
|
|
- Material_RE_IndirectSpecularLight( indirectSpecularRadiance, geometry, material, reflectedLight );
|
|
|
+ RE_IndirectSpecular( radiance, geometry, material, reflectedLight );
|
|
|
|
|
|
}
|
|
|
|