mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-28 10:09:40 +00:00
Optimise lighting.glsl for Mesa users.
This commit is contained in:
parent
3b3721897d
commit
1098bd2467
1 changed files with 3 additions and 3 deletions
|
@ -35,12 +35,12 @@ vec4 doLighting(vec3 viewPos, vec3 viewNormal, vec4 vertexColor, out vec3 shadow
|
||||||
vec3 diffuseLight, ambientLight;
|
vec3 diffuseLight, ambientLight;
|
||||||
perLight(ambientLight, diffuseLight, 0, viewPos, viewNormal, diffuse, ambient);
|
perLight(ambientLight, diffuseLight, 0, viewPos, viewNormal, diffuse, ambient);
|
||||||
#if PER_PIXEL_LIGHTING
|
#if PER_PIXEL_LIGHTING
|
||||||
lightResult.xyz += ambientLight + diffuseLight * shadowing;
|
lightResult.xyz += diffuseLight * shadowing - diffuseLight; // This light gets added a second time in the loop to fix Mesa users' slowdown, so we need to negate its contribution here.
|
||||||
#else
|
#else
|
||||||
shadowDiffuse = diffuseLight;
|
shadowDiffuse = diffuseLight;
|
||||||
lightResult.xyz += ambientLight;
|
lightResult.xyz -= shadowDiffuse; // This light gets added a second time in the loop to fix Mesa users' slowdown, so we need to negate its contribution here.
|
||||||
#endif
|
#endif
|
||||||
for (int i=1; i<MAX_LIGHTS; ++i)
|
for (int i=0; i<MAX_LIGHTS; ++i)
|
||||||
{
|
{
|
||||||
perLight(ambientLight, diffuseLight, i, viewPos, viewNormal, diffuse, ambient);
|
perLight(ambientLight, diffuseLight, i, viewPos, viewNormal, diffuse, ambient);
|
||||||
lightResult.xyz += ambientLight + diffuseLight;
|
lightResult.xyz += ambientLight + diffuseLight;
|
||||||
|
|
Loading…
Reference in a new issue