Change comparison in specular light function. Fixes issue 1258.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6505 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
donkopunchstania 2010-12-01 04:50:25 +00:00
parent 1f660de7e5
commit f91ac92895
3 changed files with 3 additions and 3 deletions

View File

@ -26,7 +26,7 @@
// shader cache for every revision, graphics-related or not, which is simply annoying.
enum
{
LINEAR_DISKCACHE_VER = 6504
LINEAR_DISKCACHE_VER = 6505
};
// On disk format:

View File

@ -415,7 +415,7 @@ char *GeneratePixelLightShader(char *p, int index, const LitChannel& chan, const
else if (chan.attnfunc == 1)
{ // specular
WRITE(p, "ldir = normalize("I_PLIGHTS".lights[%d].pos.xyz);\n",index);
WRITE(p, "attn = (dot(_norm0,ldir) > 0.0f) ? max(0.0f, dot(_norm0, "I_PLIGHTS".lights[%d].dir.xyz)) : 0.0f;\n", index);
WRITE(p, "attn = (dot(_norm0,ldir) >= 0.0f) ? max(0.0f, dot(_norm0, "I_PLIGHTS".lights[%d].dir.xyz)) : 0.0f;\n", index);
WRITE(p, "attn = max(0.0f, dot("I_PLIGHTS".lights[%d].cosatt.xyz, float3(1,attn,attn*attn))) / dot("I_PLIGHTS".lights[%d].distatt.xyz, float3(1,attn,attn*attn));\n", index, index);
}

View File

@ -571,7 +571,7 @@ char *GenerateLightShader(char *p, int index, const LitChannel& chan, const char
else if (chan.attnfunc == 1)
{ // specular
WRITE(p, "ldir = normalize("I_LIGHTS".lights[%d].pos.xyz);\n",index);
WRITE(p, "attn = (dot(_norm0,ldir) > 0.0f) ? max(0.0f, dot(_norm0, "I_LIGHTS".lights[%d].dir.xyz)) : 0.0f;\n", index);
WRITE(p, "attn = (dot(_norm0,ldir) >= 0.0f) ? max(0.0f, dot(_norm0, "I_LIGHTS".lights[%d].dir.xyz)) : 0.0f;\n", index);
WRITE(p, "attn = max(0.0f, dot("I_LIGHTS".lights[%d].cosatt.xyz, float3(1,attn,attn*attn))) / dot("I_LIGHTS".lights[%d].distatt.xyz, float3(1,attn,attn*attn));\n", index, index);
}