mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-07 05:03:35 +02:00
Apply attenuation to ambient light
This commit is contained in:
@@ -325,7 +325,7 @@ void Lighter::Light(float colorOut0[4], float colorOut1[4], const float colorIn[
|
||||
}
|
||||
|
||||
Color4 lightDiff(gstate_c.lightColor[1][l], 0.0f);
|
||||
Color4 diff = (lightDiff * *diffuse) * (dot * lightScale);
|
||||
Color4 diff = (lightDiff * *diffuse) * dot;
|
||||
|
||||
// Real PSP specular
|
||||
Vec3 toViewer(0,0,1);
|
||||
@@ -348,7 +348,7 @@ void Lighter::Light(float colorOut0[4], float colorOut1[4], const float colorIn[
|
||||
if (gstate.lightEnable[l] & 1)
|
||||
{
|
||||
Color4 lightAmbient(gstate_c.lightColor[0][l], 0.0f);
|
||||
lightSum0 += lightAmbient + diff;
|
||||
lightSum0 += (lightAmbient + diff) * lightScale;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -361,14 +361,14 @@ void GenerateVertexShader(int prim, char *buffer) {
|
||||
break;
|
||||
}
|
||||
|
||||
WRITE(p, " vec3 diffuse%i = (u_lightdiffuse%i * %s) * (max(dot%i, 0.0) * lightScale%i);\n", i, i, diffuse, i, i);
|
||||
WRITE(p, " vec3 diffuse%i = (u_lightdiffuse%i * %s) * max(dot%i, 0.0);\n", i, i, diffuse, i);
|
||||
if (doSpecular) {
|
||||
WRITE(p, " vec3 halfVec%i = normalize(normalize(toLight%i) + vec3(0.0, 0.0, 1.0));\n", i, i);
|
||||
WRITE(p, " dot%i = dot(halfVec%i, worldnormal);\n", i, i);
|
||||
WRITE(p, " if (dot%i > 0.0)\n", i);
|
||||
WRITE(p, " lightSum1 += u_lightspecular%i * %s * (pow(dot%i, u_matspecular.a) * (dot%i * lightScale%i));\n", i, specular, i, i, i);
|
||||
}
|
||||
WRITE(p, " lightSum0 += vec4(u_lightambient%i + diffuse%i, 0.0);\n", i, i);
|
||||
WRITE(p, " lightSum0 += vec4((u_lightambient%i + diffuse%i)*lightScale%i, 0.0);\n", i, i, i);
|
||||
}
|
||||
|
||||
if (gstate.isLightingEnabled()) {
|
||||
|
||||
Reference in New Issue
Block a user