Explorar o código

Remove light info copy to functions

sebastien %!s(int64=7) %!d(string=hai) anos
pai
achega
2a4ac29f0c

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

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

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

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