From 9c016d8538bf36067ca4c9c875841fc68a53a182 Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 19 Nov 2010 13:55:20 +0000 Subject: [PATCH] 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 --- cl_particles.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 -- 2.39.2