Fix T41408: Render layer pass bug, second attempt

Missed some passes in the previous commit. Now seems all the passes
are covered, at least with my understanding of the things.

There're some weird things going around with the refraction pass,
but that is caused by some other issue in the code. Would rather
call it a TODO for now.
This commit is contained in:
Sergey Sharybin 2014-08-13 22:43:11 +06:00
parent fc2b6a2b9d
commit be755f3873
Notes: blender-bot 2023-02-14 10:14:10 +01:00
Referenced by issue #41408, Render layer pass bug
1 changed files with 12 additions and 2 deletions

View File

@ -1706,9 +1706,19 @@ static void wrld_exposure_correct(float diff[3])
void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
{
/* Passes which might need to know material color.
*
* It seems to be faster to just calculate material color
* even if the pass doesn't really need it than tryign to
* figure out whether color is really needed or not.
*/
const int color_passes =
SCE_PASS_COMBINED | SCE_PASS_RGBA | SCE_PASS_DIFFUSE | SCE_PASS_SPEC |
SCE_PASS_REFLECT | SCE_PASS_NORMAL | SCE_PASS_REFRACT | SCE_PASS_EMIT;
Material *ma= shi->mat;
int passflag= shi->passflag;
memset(shr, 0, sizeof(ShadeResult));
if (!(shi->mode & MA_TRANSP)) shi->alpha = 1.0f;
@ -1723,7 +1733,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
shi->refcol[0]= shi->refcol[1]= shi->refcol[2]= shi->refcol[3]= 0.0f;
/* material color itself */
if (passflag & (SCE_PASS_COMBINED|SCE_PASS_RGBA|SCE_PASS_DIFFUSE|SCE_PASS_SPEC)) {
if (passflag & color_passes) {
if (ma->mode & (MA_FACETEXTURE)) {
shi->r= shi->vcol[0];
shi->g= shi->vcol[1];