浏览代码

Remove light info copy to functions

sebastien 7 年之前
父节点
当前提交
2a4ac29f0c
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 1 1
      src/Shaders/ShadersInclude/lightFragment.fx
  2. 2 2
      src/Shaders/ShadersInclude/lightsFragmentFunctions.fx

+ 1 - 1
src/Shaders/ShadersInclude/lightFragment.fx

@@ -24,7 +24,7 @@
 			#endif
 			#endif
 		#endif
 		#endif
 		#ifdef PROJECTEDLIGHTTEXTURE{X}
 		#ifdef PROJECTEDLIGHTTEXTURE{X}
-			appendProjectionTextureLighting(info, projectionLightSampler{X}, textureProjectionMatrix{X});
+			info.diffuse *= computeProjectionTextureDiffuseLighting(projectionLightSampler{X}, textureProjectionMatrix{X});
 		#endif
 		#endif
     #endif
     #endif
 	#ifdef SHADOW{X}
 	#ifdef SHADOW{X}

+ 2 - 2
src/Shaders/ShadersInclude/lightsFragmentFunctions.fx

@@ -109,12 +109,12 @@ lightingInfo computeHemisphericLighting(vec3 viewDirectionW, vec3 vNormal, vec4
 		return result;
 		return result;
 }
 }
 
 
-void appendProjectionTextureLighting(inout lightingInfo origin, sampler2D projectionLightSampler, mat4 textureProjectionMatrix){
+vec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler, mat4 textureProjectionMatrix){
 	vec4 strq = textureProjectionMatrix * vec4(vPositionW, 1.0);
 	vec4 strq = textureProjectionMatrix * vec4(vPositionW, 1.0);
 	strq /= strq.w;
 	strq /= strq.w;
 	vec3 textureColor = texture2D(projectionLightSampler, strq.xy).rgb;
 	vec3 textureColor = texture2D(projectionLightSampler, strq.xy).rgb;
 #ifdef PBR
 #ifdef PBR
 	textureColor = toLinearSpace(textureColor);
 	textureColor = toLinearSpace(textureColor);
 #endif
 #endif
-	origin.diffuse *= textureColor;
+	return textureColor;
 }
 }