From 88c51fed5cd66fec21e936d1c28370ea9221d3c9 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Sun, 31 Jan 2016 09:23:57 +0900 Subject: [PATCH] Clean up. --- .../shaders/ShaderChunk/lights_template.glsl | 42 ++++++++----------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/src/renderers/shaders/ShaderChunk/lights_template.glsl b/src/renderers/shaders/ShaderChunk/lights_template.glsl index 1064c6b5f2..9cb5351f97 100644 --- a/src/renderers/shaders/ShaderChunk/lights_template.glsl +++ b/src/renderers/shaders/ShaderChunk/lights_template.glsl @@ -83,48 +83,40 @@ IncidentLight directLight; #if defined( RE_IndirectDiffuse ) - { + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); - vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #ifdef USE_LIGHTMAP - #ifdef USE_LIGHTMAP + irradiance += 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 - #endif - - #if ( NUM_HEMI_LIGHTS > 0 ) + #if ( NUM_HEMI_LIGHTS > 0 ) - for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { - irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry ); + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry ); - } + } - #endif + #endif - // #if defined( USE_ENVMAP ) && defined( STANDARD ) + // #if defined( USE_ENVMAP ) && defined( STANDARD ) - // TODO, replace 8 with the real maxMIPLevel - // irradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, 8 ); // comment out until seams are fixed - - // #endif + // TODO, replace 8 with the real maxMIPLevel + // irradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, 8 ); // comment out until seams are fixed - RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); + // #endif - } + RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) - { - - // TODO, replace 8 with the real maxMIPLevel - vec3 radiance = getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry, Material_BlinnShininessExponent( material ), 8 ); + // TODO, replace 8 with the real maxMIPLevel + vec3 radiance = getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry, Material_BlinnShininessExponent( material ), 8 ); - RE_IndirectSpecular( radiance, geometry, material, reflectedLight ); - - } + RE_IndirectSpecular( radiance, geometry, material, reflectedLight ); #endif -- GitLab