From: havoc Date: Fri, 19 Nov 2010 13:55:20 +0000 (+0000) Subject: fix fog on particles (premultiplied alpha change was doing it wrong) X-Git-Tag: xonotic-v0.1.0preview~56^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9c016d8538bf36067ca4c9c875841fc68a53a182;p=xonotic%2Fdarkplaces.git fix fog on particles (premultiplied alpha change was doing it wrong) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10615 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_particles.c b/cl_particles.c index 955a5791..d0991e53 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -2525,9 +2525,9 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh c4f[3] = 0; break; case PBLEND_ALPHA: - c4f[0] = alpha * p->color[0] * colormultiplier[0]; - c4f[1] = alpha * p->color[1] * colormultiplier[1]; - c4f[2] = alpha * p->color[2] * colormultiplier[2]; + c4f[0] = p->color[0] * colormultiplier[0]; + c4f[1] = p->color[1] * colormultiplier[1]; + c4f[2] = p->color[2] * colormultiplier[2]; c4f[3] = alpha; // note: lighting is not cheap! if (particletype[p->typeindex].lighting) @@ -2546,6 +2546,8 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh c4f[1] = c4f[1] * fog + r_refdef.fogcolor[1] * ifog; c4f[2] = c4f[2] * fog + r_refdef.fogcolor[2] * ifog; } + // for premultiplied alpha we have to apply the alpha to the color (after fog of course) + VectorScale(c4f, alpha, c4f); break; } // copy the color into the other three vertices