From: havoc Date: Sat, 23 Aug 2003 08:32:29 +0000 (+0000) Subject: negate the dnormal instead of negating the dotproduct result X-Git-Tag: xonotic-v0.1.0preview~6421 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d1526d3184f33308aacd38c94a838f02bb3c8517;p=xonotic%2Fdarkplaces.git negate the dnormal instead of negating the dotproduct result git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3410 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/r_light.c b/r_light.c index bd1bf3a8..f5bbc46f 100644 --- a/r_light.c +++ b/r_light.c @@ -540,7 +540,9 @@ void R_LightModel_CalcVertexColors(const float *ambientcolor4f, const float *dif float color[4], v[3], dot, dist2, f, dnormal[3]; nearlight_t *nl; usediffuse = DotProduct(diffusecolor, diffusecolor) > 0; - VectorCopy(diffusenormal, dnormal); + // negate the diffuse normal to avoid the need to negate the + // dotproduct on each vertex + VectorNegate(diffusenormal, dnormal); if (usediffuse) VectorNormalize(dnormal); // directional shading code here @@ -551,7 +553,7 @@ void R_LightModel_CalcVertexColors(const float *ambientcolor4f, const float *dif // silly directional diffuse shading if (usediffuse) { - dot = -DotProduct(normal3f, dnormal); + dot = DotProduct(normal3f, dnormal); if (dot > 0) VectorMA(color, dot, diffusecolor, color); }